The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes


I created a material using the visual server, but I can't find some SpatialMaterial related operations in the functions, like adding a texture to it.

I tried to use the materialsetparam method like so :
[C#] VisualServer.MaterialSetParam(myMatRID, "albedo_texture", myTexture)
But it doesn't work, yet I did find the property binded to the API.

Any idea on how I could access and modify all the properties of a material created with the VisualServer ?

Also, if I instanciate a material the regular way instead and then request its RID in order to handle it with the VisualServer in several other threads, as long as I don't try to modify the resource or let the garbage collector get rid of the resource's instance before I free all the meshes RID it's attached to : it is going to be perfectly thread-safe or is there things I should be aware of ? Are all the resources treated the same way regarding parallelization in that case ?

Thanks for your answers.
Have a nice day!

Godot version 3.2.3 Mono
in Engine by (168 points)
edited by

1 Answer

0 votes

If you create a SpatialMaterial and convert it to a ShaderMaterial, you can see in the shader code that the uniform is actually called texture_albedo and not albedo_texture, even if the later is the name of the SpatialMaterial's property.

As for the second question, it seems as long as you load and modify the Resource in a single Thread, you are fine.

Hope I'm not too late answering this =P

Have a nice day as well ^^

by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.