Posted By: Reconnoiter
noob question related to outline code - 11/03/17 19:53
Howdy,
Below I have outline shader code that I successfully used previously in a non-ShadeC project, and now I want to use it in a ShadeC evo project. The problem is however that I think I need to add it to an existing pass. When I simply paste it after the current ShadeC pass the whole screen is the outline color (even with extreme thin outline size). And when pasting it as a separate pass it does nothing. So I quessing I need to add it to a current pass but within the linked VertexShader & PixelShader. So I tried that but than I apparently need to change the code/syntax otherwise it gives fx compiling errors ("object literals are not allowed inside functions").
Could someone help me a bit / point me in the right direction with altering the code so I can add it to the existing VertexShader & PixelShader? (if this is feasible that is)
The required variables:
The outline pass:
The Shade-C existing technique / pass (sc_deferred_finalize.fx):
Below I have outline shader code that I successfully used previously in a non-ShadeC project, and now I want to use it in a ShadeC evo project. The problem is however that I think I need to add it to an existing pass. When I simply paste it after the current ShadeC pass the whole screen is the outline color (even with extreme thin outline size). And when pasting it as a separate pass it does nothing. So I quessing I need to add it to a current pass but within the linked VertexShader & PixelShader. So I tried that but than I apparently need to change the code/syntax otherwise it gives fx compiling errors ("object literals are not allowed inside functions").
Could someone help me a bit / point me in the right direction with altering the code so I can add it to the existing VertexShader & PixelShader? (if this is feasible that is)
The required variables:
Code:
vector vecSkill41; const float4x4 matWorldViewProj;
The outline pass:
Code:
pass outline { CullMode = CCW; // (Commenting these didn't matter) Not really needed, it is the default state ZEnable = True; // Not really needed, it is the default state ZFunc = Less; // Not really needed, it is the default state ZWriteEnable = False; //cullMode = cw; vertexShaderConstant[0] = <matWorldViewProj>; vertexShaderConstant[16] = <vecSkill41>; // outline_thickness vertexShader = asm { vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord0 v7 dcl_texcoord1 v8 mov r0,v0 mul r1,c16.x,v3 // scale normal add r0.xyz,r0.xyz,r1.xyz // shell offset (vertex position + scaled normal) m4x4 oPos,r0,c0 // transform position to clip space }; pixelShader = asm { ps.1.3 def c0,255,255,0,1 // color outline rgba mov r0,c0 }; }
The Shade-C existing technique / pass (sc_deferred_finalize.fx):
Code:
technique t1 { pass p0 { //cullmode = ccw; //zwriteenable = false; alphablendenable = false; //VertexShader = compile vs_2_0 mainVS(); PixelShader = compile ps_3_0 mainPS(); //FogEnable = False; SRGBWriteEnable = true; } }