I am trying to create a shader graph for an magic circle that fades in and stops from fading out. This is what I ave been trying to do, hoping I could get it to clamp from 0.1 to 1 as time goes on in the scene so it stays visible in the scene, but nothing I can think of works. My friend says if we could get data persistance for a boolean it would be possible, does anyone know how to do that or if there is another way to do this. Basically I want it to go from 0.1 to 1 then stay at 1 after reaching it
1 Like
Kind of the whole trick for why GPUs are so fast is because they don’t have to deal with data persistence. Now, it’s possible (when not using shader graph and targeting Direct3D 11 or better), but entirely unnecessary.
First, don’t use Sine Time. That value is going to keep on fading in and out. Instead you’ll want to use Time straight, then have a “start time” (and optionally an “end time”) property that you set on the material from a c# script.
In the most simple form, something like this in node form will get you what you want.
float fade = clamp(Time - StartTime, 0, 1);
From c# set the start time using Time.timeSinceLevelLoad