I am using a lot of meshes with a very simple StandarMaterial3D around my project. Practically I’m changing only the transparency to alpha, the albedo texture, the normal map texture and the sampling filter to nearest, all the remaining properties are left as they are.
I can reach the same result (at least I don’t notice major differences) using a simple shader that sets up only those parameters.
Which solution is better in terms of performance? Could there be some important differences I am not seeing?
When you use a ShaderMaterial, the core shader remains the same as when you use a BaseMaterial3D. In other words, your ShaderMaterial is setting parameters that are then used in the core shader (which currently can’t be overridden without recompiling the engine).
This means that if your ShaderMaterial isn’t performing complex calculations in its code, performance will be roughly the same as a BaseMaterial3D with a similar feature set enabled (e.g. transparency or normal mapping).
One thing you want to be careful about is enduring that different meshes reuse the same material if they don’t need different parameters. Reducing shader changes helps improve performance, especially when it allows for instancing to occur to avoid additional draw calls. This applies to both BaseMaterial3D and ShaderMaterial.