Forum: Poser - OFFICIAL


Subject: Turning a 3D object into a displacement map. Extreme "duuuh" content.

SamTherapy opened this issue on Feb 02, 2011 · 19 posts


bagginsbill posted Thu, 03 February 2011 at 11:03 PM

Quote - at z=0 (if the obj is bisected by the (x,y)=(0,0) plane), depthcuecolor=0 and at z=farthest distance of obj in front of (x,y)=(0,0) plane, depthcuecolor=1?

Correct! If you set the depth_cue start and end both to 0, then it always draws whatever is the depthcue color. Then you modulate that color to be anything you want - and you get a render of that.

In this case, a P node, z-coordinate only. There are several ways to do this, but the simplest is to set the P node x and y parameters to 0, and the Z value to .3. Then you plug the P node into a math node. The math node will be receiving the Z coordinate expressed in inches.

From there (the math node) you can offset the Z value so it doesn't have to start at 0 - it can start at -5 or 20 or whatever. This would be done by subtracting the Z coordinate of the farthest point. Let's call that F. F could be 0, or -1, or -50, or 20, or 100. Doesn't matter.

P.Z - F

So it will be black (0) when P.Z = F.

Next we need to scale this so it goes to white (1) when the value is at the closest z value to the camera. Let's call this value C.

(P.Z - F) / (C - F)

In other words, first subtract the farthest point, then divide by the distance between closest and farthest.

Plug that into DepthCue_Color, which should be set to white in the color chip.

If you want closest = black, instead of white, then you want the complement of that, i.e. 1 - that, which is:

1 - (P.Z - F) / (C - F)

= (C - F - P.Z + F) / (C - F)

= (C - P.Z) / (C - F)

 


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)