Terrain Component for Editor

Hello everyone, I present my implementation of a terrain for the Playcanvas.

  • Ability to save and load height maps.
  • The system uses a smart solution and automatically determines which patches need to be hidden and detailed.
  • Integration with Ammo, using dynamic meshing based on logs.


image

9 Likes

Great! Any plans for texturing?

1 Like

Yes, I’m already developing it.

2 Likes

Looking great so far :+1:

1 Like

Upgrade: Add support texture painter, support 8 channels. Save to special file format or png.


3 Likes

Upgrade:

  1. Added support for rectangular side shapes.
  2. Optimization vram use.

Example: terrain 16x16km.

WebGL2

WebGPU (use baseVertex)

Terrain: 1x1km width scale 8 = 8x8km.


@mvaligursky

3 Likes

@Wagner - feel free to create a PR for the baseVertex on WebGPU.

1 Like

The video shows a map with the original size of gta 5.

Improved algorithm and optimized memory usage for webgl. Map size 16x16 uses 34 MB for indexes and 269 MB for vertices.

1 Like

So is this a plane with a bunch of premade subdivisions or is it a regular plane that is subdividing itself on the fly as needed?

Also were you planning on making this code publicly available or sharing it in any way?

The algorithm is based on geomipmapping.

I have been doing research for a long time which algorithm is better to use quadtree, voxel, geomipmapping.

Optimizing the structure to use video memory, etc.

Some approaches cannot be used due to limitations of WebGL2 or WebGPU.

3 Likes

Might i ask what specs are required to run something like this?

For browser development I use MSI GE 60 laptop,

  • RAM: 8GB, DDR3
  • GPU: nVIDIA Geforce GT650M 3D,
  • CPU: Intel Core i5-3210M (Ivy Bridge)

You should clearly understand that this type of landscape is suitable exclusively for games with a huge open world, like DayZ, WarZ. Because if you use less landscape, it will be cheaper to use a baked model.

Example: Terrain Generation from Heightmap | PlayCanvas Developer Site

1 Like

Is the subdividing based on rounding various values or just by location? What I mean is a scenario where point 1 has a height of 0, point 1.25 has a height of 5, point 1.5 has a height of 30, point 1.75 has a height of 5, and point 2 has a height of 0. Would the height of 30 be used in some calculation or just overwritten with a flat plane from 1 to 2?

The division occurs at the level of x, z coordinates.
Height is of secondary importance.

Read more about geomip mapping / quadtree.

So if there was a really tall spike in between two coordinates it would just get ignored.

Sorry if my questions are annoying, this is just quite new to me. Would it be possible to have overhangs?

Are you talking about the accuracy of the height map? The whole map is made up of LODs, so when you are in a LOD square, you don’t lose any height.

No, overhangs and caves are not supported with this method.

Is there any system like this that would allow for overhangs?