scaled lights?

Started by
1 comment, last by ibr_ozdemir 17 years, 5 months ago
hi, do i have to scale my vertex's normal with "worldmatrix scale", because large(scaled) objects seem less light. maybe i'm making wrong "Transform" list.
Advertisement
1. if using the fixed function pipeline, set D3DRS_NORMALIZENORMALS to TRUE

2. if using shaders, normalize() the normal after transformation, but before lighting.

3. a better alternative is to not scale at all unless absoultely necessary. If the scaling is there to make an object a specific fixed size, scale the vertices once when you load instead of though the world transformation.

4. mathematically, at the core of the lighting equation is L.N, a dot product between the vertexToLight vector (L) and the vertex normal (N). The product has the property that "I = L.N == cos(theta) * ||L|| * ||N||" which means "the light/illumination is the same as the cosine of the angle between the L vector and the N vector multiplied by the length of the L vector, multiplied by the length the N vector". If L and N are both normalised, their lengths are 1 so you just get "cos(theta)". Scaling the object scales the length of N when the vertices get transformed.

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

thanks

This topic is closed to new replies.

Advertisement