Direct3d Lighting Problem

Started by
2 comments, last by Buckeye 13 years, 9 months ago
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
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.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

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
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?

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement