top of page

How we boost up foliage renderer and mesh generation in Polaris 3 low poly terrain tool - Devlog 1

Updated: Aug 12

A new version of our low poly terrain tool - Polaris - has been started for a while which aim to supercharge runtime & editor performance, enhance workflow & experience, strengthen assets integration and many more.

In this post, we will give you a first glance at what we've achieved so far!


*This post was written during the development of the asset. Things are subject to change.


Upgraded foliage renderers

In this version, tree and grass renderer are completely destroyed and rebuilt. Culling process now done quickly and precisely, which greatly reduce the workload put on your GPU, while efficiently use the spare power on the CPU. It also comes with better LOD-ing so you can build more complex outdoor scene.


Cell-based culling for tree

The terrain space is recursively subdivided into smaller "cells" using quadtree, where each cell contains 4 children cells. We test each cells agains the camera view frustum, if a cell is culled, we can quickly remove all children cells from the visible set.

Applying this method offer a huge gain in culling time.

Cell-based culling
Cell-based culling visualization. Greens are visible, yellows are partially visible.

To squeeze it even more, we shrink those cells so they only encapsulate their content:

Cell-based culling
Cells are shrinked to fit their content

Additional level of detail for tree & grass

Tree & grass now support an additional LOD1, where you can choose to use simpler models and materials that take less time to render on the GPU (fewer vertices, disable expensive visual effects such as wind, translucency, etc.)

Tree LOD visualization
LOD0, LOD1 & billboard for tree. Colored for visualization.

There is also a "LOD Transition Distance" setting to nicely blend between LOD.

Grass with LOD0 and LOD1. Far away instances don't sway, have less vertices and no shadow by default.
Grass with LOD0 and LOD1. Far away instances don't sway, have less vertices and no shadow by default.

Ever wonder why we can reduce the grass vertex count without changing it look? Here's the trick:

  • For LOD0, we use a regular quad mesh:

Grass rendered as a quad, 4 vertices
Grass rendered as a quad, 4 vertices
  • For LOD1, we use a flipped triangle, where the tip goes deep below the "zero line"

Grass rendered as a flipped triangle, 3 vertices, weird to look at but does the trick as seen far away.
Grass rendered as a flipped triangle, 3 vertices, weird to look at but does the trick as seen far away.

Just 1 vertex? That doesn't sound impressive!

Hold on, the saving is far more with other grass shapes, especially when you have millions of instances.


LOD0 vertex count

LOD1 vertex count

Save %

Save per 1M instances

Quad

4

3

25%

250K

Cross

8

5

37.5%

375K

TriCross

12

7

41.7%

417K

Clump

60

45

25%

250K


Benchmarking

We've setup 2 project in Unity 2022.3.9f1, one uses Polaris 2021 and one uses Polaris 3, with a grid of 3x3 terrains with the same settings and compare the result using Unity's analysis tools (Profiler, Frame Debugger, Stats).

System specs:

  • Intel Core i9 9900K, 3.6 GHz, 16 cores

  • NVIDIA GeForce RTX 2060

Note: result may differ depending on machine specs & scene setup. Data below is for reference only.


Time spent on the TreeRenderer.Render() function with 135K trees in the scene:

Time spent on tree Render() function
Time spent on tree Render() function
Stats from the Profiler
Stats from the Profiler

Frame time & stats with 135K trees in the scene:

Polaris 3 scene stats with 135K trees
Polaris 3 scene stats with 135K trees
Polaris 2021 scene stats with 135K trees
Polaris 2021 scene stats with 135K trees

Time spent on the GrassRenderer.Render() function with 1 million instances in the scene:

Time spent on grass Render() function
Time spent on grass Render() function

Frame time & stats with 1 million grass instances in the scene:

Polaris 3 scene stats with 1M grass blades
Polaris 3 scene stats with 1M grass blades
Polaris 2021 scene stats with 1M grass blades
Polaris 2021 scene stats with 1M grass blades

You can see that Polaris 3 has a reduction in batches & vertices count, which is valuable especially on mobile devices.


Frame time & stats in the Demo_00 scene:

Demo_00 scene in Polaris 3
Demo_00 scene in Polaris 3
Demo_00 scene in Polaris 2021
Demo_00 scene in Polaris 2021

It's clear that there is performance gain for existing scenes, just by upgrading the asset.


Improvement to low poly terrain mesh generation

Seams matching

Seams matching between terrain tiles will now write to the terrain datas.

Prior to this, adjacent tiles will calculate the median height value at a point "on the fly". This introduce a problem that seams won't match anymore if you dynamically load/unload tiles.

With this change, it's now easier to do terrain streaming without breaking the scene.


Mesh creation

It just got faster!

After a several optimizations, the Profiler showed an impressive result:

  • Processing time is about 334% faster.

  • Heap allocation is about 248% less.

Actual time may vary depending on your setup. We've a few screenshots of stats on the Discord channel.


Final words

And that's what we've got so far. Good things are coming!

Follow our devlog to learn more about exciting features ahead.

Low poly terrain creation is just a very small part of the making of your game, we hope our effort for Polaris can contribute something to your game's success.

If you're using or plan to use Polaris in your dream project, we're proud to be a part of it.














350 views0 comments

Comments


bottom of page