How to access/calculate worldNormal in a Vertex and Fragment shader ?
Thanks a lot !
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityHow to access/calculate worldNormal in a Vertex and Fragment shader ?
Thanks a lot !
Multiply the normal with the worldmatrix, not the world_view_projection.
do this in the vertex shader, and then pass the value down as a linear interpolation value. then you dont need to do it in the pixelshader.
o.WorldNormal = normalize( mul(float4(v.normal, 0.0), _Object2World).xyz);
\$\endgroup\$