screentoworld depth testing

bferns's icon

Is there a way of getting the coordinates of a drawn 3d object at a certain screen pixel?

In the setup I have, I have a large screen-filling plane that can be at any rotation - I'd like to be able to test an x/y screen coordinate and have it return the 3d coordinate where it crosses that plane.

screentoworld seems like it could do something close to what I need, but the results I get from it seem very odd - tiny x/y values and incorrect depth values even given the fact its represented as a proportion of the clipping distance.

Max Patch
Copy patch and select New From Clipboard in Max.

Heres the speculative patch I've been fiddling with: