Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

terrainStandard (material)

Built-in default material for the terrain system. Uses the ~terrainSystem.shaders.terrainBlend shader, which renders a four-layer surface blended by altitude and slope, with a procedurally-detailed cliff override for steep faces.

Layers

SlotSource fieldDefaultRole
0 (valley)colors.base_colorgreenLow ground, grass, valley floor.
1 (mid)colors.layer1_colortanMid-band: dry grass / scrub between grass and rock.
2 (high)colors.attenuation_colorgreyHigh band: rock, exposed cliff face.
3 (peak)reflectance (engine default ≈ white)whitePeaks: snow, ice.

Tunables (re-purposed StandardMaterial slots)

Material fieldShader role
parallax_depth_scalelayer1_height — Y where layer 1 mid-band peaks.
max_parallax_layer_countlayer2_height — Y where layer 2 rock takes over.
lightmap_exposurelayer3_height — Y where layer 3 snow takes over.
normal_scaleblend_width — width of each altitude transition.
clearcoatslope_start — cos-θ where cliff blend begins.
clearcoat_roughnessslope_end — cos-θ where cliff fully overrides.
anisotropy_strengthdetail_scale — boundary-breakup noise frequency.
anisotropy_rotation(detail_amp, macro_scale) — boundary amp + macro tiling.

Authors who want different colours / heights just override the respective floats. / colors. blocks in their own material.

Customizing per terrain

Material.Create("alpine_meadow", "~terrainSystem.shaders.terrainBlend", {
    base_color  = { 0.18, 0.45, 0.22, 1 },  -- meadow green
    emissive    = { 0.35, 0.42, 0.30, 1 },  -- scrub
    attenuation_color = { 0.55, 0.55, 0.55, 1 },  -- granite
    parallax_depth_scale = 12,    -- layer1 (scrub) peak
    max_parallax_layer_count = 24,-- layer2 (rock) onset
    lightmap_exposure = 38,       -- snow onset
    clearcoat = 0.7, clearcoat_roughness = 0.3,
})

Caveats

  • This iteration paints solid colours per layer. Texture sampling per layer is a planned extension — swap the mix(albedo, layerN_color, wN) in the shader for a tiled textureSample(layerN_texture, ...) and add the texture slots to the material schema. Tracking issue: filed alongside the terrain system PR.
  • Author-controlled splatmap (an RGBA texture that paints which layer is at each pixel) is similarly planned. The current altitude/slope blend is procedurally driven only.