I'm trying to make objects spawn with colors variating in random ranges. I got the spawning script working but I couldn't find a way or an online guide to access the shader parameters from the script part.

So my material is set up like so: Color1 and Color2 plugged into a VectorMix with a rgb png masking the weight, outputting to the Albedo, now how can I access Color1 and Color2 parameters in the script? And if possible I'd like to keep using the visual shader, can I rename the shader nodes to use them in the script?

I noticed apparently I could change the colors to vectors if that may be easier to change parameters that's ok, but I still wouldn't know how to access them on the spawning script.

I'm new to Godot, I messed around with Unreal in the past and know some programing logic but I'm quite newbie.!

Welcome to the forums @Gabe_Ignus!

You can change shader parameters through GDScript using the set_shader_param function, as explained in this QA answer. I’m not totally sure how you expose properties/uniforms in visual script though, so you may need to search that in a search engine like Google.

Also


This discussion was caught in the moderation queue since you have not confirmed your account yet.

Upon creating your account you should have received an account verification email. The confirmation email may have been incorrectly flagged as spam, so please also check your spam filter. Without confirming your account, future posts may also be caught in the moderation queue. You can resend a confirmation email when you log into your account if you cannot find the first verification email.

(Note: You do not need to repost, the discussion has been moved out and is visible now)

If you need any help, please let us know! You can find ways to contact forum staff on the Contact page. Thanks! :smile:

2 years later