New: Nature Renderer 2021

Render vast amounts of detailed vegetation on your terrain.

Learn more
This page may not work correctly inside the Unity editor. Open in browser

Overdraw

Overdraw happens when there are multiple models drawn behind each other. The pixels in the areas of each model that overlap with each other will get rendered multiple times, once for each model. This can drastically decrease performance.

In addition to that, transparent areas get rendered as well, even though the final color ends up as transparent and the rendered pixels are discarded.

For example, if you have a simple quad mesh with a grass texture then the red areas below are rendered multiple times:

nature-renderer-performance-overdraw-example-1.jpg

Solution

The best way to solve this is to optimize the mesh to remove the transparent areas. Removing transparent areas can drastically reduce overdraw, while also saving additional performance by not having to render the transparent areas. 

nature-renderer-performance-overdraw-example-optimized.jpg

Adding additional vertices and triangles in order to reduce the transparent area is also ok. The performance hit of the additional triangles is usually smaller than the performance hit of having to render the transparent areas. When adding triangles it is best to simply test the result on your target device to find the best balance between triangle count and transparent area.

Comparison

nature-renderer-performance-overdraw-comparison.jpg

If we render a small test scene with the meshes above to compare the performance then we get the following results:

Quad Mesh 130 fps
Optimized Mesh 200 fps

As you can see, the optimized mesh has much better performance, even though the result looks exactly the same. The further the drawing distance and the denser the grass, the bigger the performance difference is. 

Density

An easy additional optimization is to reduce the density of the grass in the distance. Objects in the distance have a lot of overdraw and are usually not very visible for the player. Therefore, reducing the density has only minimal impact on the visual quality, and can result in a large performance boost.

In Nature Renderer you can reduce the density in the distance in the Instancing section:

nature-renderer-reduce-density-in-distance.jpg

Using these settings in the test scene will give the following result:

nature-renderer-performance-overdraw-density.jpg

Left: Full density, Right: Reduced density in distance

And this produces the following performance results:

Full density 200 fps
Reduced density 280 fps

 

 

Was this article helpful?
7 out of 8 found this helpful