bagginsbill opened this issue on Feb 01, 2009 · 207 posts
bagginsbill posted Fri, 17 April 2009 at 10:40 AM
Quote - Some observations:
I'm doing all these gamma-correct conversions to clothing and hair and so forth, and am having some interesting times with the shaders some people have put together. For one thing - and I see this ALL the time - people are setting PoserSurface.Specular_Value and Diffuse_Value to 1. Both to 1.
Doesn't this violate the conservation of energy law?
Yes although your interpretation of it is not correct either. This is really complicated and I don't have time to explain it. I'll summarize, and hopefully that's enough:
It sounds like DV + SV <= 1 is a good rule, but it doesn't work out. The reason is that the specular value is not the whole story - the angles have to work out as well. Further, if the DV is .8, the SV can still be 1 (100%), but it means the specular effect has stolen the opportunity for the diffuse effect. This means that where the specular is strong, the diffuse is suppressed. I do this in my shader like this:
spec = Specular(whatever)
#or
spec=Blinn(whatever)
#then
diff = Diffuse(diffColor, .8 * (1 - spec))
This is not perfectly accurate physics, but it's closer than anything else you could do with Poser, at least until I think of something better. Look at the VSS shader - it is done this way.
Quote -
Regarding node creation (and how to avoid it)... if I do this:gcVal = Add(2.2)
clrBlue = IColor(0, 0, 255) ** gcVal...I get a Colour_Pow node (as well as the Math_Functions(Add) one). If I do:
clrBlue = IColor(0, 0, 255) ** 2.2
...I don't. I now have a linear colour space version of the colour I wanted which I can process. If I want to use it - say - in the Diffuse_Color channel, I would just:
clrBlue = clrBlue ** (1/2.2)
...just before doing:
s = Surface(1, 0, 0 ,0)
s.Diffuse_Color = clrBlue...and the sRGB version of the colour would display.
Am I getting this?
Yes, but perhaps you don't see the correct reason. You stopped using a variable and that isn't the difference. The difference is 2.2 versus Add(2.2). The value 2.2 is a number, while the value Add(2.2) is a Node that generates that number.
gcVal = 2.2
clrBlue = IColor(0, 0, 255) ** gcVal
is the same as:
clrBlue = iColor(0, 0, 255) ** 2.2
but not the same as:
gcVal = Add(2.2)
clrBlue = iColor(0, 0, 255) ** gcVal
Because you're asking me to clarify the rule here, I thought it necessary to make the distinction. In you example, you changed two things at once, and so it's not clear why there is a difference - either or both changes may have caused the delta. The reason is the value of the operand - doesn't matter how you typed it, either as a constant or a Python variable, if it is a number, it's dealt with at compile time. If it is a node, it's dealt with at shading time.
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)