Jump to content
  • Advertisement
Sign in to follow this  
jaafit

Clamp light before modulating w/ albedo?

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

Should I clamp my light value (diffuse + ambient) before modulating it with albedo? Same question in HLSL: Is it
output.color0 *= saturate(diffuse + ambient);
or 
output.color0 *= (diffuse + ambient);






I notice that if I don't saturate, the color contrast increases but the color hues are often wrong. For instance, let's say I have a diffuse of 1.0, ambient of 0.25 and two colors on my object, one being grey (0.5,0.5,0.5) and the other being red (1.0,0.1,0.1). If I clamp (diffuse + ambient), the multiplicand becomes 1.0 and the colors stay the same. The end result looks too dark. If I don't clamp (diffuse + ambient), the multiplicand becomes 1.25 and the grey becomes lighter gray while the red becomes pink. The end result is brighter; gray becoming light-gray is good but red becoming pink looks odd. [Edited by - jaafit on August 13, 2008 6:21:12 PM]

Share this post


Link to post
Share on other sites
Advertisement
There is no "right way".. do what looks best to you.

However, you really should saturate the added parts in my opinion, and then brighten up the result..like:

output.color0 *= saturate(diffuse + ambient);
output.color0 = saturate(output.color0*2);

this way you may get better hues but brighter.. I think this is equivalent to the multiply2X fixed function command in D3D.



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!