Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Resolved Parallax Occlusion Mapping node

Discussion in 'Shader Graph' started by MACHIN3, Dec 15, 2019.

  1. MACHIN3

    MACHIN3

    Joined:
    May 25, 2016
    Posts:
    61
    Hi,

    I'm struggling to get the POM node to work, as it should.

    I have a height map wich is 50% grey at the mid point - the "surface level". Darker should offset down, brighter up. I have tried setting the map to linear and sRGB. It doesn't seem to make much of a difference, but I'd assume linear to be the way to go. I can only get the UV offset to work if I increase the Amplitude A LOT, but then the entire thing offsets, including the 50% grey pixels. I've attached the map for reference.

    Here's the simple node setup with a normal map, which I have also attached.
    pom.png
    Do I need the PixelDepthOutput, if so what do I do with it? Am I wrong in using the Amplitude for the Parallax amount?

    Here's the general offset described at the beginning, when increasing the Amplitude a lot.

    I'm using ShaderGraph 7.1.6 in the latest Unity 2019.3.0f3 with HDRP on Ubuntu. The manual, does not include an entry for the node unfortunately.

    I'd really appreciate some input! Thanks!
     

    Attached Files:

    Last edited: Dec 15, 2019
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,604
    You definitely want it to be linear, however height maps for POM are almost always 1.0 is at the surface and 0.0 is offset "down". POM doesn't handle surfaces that extend "up" from the surface well, since at glancing angles the mesh's silhouette isn't changing it's obvious that he effect is fake, so the 0.5 as the mid point that usually comes from displacement doesn't apply.
     
    MACHIN3 likes this.
  3. MACHIN3

    MACHIN3

    Joined:
    May 25, 2016
    Posts:
    61
    Thanks, using a height map that's white at the surface does the trick. I'm aware going "up" is not ideal for parallax, but it works well enough for me in Blender in some cases. Also, I'm pretty sure ASE did parallax using a grey height map, when I last used it 2 or so years ago. Will check that out again.

    Anyway, thanks again, marking this as solved.
     

    Attached Files:

  4. LastAtlas

    LastAtlas

    Joined:
    Jun 9, 2013
    Posts:
    13
    The Pom in HDRP seems to be a "shell" like implementation and does in fact add to the silhouette and even self shadow from what I recall though? Unless it's changed?
     
  5. laurent-h

    laurent-h

    Joined:
    Sep 29, 2016
    Posts:
    77
    Hi, our POM indeed only goes down from the surface.
    As a result, the neutral/reference value for the height map when using POM is white and not grey.

    Silhouette POM would allow to go up but it is still quite expensive so it is not what we implemented.
     
    MACHIN3 likes this.
  6. laurent-h

    laurent-h

    Joined:
    Sep 29, 2016
    Posts:
    77
    You can use depth offset by enabling it on the Master node and then connecting the pixel depth offset from the POM to it.
    This will make all effects relying on depth match the displaced surface like :
    - contact between objects
    - lighting, shadow maps, contact shadows
    - ambient occlusion
     
    MACHIN3 likes this.
unityunity