- Home /
Shader Graph Camera Movement Speed
How could you implement camera movement speed in shader graph URP?
I don't want the camera position, I want the speed, so using Position node set to view-space doesn't help.
My goal is that I want the my vertex displacement shader to get faster when the camera moves on. Any idea could help, thanks.
Answer by andrew-lukasik · Apr 06 at 07:37 PM
If you need a single global value then Shader.SetGlobalFloat
can help here.
void Update ()
{
Shader.SetGlobalFloat( "_my_value" , CalculateCameraMovementSpeed() );
}
This should work, but I'm looking for a node or feature built in Shader Graph.
To me SetGlobalFloat seams to be broken, when I set the parameter, Shader Graph seems to set a high value first then in the next frame the value returns to the value I gave it, maybe there is something wrong in my shader, or maybe SetGlobalFloat was not designed to be used in every frame.
Here is where I'm using my global parameter (Wind Accelerator):
Idk, SetGlobalFloat
in Update
work fine on my machine.
Ok I'll investigate more and see what I can find.
Your answer
Follow this Question
Related Questions
How to force the compilation of a shader in Unity? 5 Answers
How to configure shaders? 1 Answer
Water4 with Refraction 0 Answers
fish tank water distortion Shader 0 Answers
Tesselation doesn't seem to work 0 Answers