Jump to content
  • Advertisement
Sign in to follow this  
poigwym

how to use ambient light

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

hellow, everyone !

I'm confused with the shader formula : 

finalColor = ambient + textureColor * diffuseLightColor ;

If there are no light in the scene, the finalColor is equal to ambient , then the object will be in single color.

I want to make the ambient as a darkness value, and the finalColor = ambient * textureColor .

Is the thought right ?

How to modify the code so that the code can adapt to both lighting environment and no-light environment ?

Edited by poigwym

Share this post


Link to post
Share on other sites
Advertisement

You was on the good road, never search complicated :

finalColor = (textureColor * ambientColor) + (textureColor * diffuseLightColor);

In other words, ambient is just a colorized diffuse texture added on the lighting or set as a start if multiple lights are added in the final color.

Edited by Alundra

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!