Forum: Poser - OFFICIAL


Subject: Nodes for Dummies

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


bagginsbill posted Mon, 01 June 2009 at 1:24 PM

nr:

I used HSV on purpose, with S = 0, specifically because max(R, G, B) is exactly what I want, but there's no simpler way to do that.

I could use Max(Max(Comp(0, c), Comp(1,c)), Comp(2, c)) instead, but the results would be identical. I'm not sure which is faster.

As for the Color_Pow, you're right it could be a Pow instead, I was being lazy.

Instead of

c * (HSV(c, 1, 0, 1) ** -.4)

we can avoid color arithmetic by letting matmatic know that the HSV tuple is not needed.

c * (HSV(c, 1, 0, 1).asNumber() ** -.4)

So, yes, using a Math_Functions node for the Pow gives the same effect, but not without the HSV.

Regular GC raises each color component independantly, based on the value of that component alone. I'm trying to raise them synchronized, based on the value of whichever component is brightest. That's different. The idea here is to choose a new luminance, based on the brightest luminance component using a normal GC curve. Calculate the increase in luminance - dividing the new luminance by the old luminance. Then scale the original color up by that ratio.

In steps:

L = HSV(c,1, 0, 1).asNumber # get the basis luminance

Letting g stand for the gamma value, we'd use this to calculate a new luminance:

L2 = L ** (1/g)

We want the ratio of new over old to scale the original color up in each component.

c * L2 / L

Let's expand L2 / L:

(L ** (1/g)) / L

Rewrite the denominator as an exponent and multiply instead of divide:

(L ** (1/g)) * (L ** -1)

Combine the exponents:

L ** (1/g - 1)

So the exponent we want is 1/g - 1. For a GC of 2.2, we'd use 1/2.2-1 = -.545454 just as you said. But I was trying to make it less aggressive, so I used g=1.65 instead of 2.2, which gives -.393939, or roughly -.4.

L ** -.4

Plugging it back we get:

c * L2 / L = c * (L ** -.4) = c * (HSV(c, 1, 0, 1).asNumber() ** -.4)

I specifically did not use g = 2.2 because I was trying to avoid the nasty sharp edge at 0. Of course the exponent is adjustable - I just threw -.4 out as an example.

We might use other definitions for L, such as a weighted sum of the three components based on how you convert things to black and white. For example, we could use the black-and-white-TV luminance rule:

L = (Color(.3, .59, .11) * c).asNumber()


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)