C++ DirectX9,how do i enable ambient light?

Started by
1 comment, last by Bru 14 years, 2 months ago
as far as the internet told me,i am not suppoused to enable it,just set it's color using SetRenderState and D3DRS_AMBIENT. the problem is,that the scene doesn't have any ambient light when i turn lightning on. all objects that have no normal,are simply invisible instead of being affected by the ambient light. i tried looking for a render state that would allow me to enable it,but nothing found. this must mean that yet again i've understood something wrong! so if i am right, i am suppoused to be able to have general ambient lightning on everything even if i did not create a single light right? even if i do create,i still have objects being rendered completly black :\
Advertisement
The ambient lighting affects the ambient colour of the D3DMATERIAL9 structure you set with IDirect3DDevice9::SetMaterial. You probably want am Ambient of {1.0, 1.0, 1.0, 1.0}.

EDIT: Assuming the fixed function pipeline of course. If you're using shaders, you'll have to do the ambient light calculation yourself.
oh now i think i get it! yeah this explains :)
thanks a lot steve!
am... maybe i should take this chance to ask another qusetion regarding lightning instead of getting stuck and opening another thread in a few hours...

i enabled specular lightning in my scene,and well... it seems like the specular reflection is as strong as the sun,since pretty much almost the whole scene turned white. it's probably not the material but the light itself right?
i tried playing a bit with some variables of the light that i thought would weaken it,but no effect has been taken unfortunately.

This topic is closed to new replies.

Advertisement