Terrain Component for Editor

This video showcases a highly efficient terrain rendering system using WebGL2 in the PlayCanvas game engine. The MultiDraw technique is employed, enabling rendering of the entire terrain sized 8196×8196 with 128×128 patches in a single draw call. Grass rendering is also performed with one draw call, providing significant performance benefits.

Visibility optimization for objects uses an occlusion system based on Hierarchical Z-Buffer (HZB) with 4580 occlusion queries for various terrain parts and objects. The HZB debug tool visualizes the buffer levels used for each area, facilitating optimization and analysis.

Heightmap smoothing adaptation is not applied due to the current project’s focus on smaller terrains. This demonstration reflects advanced rendering and occlusion query methods for large scenes with high performance.

1 Like

Very cool.
One solution I used in a large scale game on xbox 360 in the past was cpu occlusion. I had large quads (could be triangles too) in the level, and per frame pick few of the near ones - those are likely to provide some occlusion. Then during the CPU culling, I would also do an occlusion test (all this was on a separate thread of course, harder in JS).

Advantage vs gpu occlusion - you can even completely remove the draw call including material uniform setup and other render state.

This is something that could work well for hilly terrain, you could generate some occluders for the larger hills.

1 Like

The system is designed for maximum efficiency: it uses a fragment buffer to minimize redundant computations and transmits only changes over the network within the editor, significantly reducing bandwidth usage and improving collaborative performance.

The system allows you to define a limit for the used RAM, specify when data should be offloaded to disk, and set the maximum number of changes stored in the stack.

1 Like

The EntityField component is in its final stage of refinement.

The following key features have been implemented so far:

  • LOD system that uses PatchesBounding as a distance selection accelerator.
  • Custom shadows with LOD support.
  • Instances can have varying levels of nesting, with tinting applied to all child render components.
  • Frustum and Occlusion group culling linked to terrain patches.
  • Automatic height updates based on heightmap changes (can be disabled in settings).
  • Editing of position, scale, and rotation for each instance.
2 Likes