Search Unity

Question Position node Object space shadergraph

Discussion in 'Shader Graph' started by DavidDecr, Feb 15, 2021.

  1. DavidDecr

    DavidDecr

    Joined:
    Jan 17, 2019
    Posts:
    5
    I have a shader that uses the object position to determine the emission color.
    I have an 'empty' color specified and a fill color specified, and I lerp between these depending on the object position x value.
    091QCE6Tsk.png

    I assume it should be trivial (see attached screenshots) but I'm getting a weird issue:
    At certain player positions/view angles the color changes to empty color only, in the sense that the lerp uses the emptycolor (e.g; zero value) only.

    Here it is supposed to fill +- half of the object. The first screen is correct, the second screen shows it from a different distance and suddenly is is wrong. Does anybody know what could be causing this? Rounding issues or something like it?
    vFk7WeTBOC.png cD7iusd3HQ.png

    I'm using materialproperty blocks (float input for the vector1 reference in shadergraph) but they only update once in this case and do not change between the different view positions.