Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback ParallaxOcclusionMappingNode height map input won't accept input from other nodes

Discussion in 'Shader Graph' started by andybak, Sep 1, 2019.

  1. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    Is there a technical reason I can't generate a heightmap procedural within shadergraph itself or is this an oversight?

    The heightmap I want specifically needs access to vertex data (barycentric coordinates that I calculate during mesh generation).so I can't use rendertextures.
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    Parallax Occlusion Mapping works by sampling a height map many times, and many different offsets. It’s raymarching / raytracing the view ray through the height map. So calculating a singular height to pass in isn’t useful for the technique.

    Now alternatively you could use something like Parallax Offset Mapping, which while similarly named is much simpler. Effectively it’s offsetting the UV based on the tangent space view direction, basically raytracing a flat parallel plane that’s some distance from the surface. It doesn’t deal with occlusion like Parallax Occlusion Mapping, and uses the height stored at the surface rather than what you would see if actually looking over a displaced surface, so big differences in height values will be obviously wrong.

    If you’re generating a height map in the shader rather than from a map, you’ll likely need to implement POM yourself.
     
  3. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    Thanks. That makes sense. I've always been a bit hazy about the terminology around this and you've helped clarify things for me.