Jump to content

Z distance from cam to any point


gaurav

Recommended Posts

so i did some checking and the toNDC vop (cam near clip set to 0) gives the same result as the uv texture from camera space. This isn't suprising. But if I copy a point to the center of what appears to be the lense of the camera and use the distance vop, i get a different result, from slightly to not so slightly.. Why is this?

Edited by 3dbeing
Link to comment
Share on other sites

so i did some checking and the toNDC vop (cam near clip set to 0) gives the same result as the uv texture from camera space. This isn't suprising. But if I copy a point to the center of what appears to be the lense of the camera and use the distance vop, i get a different result, from slightly to not so slightly.. Why is this?

Did you choose the correct center?

Is your object on 0,0,0 ?

Link to comment
Share on other sites

Did you choose the correct center?

Is your object on 0,0,0 ?

i am finding the camera origin point by merging the camera geo into a geo obj, blasting all but the cone, converting the cone to polys and blasting all but the circle part that represents the lense.

Both the camera and the object are off all 3 axis in rotation and translation.

I will post something later. But that distance vop gives a different number than using toNDC vop, while the toNDC vop and the texture from camera give identical results, so I'm curious where the discrepency is.

Link to comment
Share on other sites

So here are all the methods, I've appended to SYmeks file and I can only assume that it is the most accurate. Interestingly enough, or obviously, whichever, the inverse matrix option yields identical results as the camera texture and toNDC. The distance vop using a point at the center of the cam lens is off from SYmeks by .001?

So my question is; why? The inverse matrix is inaccurate? Why is the point method off by .001?

Link to comment
Share on other sites

so i did some checking and the toNDC vop (cam near clip set to 0) gives the same result as the uv texture from camera space. This isn't suprising. But if I copy a point to the center of what appears to be the lense of the camera and use the distance vop, i get a different result, from slightly to not so slightly.. Why is this?

Is the result correct in the center of the image, but gets worse further from the center?

If so, I guess it could be related to the Pz being calculated perpendicular to the image plane, not the distance to camera..

Link to comment
Share on other sites

I had a similar question the other day on the mailing list [1].

The answer was: uvTexture ( and most likely toNDC() ) only give correct results for the center of the projection.

Hence distance(P, camOrigin) gives the proper distance for all points in all cases.

[1] http://bit.ly/zlOjPU

Edited by rdg
Link to comment
Share on other sites

Yes, be careful about whether you need the distance to the camera plane, or the camera point. The camera plane is the same Z value as what you'd get from a z-depth map and the UV projection method will return this value. Using a distance() function against the camera will give you the camera point version.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...