Sign in to follow this  

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

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

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 :\

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 2843 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this