Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | bananasam |
I have an imported mesh which has multiple surface materials and I would like to create a custom shader for this mesh that uses those surface materials. I essentially want to only override the light()
shader processor function, using whatever defaults the surface material would provide in fragment()
. However I’m having trouble figuring out how to accomplish this.
Here’s the MeshInstance3D: surface material (not sure how to embed. ctrl+g didn’t work for me, sorry).
Then I try to add a shader to the material override property on the GeometryInstance3D node, but I don’t see any way to get the data from the MeshInstance3D.mesh surface materials. Am I missing something (I tried to find answer online and in the shader reference with no luck)?
The only workaround I can think of for this would be to import the mesh resources as external, convert the existing surface materials to shader materials, and then somehow inject my custom shader code into the generated shader. Then I would add that shader as a surface material override on the MeshInstance3D. That sounds like a mess though so I’d rather avoid that (although maybe that could all be done in an import script?).
Any help is greatly appreciated!
update: I found a ShaderGlobalsOverride node, yet there are no docs if anyone has any details on this I’d love to know, otherwise I’ll eventually getting around to diving into the engine source code to figure it out…