-
Notifications
You must be signed in to change notification settings - Fork 398
Terrain
Terrain in LumixEngine uses CDLOD for level of detail. The whole terrian is rendered using several instances of single mesh with 16x16 quads (512 triangles). This mesh is scaled and moved to cover the whole terrain. Only about 500 instances of this mesh are needde to cover 1024x1024 terrain.
Vertices of the mesh are further transformed in the vertex shader to create smooth transitions between LODs.
Several types of textures are used when rendering terrain:
- A heightmap
- Detail diffuse maps
- Detail normal maps
- A satellite map
- A color map
- A splat map
A heightmap must be a 16bit raw texture or RGBA TGA. Only one channel from TGA is used, the rest of them is ignored. Therefore TGA can only represent one of 256 height values and it is not recommended to use TGA.
These are textures applied on terrain close to the camera. This distance can be set in the material. Detail textures are tiles on terrain (i.e. on 256x256 terrain, a detail texture is repeated 256 times in one axis and 256 in the other one). Tiling can be set in the material. Detail textures must be in 3d DDS format, diffuse in one file and normal in another.
Color in detail textures can be multiplied by color from colormap. This texture is stretched to cover the terrain.
This texture replaces detail textures in places too far from camera.
This texture controls which detail texture is located at each quad. This is done internally by the engine when user paints a terrain in the editor.
Note: The texture is RGBA TGBA. The red chennel contains the index of detail texture. The green channel contains weight of the detail texture. The rest is not used.
A special effect is used to improve the visual of terrain. This brings the better visuals however it is not possible to have more one detail texture per quad anymore.
- Create an entity
- Add a terrain componenty to the entity
- Set material of the terrain in the property grid - the material must use terrain shader
- Set the y_scale of the terrain
Following items can be paint on a terrain:
- Height
- Layers
- Color
- Entity
User can select what he wants to paint in the property grid, once a terrain is selected.
Height brush has 3 modes:
- raise - default
- lower - hold SHIFT
- smooth - hold CTRL
This brush paints the detail textures. The splat map is modified as a result of using this brush.
This brush paints the color in the color map.
This brush is meant to place many instances of an entity on a terrain at once (e.g. to place trees). Only entity templates can be paint with this brush.
Painting changes data only in the computer's memory and files are not modified. Click on one of the three buttons "Heightmap", "Splatmap" or "Colormap" to save the corresponding texture.