Sign in to follow this  
jaafit

Clamp light before modulating w/ albedo?

Recommended Posts

jaafit    116
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
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

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