Jump to content
  • Advertisement
Sign in to follow this  
ibr_ozdemir

scaled lights?

This topic is 4333 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!