Forum: Poser - OFFICIAL


Subject: Masking into the Dissplacement Node?

Angelouscuitry opened this issue on Apr 05, 2007 · 30 posts


bagginsbill posted Wed, 27 February 2008 at 11:36 PM

Quote - I think of Black as  -1, Gray as 0, and White as +1; which, somehow get Multiplied by the Displacement Value?

There's the mistake. Don't think of it that way because it isn't that way.

The number that is BLACK is 0, not -1. The number that is gray is .5. The number that is WHITE is 1.

Letting M be the displacement map value, the math node using 2 and 1 calculates 2 * M - 1

For BLACK, M = 0, so 2 * 0 - 1 gives -1 (maximum depression)
For GRAY, M = .5, so 2 * .5 - 1 gives 0 (no change)
For WHITE, M = 1, so 2 * 1 - 1 gives 1 (maximum elevation)

However, the math node using 1 and .5 calculates M - .5

For BLACK, M = 0, so 0 - .5 gives -.5 (maximum depression)
For GRAY, M = .5 so .5 - .5 gives 0 (no change)
For WHITE, M = 1 so 1 - .5 gives .5 (maximum depression)

By using the 2M-1 version, you get a full range of -1 to 1
By using the M-.5 version, you get a half range of -.5 to .5

Whatever range you set up, that gets multiplied by the "Displacement Value" as you've called it.

It all depends on what you want your unit to be about. If you're thinking in terms of deviation (highest peak or lowest valley) then 2M-1 is better. If you're thinking in terms of total distance from peak to valley, then M-.5 is better.

And yes, the general rule to map GRAY to a 0 (no change) is that the Value_1 has to be twice that of Value_2. Any numbers work, its just that you're scaling the result.

Consider the more general formula:  2 * X * M - X

When M = .5 (GRAY) then that is 2 * X * .5 - X, which is X - X, which is 0.

So for any number X, the general formula guarantees that 2 * X * GRAY - X is precisely 0. The actual maximum deviation is just X. If you want a maximum deviation of 7 (up or down) then you'd use 14 * M - 7. If you want a maximum deviation of 26.33 you'd use Value_1 = 52.66 and Value_2 = 26.33.

And the reason you can't preview the results for the depression is simple. The color of 1 is WHITE. The color of 0 is BLACK. What is the color of -1? It is a negative color!!!! We can't see negative colors. But it's there, believe me.

Want to prove it? Connect the output of your subtract node to a new math node, with the function set to Abs (for absolute value). Voila, your -1 becomes 1 and you will see the word BLACK written in WHITE. Hahaha.


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)