IsaoShi opened this issue on Apr 04, 2010 · 44 posts
IsaoShi posted Mon, 05 April 2010 at 4:33 AM
Yes, this only works for diffuse. I can't actually see any way to add in other effects linearly, such as specular and sss, that won't over-complicate the shader again.
( The Diffuse node will do its work on white just the same as on a colour map input. It's working out the effect that the scene lighting will have on any given diffuse colour, using white as its reference. A point which receives very little light will give a near-black output from this Diffuse node. A point which receives full white light will give a white output. A point which only receives blue light will give a blue output... etc. )
But before multiplying the colour map by this output, we have to make sure they are both linear, or both non-linear. The colour map is already GC'd, so we GC the Delta before multiplying. Multiplying two gamma-corrected colours is mathematically okay, as bb showed:-
( LinearColour ** n ) * ( Diffuse ** n ) = ( LinearColour * Diffuse ) ** n
In words: multiplying gamma-corrected colour (the colour map) by gamma-corrected diffuse is the same as multiplying linear colour by diffuse, and then gamma correcting the result.
The difficulty comes when we want to add other colours, such as specular.
"If I were a shadow, I know I wouldn't like to be half of
what I should be."
Mr Otsuka, the old black tomcat in Kafka on the Shore (Haruki
Murakami)