Normals

Ok another noob question.

I am programming a Cad system and at the moment just playing around with how I am going to do the zooming.

I am not using lighting at the moment but I want to get things right now, to future proof by app. So I am worried about messing up my normals for the lighting. From what I have read the world matrix will definitely do this, so I was wondering if I use the projection matrix (I am using Matrix.OrthoRH) to do the zooming will my normals will be Ok

Thanks

Julian



Answer this question

Normals

  • Aibo

    Hi Eyal, it was the scaling that I was worried about, should have made that clear! If I use the projection matrix to scale, will the normal’s still need normalizing


  • Tika

    You do want the world matrix to affect your normals -- at least for rotation. Otherwise their direction won't match the way the object was rotated, and lighting will be incorrect. Translation in the world matrix won't affect normals. If you have scaling, however, you'd need to normalise your normals after they're transformed. In the fixed function pipeline this is done by setting the D3DRS_NORMALIZENORMALS render state to TRUE. In shaders you just code a 'normalize' in.

    BTW, with regards to zooming, conceptually it'd fit with either the view or projection matrix (the effects are different). The view matrix defines where the camera is, and moving the camera is often a natural way to create zooming.

  • Jovo Filips

    the matrices don't affect your normals.
  • gorden

    I guess it's work, but I won't suggest doing it, because it's conceptually tricky. Normalising the normals is what people do, which will make your code easier to understand.

  • Normals