Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Screen-space to world-space in compute shader.

Discussion in 'Shaders' started by evan-ciao, Mar 31, 2023.

  1. evan-ciao

    evan-ciao

    Joined:
    Dec 31, 2021
    Posts:
    9
    Hi. I'm currently facing issues with the transformation of screen space coordinates to world space coordinates in a compute shader. Briefly said, I'm analyzing the depth texture of an orthographic camera inside a compute shader, finding some special pixels based on calculations, and sending the world space positions of such pixels back to the cpu by an append buffer. I have tried multiplying the screen space coordinates by the projection matrix of the camera ( among other matrixes...) with no luck. All the info I currently have about a pixel is its X,Y coordinate and the distance in world units from the camera. Could you illustrate me the right way to convert these coordinates? Thanks. :)