• Advertisement
Sign in to follow this  

Ugly Lighting

This topic is 3863 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

Hello, I am currently experiencing some very ugly lighting using Direct3D 9. I am using a D3DTS_WORLD transform to both transform and SCALE a mesh. I capitalize the world scale because that is where my ugly lighting is showing up.

Here is the mesh as it is lit when it is scaled (notice the sort of jagged lighting on the character's back):

Here is the mesh not scaled:

The lighting is much more smooth when the world transform does not scale the mesh.

Here is what I'm doing to set up the world transform:

D3DMATRIX matScale, matTrans;
D3DXMatrixScaling(&matScale, SCALE_FACTOR, SCALE_FACTOR, SCALE_FACTOR);
D3DXMatrixMultiply(&matTrans, &matScale, &m_matOrient);
m_pDevice->SetTransform(D3DTS_WORLD, &matTrans);

Any help as to what my options are to get the lighting to look more uniform when the mesh is scaled would be appreciated.

Peace Out.

Share this post


Link to post
Share on other sites
Advertisement
Your normals are getting scaled along with the model, causing them to no longer be normalized.

You'll need to tell DX to renormalize them (at a small performance cost) using:
device->SetRenderState(D3DRS_NORMALIZENORMALS, true);

Hope this helps.

[EDIT] Too slow. :(

Share this post


Link to post
Share on other sites
Thanks guys, that works, the mesh looks a lot better.


Peace Out.

Share this post


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

  • Advertisement