Draw Cells
<div class="IPBDescription">What are they, and why is having a lot bad?</div>So i recently jumped into my map and saw my draw cells at around 2000, i've heard that it bad to have more than 1000 so my question is what are they and how do i make them less if its needed?
Comments
Top end rigs could handle 2000, surely way more, limiting the draw call to 1000 for example makes sure lower end computers can also run the map.
I guess at this point you haven't included occlusion geometry and therefore the game is probably rendering the whole map in view, hence the high number of draw calls. I wouldn't worry too much about occlusion geometry until you have a version you want to release, and therefore according to your geometry you implement the occlusion geometry. You will definitely need occlusion geometry for a release though to ensure players have the proper experience.
I can show you how to start off for sure and do a mini tutorial like I did for grissi.
I can show you how to start off for sure and do a mini tutorial like I did for grissi.<!--QuoteEnd--></div><!--QuoteEEnd-->
Yeah that would be great, what did you do for grissi?
A draw-call is when the CPU tells the GPU to draw something. The CPU doesn't send every triangle individually; it puts a bunch of triangles into one big batch and tells the GPU to store that in its memory. Then, whenever necessary it tells the GPU to draw that batch with these textures, these shaders etc.
There are many reasons the map cannot be just one giant batch of triangles. There are a lot of things you don't want to draw because they cannot be seen by the player; they are occluded behind something. This means you have to split the level up into smaller chunks and draw(or not draw) each one individually.
Each "chunk" of the level may contain different materials, different shaders etc. So those chunks get split up into a number of drawcalls as well. Depending on the chosen API and hardware capabilities, some drawcalls can be combined into a single one(e.g. geometry instancing can draw a model many times with various different location, orientations, scale and other properties in one call). Older hardware and older APIs(NS2 uses DX9) may have to draw things in multiple passes where as newer hardware on a newer API can combine it into a single draw call etc.
You have to have fairly detailed knowledge of how NS2 renders things and what clever optimizations are possible to know the relative badness of different things. But just having lots of triangles in an area I do not believe will generate more draw calls just bigger batches. But having poorly occluded maps(being able to see much of the map from some point), lots of texture variety in an area, lots of prop variety in an area and many lights probably all generate lots of drawcalls.
Shadow casting lights have to draw the level from the point of view of the light source. One would think this generates LOTS of draw calls. Any (unique if instanced)prop that casts shadows and is drawn by the light source should add another drawcall.