Terrain System

Heightmap-based terrain with chunked LOD, splatmap multi-texturing (up to 4 layers), procedural Perlin noise generation, and physics collision via HeightmapShape.

# TerrainComponent

The TerrainComponent defines all terrain parameters: heightmap source, world dimensions, LOD configuration, and texture layers for splatmap blending.

terrain_component.jl

# Heightmap Sources

Three heightmap source types are available: HEIGHTMAP_IMAGE loads from a grayscale image, HEIGHTMAP_PERLIN generates procedural terrain using FBM noise, and HEIGHTMAP_FLAT creates a flat plane.

heightmap_sources.jl

# Terrain Layers

Up to 4 texture layers can be blended using an RGBA splatmap. Each channel of the splatmap controls the blending weight for one TerrainLayer. Each layer specifies an albedo texture, an optional normal map, and a UV scale for tiling.

terrain_layers.jl

# Physics Collision

HeightmapShape provides physics collision for terrain surfaces. Attach it as a ColliderComponent shape alongside a static RigidBodyComponent so dynamic objects can walk on and collide with the terrain.

heightmap_shape.jl

# Example: Complete Terrain

A full terrain entity with procedural Perlin heightmap, four splatmap texture layers, and physics collision.

terrain_example.jl