For my game, I think it would be very convenient if I make most of my textures monochrome and tint the objects using them in the editor, or make them with placeholder hues that I can replace through a shader.
It would save me the time and work to make multiple versions of textures with different colors, and there would be significantly fewer texture files in total, and fewer textures needed to be loaded at the same time.
But are there any expected performance issues from having almost every surface in an environment being colored like this, instead of having the hue value in the texture file?
Would you be using a shader at all if you didn’t do it this way? Adding a custom shader over the standard material means more customization and, depending on how the shader is written, you have more caching for the final shader data to deal with
If you can also reuse the material then it’s an all around win. I prefer to use white textures for the same reason, usually the albedo color property is enough, and any shaders I make end up with a similar modulate uniform. The only potential downside is more shader compilations but I don’t think it would result in more than an average 3D game.
So far, the only two shaders I have planned are color adjustments for clothing textures, and to smoothly blend between different sky colors and have clouds and stars fade in an out.
That’s very few shaders. But I am wondering how big the impact might get when all the NPCs, buildings, buildings, and maybe also plants in view have to be shader modified at all times.
They will always have a shader, any material including the StandardMaterial3D (even a lack of one) will use a shader. Your tinting shader may likely be more efficient than the standard material shader even.
To apply a shader material to every object in the scene is a common use case for one off EditorScripts
Everything you see on the game screen is drawn by shaders. The engine cannot put a pixel out without going through a shader. So adding a couple of lines of your own shader code wouldn’t make much difference. Use custom shaders as much as possible. They are fast and convenient. Make each shader customizable via uniforms so you can-re use it on many objects and in different situations, to minimize overall compilation time.
That was my plan. Have various outfit textures for characters that use a specific hue to define different areas. And then for each hue, there’s an input field for the object to define what the replacement hue should be.
When saturation and value remain unchanged, this should allow assigning colors in the object properties for each object.
At least in my mind, this sounds very simple and efficient.
I similarly like using “splat map” style shaders, which may be close to what you are trying to achieve. Using RGB/A as values to represent a mix of up to four different colors or textures. The shader is very cheap with just colors, though if using textures it can be more expensive, 4 texture reads + 4 more for normal maps can be a lot, but as always try it out and use the profiler