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. Dismiss Notice

Question Object Space Triplanar

Discussion in 'Shader Graph' started by jjejj87, Mar 22, 2021.

  1. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,104
    So...I got to this and got Diffuse, and Mask map working. But no matter what I do, I can't seem to get the normal to work properly. Can someone kindly advise what I am doing wrong?
    triplanar.jpg
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,208
    You're not doing anything wrong. Unity's included Triplanar node when set to Type Normal only works when using world space. It's totally broken if using object space and the object is rotated.

    I posted a subgraph that implements the built in triplanar node in all ways, except that it assumes you're using object space inputs. (A zip file with the graph is attached to the post in this link.)
    https://forum.unity.com/threads/sha...pace-normal-mapping-help.546322/#post-5417379



    With Shader Graph 10+ you could take that sub graph and remove the last matrix multiply and normalize nodes and then change the Shader Graph's Master Stack to expect object space normals instead of tangent space normals and make your shader a bit cheaper, not to mention have fewer interpolation artifacts.

    Unity's built in triplanar node really needs some extra options to define in what space it should assume the input values are in, and what space it should be outputting. As there's no reason to always output tangent space normals now that the Master Stack can accept object or world space normals.
     
    jeromeWork, Ruchir and lilacsky824 like this.
  3. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,104
    Thanks for the detailed reply! You are a true hero mate.
     
  4. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    1,996
    Hi, do we still need to create our own shader for triplanar object spaced mapping, or something moved forward ?
    I'm asking since this sounds like such an obvious basic feature that should be build in already.
     
    Svartskogen, oceanembers and AliBuck like this.