Search Unity

Question World position in fragment part of graph gives wrong values

Discussion in 'Shader Graph' started by piter00999, Sep 15, 2019.

  1. piter00999

    piter00999

    Joined:
    Jan 5, 2018
    Posts:
    19
    Hello!
    Recently I was trying to make low poly water shader. I wanted the shader to be quite simple. In vertex part of the graph I'm just offsetting every vertex y pos by some amount generated by noise texture. Then in fragment part of graph I wanted to recalculate normals using DDX,DDY functions but I found out that the position I'm getting is unaffected by my vertex offsetting in vertex pass. So here is my question am I doing something wrong or this is some sort of bug? worldPosProblem.png
     
  2. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    You could use what you put in the position slot at the master node and transform it from object to world space.
     
    piter00999 likes this.
  3. ph_

    ph_

    Joined:
    Sep 5, 2013
    Posts:
    232
    It's a bug, the same one that's being talked in here and several other threads https://forum.unity.com/threads/dep...t-in-shader-producing-strange-results.708452/
     
    fffMalzbier likes this.
  4. piter00999

    piter00999

    Joined:
    Jan 5, 2018
    Posts:
    19
    Thank you! Transforming position from object to world worked :D!