hi, now that nanite handles all mesh draw calls for us, i’m a little confused about what that leaves for material draw calls.
for example, lets say i have a scene with 200 unique meshes, and all of these 200 unique meshes use the same master material, but each have different parameters changed in their own material instance. (for example, each one uses its own unique texture and tint parameters)
so, 200 meshes, 200 material instances, 1 master material
how many material draw calls would that make?
do material instances count as draw calls with nanite?
Thanks, so multiple material instances of a master material don’t count as 1 draw call, right?
I began thinking about this after seeng the project file of the Valley of the Ancients tech demo. Basically every mesh there had unique textures and each were instances lots of times. Seems doable, as long as kept in check.
As other people said, instancing a material does not have any impact on performance. If you have an instanced and non-instanced material, they would cost the same at run time.
What it sounds like you want to do is write a single material that allows inputs for unique textures for some objects in the scene. For example, if you want to have 30 different stone pillars, but you want them to each be a different color, you could use one material and an id mask and then assign the different colors to each pillar. The same is true of any texture you want to be unique. That way, they’d all be different colors, but only use one material.
Yes, that’s exactly what I want to do. I have a modular kit that all shares the same properties but I want to create unique textures for each piece. I’ll be creating a master material with the texture set as a parameter so that I can swap it for each piece. Though I hoped maybe all instances would count as 1 draw call so that I’d have amazing performance, hahah. Anyways, I’ll figure it out.
If all you’re doing is making small changes, decals may be a better way to go. For example, I want graffiti on a wall. Rather than having each wall with graffiti get a unique material, it’s much better to just make a decal for each piece. This also lets me move it around and adjust it separately from the wall.
If you want a couple of similar changes to be made in different shapes, you can use vertex painting. For example, if you want cracks on your pillars, you could just paint the cracks in wherever you want them. This way, the cracks will have the same properties on each pillar, but will be in different shapes.
The best way to slove material instances customization problem with draw calls is to use custom primitive data. For example if you want to change color of the assets in the scene without new material instances, all you need to do is to make proper material with vector3 node reference to custom data, then one material instance and change color by custom primitive data property. The color data is saved as meta data directly in the object not in the material instance so you don’t need to make 200 material instances for 200 actors.