cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

rjfalconer
Journeyman III

RenderMonkey - Simple HLSL diffuse lighting shader jitters

Simple shader (see attached) compiles, but flickers and has artefects.

I'm expecting to see a sphere with a uniform gradient from white to black.

Effect workspace has matWorldInverseTranspose and matWorldViewProjection defined, as their predefined matricies.

(Running on ATi Radeon 4800 series)

Is it something I am doing wrong?

//Vertex float4x4 matWorldViewProjection; float4x4 matWorldInverseTranspose; float3 LightDirection : Direction = float3(1,0,0.5); struct VS_IN { float4 Position : POSITION; float3 Normal : NORMAL; }; struct VS_OUT { float4 Position : POSITION; float3 Light : TEXCOORD0; float3 Normal : TEXCOORD1; }; VS_OUT vs_main(VS_IN input) { VS_OUT output = (VS_OUT)0; output.Position = mul(input.Position,matWorldViewProjection); output.Light = normalize(LightDirection); output.Normal = normalize(mul(matWorldInverseTranspose,input.Normal)); return output; } //Pixel struct VS_OUT { float4 Position : POSITION; float3 Light : TEXCOORD0; float3 Normal : TEXCOORD1; }; struct PS_OUT { float4 Color : COLOR; }; PS_OUT ps_main(VS_OUT input) { PS_OUT output = (PS_OUT)0; output.Color = saturate(dot(input.Light,input.Normal)); return output; }

0 Likes
1 Reply
Byron
Staff

Try going to the “Stream Mapping” node and make sure there is an entry for “NORMAL” in the list.

If you modified one of the default projects chances are that you chose one that did not have NORMALs defined in the stream map.

attached the RFX file

0 Likes