- Home /
Question by
SunnyChow · Aug 24, 2018 at 02:55 AM ·
shaderdepth-buffer
Get the world position from Depth buffer to main thread
The point is, i want to a screen raycast without setting colliders. I know that it's possible to get the world position inside shader(https://github.com/zezba9000/UnityMathReference/blob/master/Assets/Shaders/DepthBuffToWorldPos/DepthBuffToWorldPos.shader), but i am not sure how to get it back to main thread. I probably can use shader to render it on a texture, but then the value will be limited to 0-255 RGB.
Comment
Best Answer
Answer by SunnyChow · Aug 24, 2018 at 04:58 AM
ok i did it. i used compute shader to get the target pixel data from _CameraDepthTexture, and calculate the wold position