Forum: Poser - OFFICIAL


Subject: Underwater submarine

Helgard opened this issue on Jun 26, 2010 · 195 posts


bagginsbill posted Fri, 09 July 2010 at 9:58 AM

> Quote - Now what is x? Is supposed to be the distance between the camera and a point of an object. > The problem is from where do we get the value of the distance(x)? > We can get the distance from the z value in the camera space, but where is z = 0 and the zscale factor that depends on the scene? > The distance can be  d = scale.(Zcamera - Zpoint). > Now the z value in the camera space is perspective corrected:  Zcamera = k/(d + Zreal) > where a and d are parameters that depend on the camera setting. > We must know all those parameters and scales, then invert the perspective transformation and only then we can have the real and correct distance to be used in the attenuation function.

Sorry, but everything you said after the underlined sentence is not true. What you describe is the Z-Depth, but that's not the "x" that DepthCue is using. It is using the exact straight line distance from the camera to the object. Nothing about the camera rotation or focal length or perspective mode matters at all. It is doing exactly what it is supposed to do, as you said in the second sentence above.

This is easily proven by a simple test. Set up a tile pattern on the ground. Point the camera down a bit. Set the Depth_Cue start distance (a) to something within your view. Set the Depth_Cue end distance (b) just slightly past that. I used a = 10 feet, and b = 10.1 feet. Thus, the linear decrease in attenuation will start at 10 feet and end at 10.1 feet, forming a pretty sharp gradient that is only 1 inch thick.

If what you say is true, the gradient will appear to be a straight line. If, on the other hand, it is actual radial distance, not Z-depth, the gradient will appear to be an ellipse. If you point the camera straight down at the ground it will be a circle.

Observe the curve (sometimes I am poetic).

So, having established that all the problems you anticipated do not exist, can you figure out how we can calculate the distance from the camera to the object?


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)