0 votes

I added a basic fog of war to my game, texture 512*512 and I would like all objects to be shaded based on that texture. For a single object I have to convert the material from spatial to shader material, copy the shading function which checks whether the object is in fog and does bilinear interpolation, and feed the texture to the shader. I have to do this flow for all the materials. Is there an option to do it programmatically, so I don't have to do it manually for each material? Or at least share/import function in material shaders so if I want to update the function, I don't have to update it in million materials?

asked Aug 27, 2019 in Engine by gmaps (692 points)

Have you looked at running code in the editor? For one of my projects, I had to iterate through a bunch of mesh objects and change the SpaitalMaterial for each object. I used a script with the tool keyword to achieve that.

Yes, I was thinking in that direction, but unless I can call "convert spatial material to shader" in code, it doesn't help me.

Please log in or register to answer this question.

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 How to use this Q&A? before posting your first questions.