Using custom variables in visual shader

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Tyler Gregorcyk


I was trying out the new* visuelshader by trying to recreate some of my shaders in it.
Unfortunately, I very quickly ran into a issue that I couldn’t figure out how to solve.
I couldn’t find a way to allow for custom inputs for the shadder from my code.
A lot of my shaders (and most shaders in general) need more information than just the premade inputs allow for.
Is this just not added yet and is planned for a future update and I should just stick to coding my shaders until then? Or am I just missing something.

Thanks for your help.

You can always script shaders the “normal” way.
Parameters can be passed as uniform.
Shading language — Godot Engine (3.0) documentation in English
Edit: Oops, you meant that with “coding”. And I’d say yes to that. Would be nice to see Godot generating godot shader scripts from the visual part though.

I don’t use Visual Shadeds therefore I don’t know how and if uniforms are present there.

wombatstampede | 2019-03-20 13:53

:bust_in_silhouette: Reply From: omggomb

Uniforms are also available to visual shaders. They can be added like any other node. They’re located more towards the bottom of the list of available nodes (might need to scroll the list to see them). They act just like uniforms in shader code.