Sign in to follow this  

Loading a mesh with normals

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

Does LoadMeshFromFileInMemory() loads it with the normal data as well ? I have a .x file with normals data but it doesn't seem to affect the mesh when I use lighting. What needs to be done ? thx.

Share this post


Link to post
Share on other sites
If the .X file contains normals, it will be loaded with normals. Are you sure everything else is correct?

Share this post


Link to post
Share on other sites
I tell you what. The object is rendered with the correct color but when I rotate it around the y axis its doesn't seem to be darker or lighter during the rotation.
the object is places at the origin 0,0,0 and the light (point light) is places at 0,0,-50. I set light data as follows:


m_Light.Type = D3DLIGHT_POINT;
m_Light.Diffuse.a = 1.0f;
m_Light.Diffuse.r = 1.0f;
m_Light.Diffuse.g = 1.0f;
m_Light.Diffuse.b = 1.0f;
m_Light.Ambient = m_Light.Diffuse;
m_Light.Position.x = 0.0f;
m_Light.Position.y = 0.0f;
m_Light.Position.z = -50.0f;
m_Light.Range = 100.0f;
m_Light.Falloff = 1.0f;
m_Light.Attenuation1 = 1.0f;

D3D9DEVICE()->SetLight(0, &m_Light);
D3D9DEVICE()->LightEnable( 0, true);
D3D9DEVICE()->SetRenderState(D3DRS_LIGHTING, true);
D3D9DEVICE()->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(255, 255, 255));




Share this post


Link to post
Share on other sites

This topic is 3911 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this