Search Unity

Question Help understanding object vs world normal vectors

Discussion in 'Shader Graph' started by spicymuffin, Apr 9, 2021.

  1. spicymuffin

    spicymuffin

    Joined:
    Jan 18, 2020
    Posts:
    4
    Hi! I am new to shader graphs in unity. I was trying to make this energy shield that pulsates and displaces its faces using the sine of time.
    Here is my "code" that generates the displacement map over time using a gradient texture:
    View attachment 831364
    the gradient:
    View attachment 831367
    The displacement map is basically scrolling "ray":
    View attachment 831370
    Now I thought of overlaying a color over this ray and essentially synchronizing the color and displacement:
    View attachment 831379
    For some reason when the ray is sampled through object-space normal color and displacement desync. When the ray is sampled through view-space normal everything works.

    Here, a youtube video I uploaded demonstrating it:


    What am I doing wrong? Any help is greatly appreciated. Thanks! :D