In this lesson, you will learn how to isolate and resolve performance bottlenecks in your terrain and vegetation systems by identifying excessive draw calls using engine profiling tools.
Visualizing the Bottleneck
When building dense environments, draw calls often spike due to "overdraw" or an inefficient distribution of Hierarchical Instanced Static Meshes (HISM). To see what the GPU is actually processing, use the console command r.VisualizeOccludedPrimitives 1 to see if your Landscape is rendering assets that should be hidden behind terrain.
To get a clearer picture of your draw call count, open the Stat Unit overlay (stat unit) and compare the Draw time versus GPU time. If your Draw time is significantly higher, you are likely CPU-bound by the number of individual mesh instances being sent to the renderer.
Profiling with the GPU Visualizer
The most powerful tool for this is the GPU Visualizer (Ctrl + Shift + ,). When you trigger this during a frame with dense foliage, look specifically at the BasePass section. You are looking for:
- Excessive Mesh Passes: If your foliage materials have many layers or complex masking, you will see a massive spike in the
BasePass. - HISM Batching: Check if your foliage is properly instanced. If you see thousands of individual draw calls for the same tree, your
HISMclusters may be too small, or they are not being culled efficiently by theCull Distancesettings in yourFoliage Typeassets.
Resolving Draw Call Spikes
If your profiling identifies excessive draw calls, you can mitigate them by adjusting the Instance Settings within your Foliage Type:
- Cluster Size: Increase the
Instance Cluster Min/Max Distanceto group more meshes into a single draw call. - Culling: Set a strict
Cull Distanceto ensure that objects outside of a player's immediate view frustum are not being submitted to the render thread. - Landscape Optimization: Ensure your Landscape material isn't using too many texture samples, as this increases the complexity of the
BasePassfor every landscape chunk rendered.
Key Takeaway: Use the GPU Visualizer to identify if high draw calls originate from poor instancing clusters or inefficient material complexity, then tune your Cull Distances and HISM settings to batch geometry effectively.