Clamp light before modulating w/ albedo?

Started by
1 comment, last by ViLiO 15 years, 8 months ago
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]
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.



You could also use an exposure function to bring your colour values back into range instead of just clamping/saturating them.

Regards,
ViLiO
Richard 'ViLiO' Thomasv.net | Twitter | YouTube

This topic is closed to new replies.

Advertisement