Search Unity

Question UV mapping different on iPhone

Discussion in 'Shader Graph' started by asger60, Oct 7, 2019.

  1. asger60

    asger60

    Joined:
    Mar 27, 2013
    Posts:
    45
    I'm having some difficulties with a shader I've made in Shader Graph
    The shader uses Triplanar mapping to get a texture to stretch correct over a bunch of child objects. It works really well in the editor, but on the iPhone there seems to be some differences on how the uv's are read (or something, I'm pretty confused to what's actually happening)

    Here's how it looks in the editor:


    And here's the same view on the iPhone


    Here's the graph


    And the custom node



    Is this a bug on my side, or is it a general shader graph thing?
     
  2. asger60

    asger60

    Joined:
    Mar 27, 2013
    Posts:
    45
    Anybody?
     
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    What’s that triplanar texture node from? I don’t recognize that one.
     
  4. asger60

    asger60

    Joined:
    Mar 27, 2013
    Posts:
    45
    I just realised that Unity post's an error that might be related
    Code (CSharp):
    1. Shader error in 'hidden/preview/TextureTriplanar_B7D2D48': undeclared identifier 'Unity_Multiply_float' at line 87 (on glcore)
     
  5. asger60

    asger60

    Joined:
    Mar 27, 2013
    Posts:
    45
    Here's the texturetriplaner sub graph
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    That shader graph image is very small so I can't quite make out everything in it, and I have no idea what that TextureTriplanar node is doing as it's not part of the built in shader graph node set. There is a triplanar node, but it's very different. That looks like it might be a sub graph. If there's an issue, it's probably there.
     
  7. asger60

    asger60

    Joined:
    Mar 27, 2013
    Posts:
    45
    You are right, it is a subgraph, I've uploaded it, but for some reason it needs to be approved by a moderator.
    But there's really not a lot going on in there anyway. It's just feeding some uv values to a sample texture.
     
    Last edited: Oct 9, 2019
  8. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Honestly, I can never get subgraphs to work. They always throw errors that are impossible to diagnose, even with the simplest setups.
     
  9. asger60

    asger60

    Joined:
    Mar 27, 2013
    Posts:
    45
    ok, I managed to fix it through trial and error.
    I was setting some shader values like this
    Code (CSharp):
    1. _materialInstance.SetVector("_rotation", r);
    when I changed it to
    Code (CSharp):
    1. block = new MaterialPropertyBlock();
    2. block.SetVector("_rotation", r);
    it started working on the phone.

    I still have no idea to why this would make it work