world*proj for normals

Started by
4 comments, last by brega 13 years, 5 months ago
If i am setting an effect on something rendering at world*proj such as a weapon in a first person game ,what should the normals be multiplied by?
:)
Advertisement
Does your world matrix contain non-uniform scaling?
If so, multiply your normals by the transpose of the inverse of the world matrix. If not, then you can just multiply them by the world matrix.

If you mean that you draw the weapon relative to your camera, but that you want the normals to be transformed to reflect the way the camera is turning, then you should also multiply the normals with the view matrix.
gunScale*gunWorld*proj
:)
Sorry for intrusion but i have a similar question.

Suppose that i don't need any scaling (since i scale all meshes in modeling prg.) and i keep "default" scale of xyz.scale = 1.0 and have mesh with this vertex data:
struct VertexData{    float3 Position : POSITION;    float2 TexCoord : TEXCOORD0;    float3 Normal   : NORMAL;    float3 Tangent  : TANGENT;    float3 Binormal : Binormal;}; 


and want to "apply" normalmap/parallax effect do i need to transform these
with "transpose of the inverse of the world matrix" or just mul it with world?
Just mul it with world will give the correct result. The following page has an explanation: http://www.unknownroad.com/rtfm/graphics/rt_normals.html.
Thanks for the link. bookmarked.

This topic is closed to new replies.

Advertisement