Hello i was wondering how i would be able to achieve an certain effect. I have a float and as soon as i turn on the float to be 1 i want it to slowly increase inside the shader graph to achieve some sort of smooth transition. I played with the "SineTime" component but this one is fading out after an certain amount of time. I need the value to stay 1 after it has reached this value. Any ideas? Thanks, Markus
Your explanation seems a bit unclear to me. You want some smooth transition inside Shader Graph material to begin when you set a value to 1? I think you should try to do it the normal way if you want a smooth transition: Expose a float value in your shader graph and then use C# code to set the parameter smoothly over time using Lerp or some other interpolation, so that you get a gradual change in the material. Then you can control your value to be anything you want.
Sine time is literally the sine of the current time value. And the time is the script side Time.timeSinceLevelLoad. If you want a value to increase slowly over time, you need to do it by setting a start time and duration (or end time) and calculate that from the current time. So, for example, you could have a StartTime and Duration property and do something like this: float value = saturate((Time - StartTime) / Duration); If you want it to make the transition a little smoother with a ease in and out from 0.0 to 1.0, you can put that through a smooth step node.
Ciro (one of Unity's evangalists) posted something like this on Twitter a while back. https://twitter.com/cirocontns/status/1113126274795536385?lang=en
Those examples don’t have a duration, so they’re always 1 second long. Also the code is using Time.time which only works if you never load a new scene.
What they DO have is an excellent example of how to achieve something like you were describing in Shader Graph. It has the desired effect of starting from 0 at a given time, and rising to 1 where it will stay. It's really not hard to add a duration on top of that using a multiply node. But pardon me, next time I'll only post if I have something the OP can copy and paste in to do exactly what he needs without reading or learning anything. Didn't realise I'd stumbled into Stack Overflow.
It’s a good example, not discounting that. Just pointing out the limitations, and a correction. I posted example HLSL code in the Shader Graph forum, so I’m hardly innocent here.