Hi all -
This is a very basic question and Im sorry if the wording is a bit off, still trying to wrap my head around this - Working on a sidescroller 3D game with some friends and wondering about some technical issues we might run into in the end. Im reusing as many assets as possible to build out these levels, but we also have a ton of new assets that come into play for each section we come across. Trying to be really mindful of using tiling textures and trim sheets where I can, with some unique textures for some props as well. Im just more curious when draw calls become an issue with materials? If I have like 20 materials on screen at once is that going to be an issue? When does it start becoming an issue for something like Switch or mobile?
Replies
Generally speaking: you should avoid any unnecessary draw calls.
Then you test it if it runs smooth enough on your target device
If necessary you reduce them even more by reducing the complexity of your concept.
While Im on this question, should I have multiple pieces (4x4, 8x8) or just use a 4x4 and just use those to create an 8x8?
Anyway: you have a tool in unity which gives you a perfect answer to all of your questions:
Use the frame debugger https://docs.unity3d.com/Manual/FrameDebugger.html
Are draw calls based on materials on screen at the same time? So If I have 10 different meshes all using the same wood tiling material, thats still 1 draw call for the material rather than 10 different draw calls? Since its calling the material into the scene once for those 10 objects. Correct?
And lets say, theoretically speaking, if I have 10 materials being drawn on screen at the same time, does it matter how many materials each mesh has applied to it? So if Im drawing 10 different materials on screen at once, can 1 mesh alone have 10 different materials and its ok? Since it all really depends on whats being drawn on screen overall rather than each individual object?
Sorry if this is confusing me
You can enable instancing on your material to render multiple objects in the same draw calls(only for indentical objects).
You usually don't have to worry about it until you get into the several hundreds of draw calls for mobile/switch, thousands for PC/console. Also, the new SRP batcher is much more efficient if you're using HDRP/URP.