Jump to content
  • Advertisement
Sign in to follow this  
tariq9112003

Direct3d Lighting Problem

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

Hey guys some problem is up with my lighting.i have a drawn pyramid with red material..light is red ambient.still my pyramid is white(i am a total noob and a poor programmer)i dont know why.somewhere i am wrong..Here's my code

http://pastebin.com/BdR7d6NK

Share this post


Link to post
Share on other sites
Advertisement
Quote:
d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE); // turn off the 3D lighting

You don't have lighting turned on, so no lighting calcs are done. Change this to ..D3DRS_LIGHTING, TRUE..

This article describes what you want to do, I believe.

Share this post


Link to post
Share on other sites
OMG..i cant believe i overlooked that...Thank you so much...I have one more question.If you have noticed..i have commented the specular and diffuse properties of the light.now i can only see one a triangular face at a time
(which is at the direction of the light)..but if dont comment them,the entire pyramid comes(and where the triangular in the lights direction will be brighter than the other faces)sorry for my bad english..if you comile the code bothways you'll get what i mean

Share this post


Link to post
Share on other sites
Quote:
I have one more question.

What's the question? [smile]

The diffuse component of the light is combined with the diffuse component of the material, as modified by the normal to the vertex - creating the look of directional light.

If you want directional lighting, both the light and the material should have diffuse components. Ambient light will be added to all vertices, regardless of the normal.

Does that help?

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!