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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Help me understand Position node in Fullscreen material mode (shader graph)

Discussion in 'Shaders' started by NymThePseudo, Aug 13, 2023.

  1. NymThePseudo

    NymThePseudo

    Joined:
    Oct 12, 2014
    Posts:
    4
    Unity 2023.1.7f1

    When hooking up a Position node (using Object space) directly to an Unlit shader graph's color output, you get a predictable result.
    upload_2023-8-13_11-51-31.png

    Example using a simple test scene with some random objects (ignore the outline effect):
    upload_2023-8-12_19-34-59.png

    However, when doing the exact same thing in a Fullscreen shader graph, I'm not sure what it is that I'm getting as a result:
    upload_2023-8-12_19-36-7.png

    Could someone tell me what it is I'm getting exactly when using the Position node in a Fullscreen shader graph?

    And of course, the data I'd like to have is the one from the first instance. Is there any way to get the same data in a Fullscreen shader graph?

    EDIT: Seems like this is really only an issue in orthographic mode (when combined with fullscreen shader graph material) ... ?
     
    Last edited: Aug 13, 2023
  2. NymThePseudo

    NymThePseudo

    Joined:
    Oct 12, 2014
    Posts:
    4
    After a few hours of fiddling around, I was able to recreate the world space positions by sampling the camera's depth texture
    upload_2023-8-13_11-33-21.png

    Based off of Cyanilux's post on depth (https://www.cyanilux.com/tutorials/depth).

    Still, in case anyone could enlighten me on what exactly we're getting from the Position node (object space) in a Fullscreen graph (orthographic), that'd be appreciated.
     
    Last edited: Aug 13, 2023