Download

Material instance

Hey guys , what is material instancing how can it help me ? can i use it for different objects ?
Another question is when i import speedtree broadleaf tree my editor compiles shaders whenever i do something .how do stop this or should i use another tree?

Material instancing is a way to have multiple different versions of a master material on various different models.

This is helpful to you so that you can keep your overall shader footprint down, and have a consistent look and feel between different models.

Lets say you’re making a stealth game and you’ve laid out your levels, full of assets and things are going well. Each prop’s material only really differs in its application of textures.
You then decide you want to have a night vision mode, and every object gets a night vision texture.

If you’ve used material instancing you can add the night vision material switch into the master material and all your objects that have material instances of that master will also gain the night vision material options. If you are using separate materials for everything you’d have to replicate the night vision stuff into every material in use.

As for speedtreee I’ve not dealt with that system much, though from what I understand a good bit of the speedtree generation and display is done on the GPU as a procedural shader, so if you tweak things about the tree generation parameters it will need to recompile the associated shaders so the trees can update.