Can I make global variables in a shader without using uniform

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

I have a global variable in my shader, but I am not interested in exposing it in the shader material. Though I do want multiple functions to access it. Is there a way to do that without having to use the uniform keyword? E.g. float temp=2.0;

Why don’t you like to expose variables to the shader material? I don’t think there is any other way.

c-o-d-e | 2018-10-08 17:24

Well you cannot write to uniform shader material variables from code for one. For two, I guess why mix it up with exposed properties.

For now it seems the only way to do it is create them as locals in your main function and pass them around to functions.

wyattb | 2018-10-09 14:24