Archived

This topic is now archived and is closed to further replies.

Directional Lights in DX7...

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

OK, I''m having a few problems with my directional light source under DX7. I want the light source to point in the same direction (at the ground), but what keeps happening is that the light source "follows" the camera movement! Do I need to multiply the direction by my world matrix every time the camera rotates? Should I put this code in before or after my call to BeginScene()? James

Share this post


Link to post
Share on other sites
I had the reverse problem before (the light didn´t want to follow the camera). Have you tried to set the lights direction every render lap? Like this:

D3DLIGHT7 light;
m_pD3DDev->GetLight(0, &light);

light.dvDirection.x = 0;
light.dvDirection.y = -1;
light.dvDirection.z = 0;
m_pD3DDev->SetLight(0, &light);

Gandalf the White

Share this post


Link to post
Share on other sites
OK...figured out my problem.

My problem was one of OVER "optimization". I was attempting to eliminate having to use the view matrix, by simply updating the world matrix. This was very fast, but as I showed, lighting was completely fubar''d. So the moral of the story is, don''t optimize until it works.

Thanks, WitchLord!

Vyvyan

Share this post


Link to post
Share on other sites