Forum: Poser - OFFICIAL


Subject: Nodes for Dummies

RobynsVeil opened this issue on Jan 24, 2009 · 490 posts


bagginsbill posted Fri, 27 February 2009 at 12:26 AM

Are you building PR1 or PR2? (You said VR1 here) I thought you liked the PR2 shader?

The way you're going about it obscures everything. Even I can't tell what that says. There's too many steps, so it doesn't flow.

I never do this:

clrPow = Color_Pow(1,1)
  clrAdd = Color_Add(1,1)
  mthDiv = Div(1,1)
  clrPow.Value_1 = clrAdd
  clrPow.Value_2 = mthDiv

You're building up a Pow node, plugging in an Add and a Div, and none of them connect to anything yet. This is impossible to follow. You are indeed reproducing the nodes, but nowhere is the idea being expressed.

Here's the idea.

I'm going to calculate a color doing a bunch of stuff. At the end, I need to gamma correct it. I also need to anti-gamma correct my incoming color map. I'm going to put my gamma factor in a node because it's going to be used in several places. I want to be able to edit it in just one place in the material room.

So first I make a node to hold the gamma value.

gamma = Add(2.2).labelled("Gamma")

Now my incoming texture needs to be anti-gamma corrected. This means that I need to undo the gamma correction of the incoming image, so that it becomes linear.

So I need a place to hold my image:

colorMap = ImageMap().labelled("Color Map")

Now I do the anti-gamma, which is simply to raise the colorMap to the power gamma. In Python, just as we use * to mean multiply, we use ** to mean Power.

linearColorMap = colorMap ** gamma

Now I want to run that into a Diffuse node. But I also want to decrease the diffuse amount in proportion to how much my specular is firing. So first I build my specular.

spec = Blinn(1, .4, .4, .4)

diff = Diffuse(linearColorMap, .7 * (1 - spec))

Now I want to combine the diffuse and the specular, gamma correct the result, and run that into Alternate_Diffuse.

s.Alternate_Diffuse = (diff + spec) ** (1 / gamma)

That's all it takes to produce a basic gamma-correcting shader that obeys the law of conservation of energy.

However, the shader you're looking at (PR1, PR2, or PR3 - whichever) has many more things in it than that, which makes it considerably more complicated. You're biting off the most complicated part, the SSS, with no awareness of what it's trying to do or how, and just assembling the nodes that do it. Worse, you're assembling them in the most obscure way.

I never, ever do this:

div = Div(1, 1)
x = # some calculation
y = # some calculation
div.Value_1 = x
div.Value_2 = y

See how the creation of the div is separated from its actual use? That's confusing. At the time you create it, it's not at all clear what it's going to be for. And you have to read a lot of code to figure out that in the end, x / y is calculated.

Whereas, when I say x / y in the code, that's pretty obvious that it is x / y.


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)