I’m wondering if anyone has any ideas on the most effective / manageable method of making a shader that can render a painted wood effect with any color, rather than making a separate texture for every color you want to use. Of course the easiest way would be to use a different material for each color so you can define the color in the shader properties; but that requires a lot of separate materials if you want to have (for instance) a lot of painted wooden statues that each have a different color scheme. Alternate methods would include : 1) using vertex data to store the color, which of course adds a lot of extra memory but allows more detailed “painting” of objects; 2) have the shader read from a texture that contains global data about the color scheme for each individual object in the scene. This reduces the materials to only one, but linking each entry to a specific object gets a bit dicey; 3) probably others that I haven’t thought of.
Has anyone had to deal with this problem?
Just set the color per material… Having a separate material for each object isn’t that much of a sin. The object won’t be batched anyways if it has more than about 300 polygons. It also feels more manageable to me. So unless you have tens of thousands of such objects, I’d go for that.
Well, I will need quite a few colors, which in fact need to be user-definable. It just seems like there should be a feasible method of having truly variable colors handled by the shader.
You can easily change the color attribute of the material from a script. That really seems like the best way to me. Updating vertex data from a script sounds like too much work, so I wouldn’t use it unless you need a separate color for each vertex.