I have acquired some bits n pieces of information regarding draw calls.
One thing is still unclear to me.
If you have 20 separate meshes (20 drawcalls) and they all share the same texture… does this mean its only 21 drawcalls. Or will it be 40. 20 for the meshes and 20 for the texture?
The number of draw calls is rather determined by the number of materials you use than the textures. The material is a collection of data (textures, parameters) and shader code that operates on that data. A texture isn’t drawn in a separate draw call of its own, it’s rather the combination of a (sub-) mesh and its materials that issues a draw call.
Assume you have 20 meshes that each uses the same 2 materials. Without optimizations, that will be 2x20=40 draw calls. Now, under certain circumstances the meshes might by batched by the engine, meaning the meshes that use the same material are combined to one (or some few) meshes and then drawn, with a corresponding reduction in draw calls. Or, if this are identical meshes (like the same tree drawn a hundred times), the engine might use hardware instancing, where the meshes are sent just once to the GPU along with an array of their transforms (position, rotation, scaling), which would get your number of draw calls down to 2.
Hello,
And what about instanced please ? (assuming that it is the same instanced mesh and the same instanced material)
My first idea is
x mesh * y material : xy calls
x inst mesh * y material : y calls ?
x mesh * y instanced material : xy calls ?
x instanced mesh * y instanced materials : y calls
And what happens when instanced material is modified on spawn : Does it count as a new material or the same instanced one ?
Thank you. So basically i will have 20 drawcalls?
20 meshes x 1 material = 20?
Is this true for mobile as well? Or does this only apply on higher end systems that can instance materials and geometry?
All objets in the scene are instances of objects in the content manager, regardless of the plataform, to don’t mix up with unreal instance materials, Instance material is a material with modificated variables, soo count like a draw call.
Anatomy of Drawcalls
Draw = paint Calls = task
Drawcalls have the task to paint material in the screen, they need a task for each material
Soo If you have two trees with two material and one rock when one material:
Paint task
task 1 = Paint the first material in tree one
task 2 = Paint the second material in tree one
task 3 = Paint the first material in tree two
Task 4 = Paint the second material in tree two
task 5 = Paint the Rock first material
Total tasks 5 = Draw calls 5
Of course as say Rastar the engines can have tricks to combine meshes and reduce draw calls. But i don’t know if work in unreal and in some cases the consume of gpu is worst that the drawcalls. This happen to us in the last game for psvita that i work.
I have another question. Regarding lightmaps.
If you have a mesh containing 12 uv sets used for lightmaps. Do those 12 count towards drawcalls or are they just used to store the lightmap information as 1 draw call?
Well, you can only use a single UV channel for lightmaps. And that only effects memory consumption, not draw calls.
With instancing and draw calls it’s a balance between them, you can instance meshes to reduce how much memory you use, but that increases draw calls. Batching can combine all of the instanced meshes, but that increases memory. Sometimes it doesn’t matter, like for grass where say 30,000 polygons isn’t a problem to batch, it’s not a huge impact on memory. But for other things it can matter.
There’s nothing special to reduce draw calls, you simply have to manage what you’re doing efficiently. Some systems combine meshes (batching/instancing) so that it doesn’t multiply the draw calls for each object (like Foliage systems). But then that increases memory count. For something like a cube world, cubes are very simple so it’s better to take the memory hit and combine them because total polygon count won’t be too much.
Unreal can allow you to do this on your own with Blueprints by using Instanced Static Meshes, which will combine the objects to reduce draw calls.
Typing “stat scenerendering” in the console will give a quick high-level overview of the current scene rendering stats. “Mesh draw calls” is probably what you’re looking for. Some other commonly used ones are “stat unit” (time by pipeline step), “stat fps” (overall framerate), “stat rhi” (render thread info), etc…
You can also create stat captures to analyze later using “stat startfile” and “stat stopfile”, which can be opened from the Profiler tab in the Session Frontend.
Sorry for ressurrecting this thread, but I reall got this question right now
I have a few large models of building, and I was thinking about this, because I don’t think that an 1024 x 1024 size for almost the entire building is ok, because there would be quality hurdes due to the lack of good resolution for the numerous uv shells.
I was thinking of doing overlap, but i’ve heard that it causes issues on normal maps and lightmaps, but adding more materiais will affect performance due to the draw calls.
But i was wondering if it really does affect performance in a significant manner, or its more about a matter of loading the materiais (like borderlands) rather than a FPS hamper in-game (lets say you have a large city), I reckon that even old games such as Half Life used many materiais for the models.
I looked on quite fast because I have to go to bed right now, but juding from at least one UDK example, it seems like that objects that are detachable were given an separate object state and material, but what I was also wondering was about the heights, instead of an full single object, would the best way be each floor to be treated like an object sharing the same material (thus expanding the UV size)?
It really just depends on your project and workflow. Having lots of little modular parts lets you reuse them and put them together in different ways, but adds to your draw calls. But you can use HLOD to combine all those separate parts into one at a distance. Having modular parts also sometimes makes everything into rigid 90 degree grids, but that can be avoided and worked around.