Jump to content

Tiled Terrain Manager


PlayingInCanvas
 Share

Recommended Posts

Hi!

This is a template project, for PlayCanvas, that provides a complete tiled terrain system based on heightmaps and colormaps.

c65015e6acf2345c4e6e92238098553d4669f716

Example build: https://playcanv.as/b/Rhlm9CMz/

Some of its features:
- Terrain generator from tiled heightmaps. The heightmaps and colormaps (splatmaps) have to be provided in a specific named notion. Included there are two sample terrain projects created with WorldMachine.
- Texture generator from tiled colormaps (splatmaps). The user can provide up to 4 textures and the shader mixes them on the terrain based on the channels of the colormap (R,G,B and Alpha).
- All methods included in the generators are run using an async loop, which splits them between the frames. This allows generation, rendering and texturing to be done during run-time creating only momentary pauses.
- A special collision mesh can be created if required with a smaller subdivision count than the rendered model for physics/collisions.
- Normals are fixed and re-calculated on border, during generation to avoid seams between the tiles.
- A visibility manager can be configured to render only a specific number of tiles based on the active camera. The tiles get visible/hidden based on the position of the camera on the terrain. If memory is managed correctly this allows for infinite terrain size/tiles.
- A sample actor is provided in the project (named Aj), with a simple 3rd person controller.
- A random terrain distribution script is provided based on distribution maps which can be painted per tile or per the complete terrain.

PlayCanvas has a batching API in the works which will allow combining multiple meshes to reduce draw calls, this will increase greatly performance especially when objects like flora are distributed on the terrain.

Current version is v1.15 and the project can be found here.

A tutorial on how to use this can be studied here.

a6fd7c798546750a0d354f85411a487f4be0ee94

319b6118c285374495c313426597b17001ce6f83

7b6dac509b37750850d901eec0fcfaffa94179b9

17a09640ad91dc40416740413f3ef4e1d1b0234b

2cefb9d1af3782aad73cdc3ccf941d22cf30f97d

e7286cfe9afe48a47a8eff99aac13dfa34ea8b2a

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...