comfyui_pcg docs

Terrain maps#

From noise to a full set of terrain maps, entirely in COP: no AI and no mesh. It shapes and erodes a massif at 512 x 512 (the erosion solvers are tuned per pixel), upsamples it to 1024 x 1024 with a fine relief on top, then finds rivers and lakes, splits it into five material layers, shades it, and saves height, normal, splat, albedo, a lit image and a contour map.

Load it#

Drag example_workflows/pcg_cop_terrain_maps.json onto the ComfyUI canvas and press Queue. Only comfyui_pcg nodes plus ComfyUI's Save Image are used. Images are saved as pcg/terrain_lit, pcg/terrain_topo, pcg/terrain_albedo, pcg/terrain_height, pcg/terrain_normal and pcg/terrain_splat.

Step by step#

1. Shape

  1. COP Noise (PCG) (simplex, hybrid_terrain fractal, frequency 2.5, 7 octaves, amplitude 0.08) is the base relief; a COP Wrangle (PCG) raises the middle into a massif (@C plus a radial falloff).
  2. COP HeightField Stream Power Erosion (PCG) cuts branching river valleys; COP Strata (PCG) adds rock-layer terraces; COP HeightField Thermal Erosion (PCG) collapses steep slopes into talus (the debris layer).
  3. COP HeightField Hydraulic Erosion (PCG) carves gullies and adds the alluvium to debris. This is the slowest step: about ten-odd seconds on numpy, and it uses the GPU automatically when CUDA is available.

2. Water

  1. COP Flow Accumulation (PCG) computes the catchment area and derives the river network (river) and filled depressions (lake).

3. Materials

  1. COP HeightField Splat Map (PCG) splits the terrain into grass / sediment / rock / snow / water; the five layers sum to 1 everywhere. It also writes splat_rgba, a packed weight map for an engine's terrain layers.

4. Shading

  1. COP Height to Normal (PCG) and COP Height to AO (PCG) add N and ao.
  2. A COP Wrangle (PCG) mixes a colour per material layer into albedo: rock is banded by height (like sedimentary layers), wet grass is darker, and AO darkens the result.
  3. COP Light (PCG) shades it with shadows into lit; COP Visualize (PCG) (height_ramp, terrain ramp, contour interval 0.005, hillshade) draws a contour map into vis.
  4. The right-hand columns are COP Export (PCG) + Save Image pairs: the lit image, the contour map, albedo, height (normalize), normal (signed) and the splat map.

Worth tweaking#

NodeParameterEffect
COP Noiserand_seed, frequency, octavesA different landscape.
Massif WranglecodeSize and height of the central rise.
Stream Poweriterations, erodibilityDepth of the valleys.
Strataspacing, strengthTerrace spacing and how pronounced the steps are.
Splat Maprock_angle, snow_lineWhere rock and snow appear.
Colour WranglecodeThe palette of each material.

See also#