How to translate an object in Z - but keep its screen X and Y pos?

How would I move a 3d point away / toward the camera - but have its position locked on a particular screen x y coordinate?

1 Like

make Z as a variable, Z increases - the object decreases (moves away) and vice versa.

To preserve visible x,y on screen

See Reference / Processing.org

Or similar perspective or so

i need to slide points along z to create an illusion of a 3d point cloud… this is based on a greyscale image input - where the brighter the pixel, the closer it is to the camera…
once i move the points in z though - the camera fov changes their x y positions as you look head on - i need to fix this - these images show it better

Uploading: Screenshot 2022-07-31 at 15.00.28.jpg…
Uploading: Screenshot 2022-07-31 at 15.00.00.jpg…

………

You might try ortho() to remove perspective

1 Like

that does work - but the results are too strong - everything looks very boxed…
i’m working on a solution using vector math to raycast to the points and work out a z translation based on the camera

1 Like

Create a 3-D line from the camera eye point to your 3-D point. You can move points anywhere along that line and they should project onto the same screen point.

Q = E + (P - E) * t

At t = 0, you’re at the camera. At t = 1, you’re at your original point. Any other value of t moves the new point closer or further away.

2 Likes

yes that looks like it’s working for me! - i had been trying something similar with vector math - but didn’t add the E … was just using (P - E) * t
will try on my project and get back to close the thread if it works - thanks…