Skip to content

Terrain inspector: run the real generator, with toggles for its parts - #60

Merged
JaimieGR merged 31 commits into
mainfrom
terrain-inspector
Nov 4, 2026
Merged

JaimieGR merged 31 commits into
mainfrom
terrain-inspector

Conversation

@macmv

@macmv macmv commented Oct 23, 2026

Copy link
Copy Markdown
Owner

What

Turns terrain-inspector (the old spline editor) into a 3D view of the real terrain generator, so splines and generator parts can be changed live.

rgen crates (behind the new inspector feature, off for the game and jni)

  • Splines at runtime: rgen_biome::Splines and set_splines() swap the height splines that WorldBiomes::sample_height reads. Without the feature it reads the statics as before.
  • Unknown props: with rgen-world/inspector, encode falls back to a block's default state instead of logging an error and using meta 0, since the inspector has no block registry.
  • rgen_world::Region: generates and decorates a rectangle of chunks on the calling thread. It doesn't use CachedWorld.
  • rgen_biome::toggles: parts of the generator that can be turned off, in the order the generator applies them: 3D density noise, caves (noodle, cheese, and their parts), biome variety, surface layers, biome patches, ores, decorations, and each decoration by name. A turned-off decoration still takes its random numbers, so the others stay in place. Without the feature, the checks compile away.

terrain-inspector

  • Always generates the blocks with the real generator, colored by block kind. The heightmap path is gone.
  • A "Terrain generator" section lists the toggles as an expandable tree.
  • "Color by" can color every block by a spline/noise value (final height, continentalness, erosion, and so on) or by biome.
  • Spline edits recolor right away. The terrain regenerates when the mouse is let go, as does a toggle change.
  • The atlas is sized by view distance, scrolling zooms towards the mouse, and chunks that are all one block take no atlas slot.

Testing

  • cargo test -p terrain-inspector
  • cargo test -p rgen-biome --features inspector (a region through Region, and the toggles changing the output)
  • Ran the app and checked that the shader compiles and tiles generate. I haven't gone through the toggle panel or the layer colors by hand.

macmv added 30 commits October 22, 2026 18:46
Chunks are 32x32x32 and only the ones that cross the surface store blocks.
The shader steps through the chunks, then through the blocks of those that
have any. Hover ray casts walk the same chunks on the CPU. Uploads to the
atlas are capped per frame, and the chunk table is uploaded in one piece.
The nearby surface is found by walking out of or into the block at each
spot, along the normal of the face that was hit. That works for any face,
and does not need one surface per column.
Nothing reads it now that the far pixel filter probes blocks. A new grid
no longer uploads its empty arrays either: the color texture is sized
without data, and only generated columns are ever drawn.
Turning noise into heights and colors was most of the cost of a tile, and it
ran on the UI thread, 24 tiles a frame. The workers do it now, with whatever
splines are current when they start. Tiles made with older splines are made
again on the UI thread. Copying tiles into the grid stops after 6ms a frame.
A pixel that hit the side of a step only averaged with other sides, so it
stayed dark and grainy. The spots are around the hit on the ground again, and
the neighbor's top is found by walking up or down its blocks from the height
of the hit. The walk is as long as the pixel is wide.
Add a biome layer and biome name in the hover readout, chunk border
overlay, and a seed argument that defaults to a random seed.
The atlas is allocated for the view distance instead of at the driver's
maximum, and reallocated (restarting the world) when the slider is let go.
The view distance goes up to 32, and the atlas memory is shown. Scrolling
zooms towards the ground under the mouse. Also cargo fmt.
Remove the heightmap terrain: the layers, flatten-below-sea-level, the
per-column colors and heights, and the real terrain checkbox. The
terrain is the blocks of the game's generator, colored by block.

Add a "Terrain generator" section that lists the generator's toggles in
the order it applies them (3D noise, caves and their parts, biomes,
surface layers, biome patches, ores, decorations and each decoration by
name). Changing one, or a spline, generates everything again once the
mouse is let go.
Bring back the layers (final height, the noise, the splines' outputs, height
impact, river distance, biomes) as a "Color by" option on top of the real
blocks. "Blocks" colors by block kind, and the rest color every block by
the value of its column. Spline edits recolor the loaded columns right
away, and generate the terrain again when the mouse is let go.
@JaimieGR
JaimieGR merged commit 70c369a into main Nov 4, 2026
@JaimieGR
JaimieGR deleted the terrain-inspector branch November 4, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants