How to best use textures/materials for custom vehicle parts?

Hi!

I’m making a vehicle editor where you can change the parts after your own preferences. E.g. wheels, hood, bumbers, etc. (Need for speed, GTA, you know it…) So I’ve made all these parts (5 different with 8 version of each, totaling in 40 parts) and was about to uv-map them, when I started to realize there will be problems.

First question: Would it be okay to have one material for every part-type (5 in total), or if that would be bad performance-wise (I have low- to middle-end computers in mind and I really like the new Unity standard shader :slight_smile: ) I wouldn’t mind using just one for all part-types, but this brings up another problem.

Namely; I want every part to have at least three different “paint jobs” to choose from (512x512 each) Would this not have been the case I would just have put the uvs next to each other and made one big 4096 map and put it in the one material.

So without using one material for each part-type, I’m not sure how to be able to change between different textures individually. Would there be any other way to go then using many materials? Suggestions? Cheers!

Your instincts are correct: using one material for all part types is definitely faster. However this comes at the cost of taking a longer time to set up. It’s certainly okay to use 5 different materials if you’re fine with that performance cost. But you should take into account that if you want to speed up your game, that’s not the only optimization you can make. You can add LOD, Occlusion Culling, scripting optimizations, etc. as alternatives. Check the performance charts and see what’s causing the most problems. Or if you’ve exhausted all other options and are prepared to work a bit more, then work on combining the materials.

As for the “paint jobs” it is indeed faster to make one large map then individual materials. It’s a process called Texture Atlasing. Personally, whenever I do optimizations I start with Mesh/LOD/scripting before I worry about materials–the time it takes for the former is significantly less.

Yes, perhaps other optimations will make a bigger performance boost than just focusing solely on the materials. Had for instance totaly forgott about LOD, so thanks for reminding me. More work to do. :slight_smile: I’m however not really in the position yet to try things out for best performance, hence I thought I better ask before doing something stupid and have to redo alot of work. But atlasing I already know about and I also thought that would be the way to go.

I actually after some though decided that it perhaps will be enough if the “paint jobs” will change on all parts simultaneously instead of each one separately, rendering the use of multiple materials unnecessary and keeps the texture amount to a minimum (and if I later notice that more materials will work just fine, not much more extra work will have to be done anyway).

Thanks for your input!