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
Direct3d Lighting Problem
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.
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
(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?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement