How to access/calculate worldNormal in a Vertex and Fragment shader ?

Thanks a lot !


1 Answer 1


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.

  • \$\begingroup\$ Like this ? o.WorldNormal = normalize( mul(float4(v.normal, 0.0), _Object2World).xyz); \$\endgroup\$
    – MaT
    Commented Jul 10, 2013 at 13:37
  • \$\begingroup\$ Yes, that looks correct. \$\endgroup\$
    – Tordin
    Commented Jul 10, 2013 at 13:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .