Skip to content

Update: Project version 0.1.0 release - #5

Merged
Trilleo merged 119 commits into
TriBinary:mainfrom
Trilleo:main
Dec 1, 2026
Merged

Trilleo merged 119 commits into
TriBinary:mainfrom
Trilleo:main

Conversation

@Trilleo

@Trilleo Trilleo commented Dec 1, 2026

Copy link
Copy Markdown
Member

No description provided.

Add `aktis_assets::install`: find Minecraft installations in the
default launcher folders per OS (vanilla and Prism Launcher) or in a
folder the user picks. Each result is a `GameInstance` with its
version, game folder and client jar path, plus listings of its saves
and resource packs. Prism instances honour `InstanceDir`, read the
name from instance.cfg and the version from mmc-pack.json; broken
instances are skipped with a log message.

Add an opt-in real-install test (AKTIS_TEST_LAUNCHER_DIR) and add the
M1 task checklist to the roadmap.

Docs: assets (status, design, install discovery), world (26.x
dimension folders), testing, dependencies, crates, overview,
glossary, roadmap, CHANGELOG.
AssetStack now opens its sources (client jar, zipped or folder
resource packs) and reads files from the highest-priority source
that has them. Adds read/read_asset/contains/list/namespaces, and
reads pack.mcmeta descriptions (text components flattened).

Zip entry names are indexed at open time; decompression takes a
per-zip lock so the stack is Send + Sync. Asset paths are validated
so lookups can never escape a folder pack, and folder paths are
joined per component for Windows.

BREAKING CHANGE: AssetStack::push opens the source and returns a
Result.

Docs: assets (status, design, asset stack section, open questions),
testing, glossary, roadmap, CHANGELOG.
Add BlockStateDef: parses `variants` (property-subset keys, first
match in file order) and `multipart` (OR/AND/alternative/negated
conditions) blockstate files and returns the model references
(rotation, uvlock, weight) for a block state at a position.

Weighted lists are picked with Aktis' own deterministic position
hash; it does not reproduce the game's pick, since vanilla code is
not ported. Invalid rotations, zero weights and empty lists are
rejected with the new AssetError::InvalidAsset.

Adds an opt-in test that parses every blockstate in a real jar
(1288 files in 26.3, all pass).

Docs: assets (status, blockstates section, open question),
testing, glossary, roadmap, CHANGELOG.
Add ModelBaker: flattens model parent chains (child-first textures,
nearest elements and ambientocclusion, cycle guard), follows #texture
variables and bakes elements into BakedQuads with block-space
positions, 0..1 UVs, tint index, rotated cullface, normal, shading
direction and light emission. Results are cached per model and
rotation.

Covers default face UVs, face rotation, element rotation (any angle,
rescale, 26.x multi-axis form), blockstate x/y rotation and uvlock,
plus the 26.x additions: texture objects with force_translucent,
shade_direction_override and light_emission.

aktis-assets now uses glam (existing workspace dependency).
Opt-in test bakes all 10290 model refs of the 26.3 jar.

Docs: assets (status, block models section, open questions),
dependencies, crates, testing, glossary, roadmap, CHANGELOG.
A model face's `texture` always names a texture variable; the leading
`#` is optional. Vanilla heavy_core writes "all", which was parsed as
the texture location minecraft:all and failed to load. Variable
values keep their meaning (`#other` or a location).

Docs: assets (block models), CHANGELOG (Fixed).
Add TextureArray: loads the textures referenced by baked models
(first animation frame from .png.mcmeta), scales them nearest-
neighbour to one power-of-two layer size, builds a full mip chain in
linear light with alpha-weighted colour, and classifies each layer as
opaque, cutout or translucent. Layer 0 is a self-made missing-texture
checker used for unreadable textures.

The opt-in real-jar test now builds the full array: 1249 textures,
1250 layers of 64 px, 26 MiB. This exceeds wgpu's default 256-layer
limit, noted for the GPU upload task.

Docs: assets (status, textures section, open questions),
render-core (layer limit), testing, glossary, roadmap, CHANGELOG.
World::open now reads level.dat (name, data version, game version,
26.x `spawn` compound or legacy SpawnX/Y/Z). World::load reads the
region files of a dimension (26.x `dimensions/minecraft/<dim>/region`
first, older layouts as fallback) and decodes section palettes in all
four forms (string, `{"": id}` in mixed lists, 26.x `{id,
properties}`, legacy `{Name, Properties}`) into a BlockGrid: interned
u16 block-state ids per section, uniform sections collapsed, clipped
to the selection.

Only fully generated chunks are loaded; missing, partial and corrupt
chunks are counted in LoadStats and logged. Adds Selection helpers
and BlockState constructors/Display.

Adds flate2 (gzip for level.dat; already in the tree via fastanvil).
Opt-in test loads 81 chunks around spawn of a real 26.3 save.

Docs: world (status, loading, file format, block grid), dependencies,
crates, testing, glossary, roadmap, CHANGELOG.
Add aktis_render::mesh. MeshAssets::build loads blockstates and bakes
every weighted model choice for each block state, builds the texture
array, and precomputes which sides are full/opaque and the state's
tint. mesh_world meshes sections in parallel (rayon) into opaque,
cutout and translucent vertex/index data, with positions relative to
the selection origin.

Faces are culled against full opaque neighbours and against identical
neighbours with full faces (glass next to glass). Tints use fixed
plains colours for M1. Vertices carry shading normal, shade flag,
tint and emitted light.

Supporting changes: BlockStateDef::select / Selected and
WeightedModels::pick_index in aktis-assets (position-independent
weighted lists, same picks as models()), BlockGrid::set in
aktis-world. aktis-render now depends on aktis-assets, glam and rayon
(existing workspace dependencies).

Opt-in test meshes a real 26.3 world: radius 8 = 2.16M quads in 37 ms
(release), 88 % of them cave surfaces below y=64.

Docs: render-core (meshing section, measurements, open questions),
crates, overview, dependencies, assets, world, testing, glossary,
roadmap, CHANGELOG.
Add PreviewRenderer, a third RenderEngine: uploads a WorldMesh and the
block texture array, then renders opaque, cutout (alpha-tested) and
translucent (blended) passes into an Rgba8UnormSrgb target with
reverse-Z infinite-far depth, per-face shading plus sun diffuse,
emission and a sky colour (shaders/preview.wgsl). Upload checks the
device's texture-array limits and returns RenderError::DeviceLimit.

Shrink mesh vertices to 16 bytes (section-local fixed-point position,
u16 layer, unorm16 UV, tint + packed direction/shade/light) and drop
index data in favour of one shared quad index buffer drawn with
base_vertex; each section is one draw with an instance offset.
Radius 8 of a real 26.3 world: 132 MiB on the GPU (was 316 MiB),
~3 ms per 1280x720 frame on Metal.

RenderEngine gains output() -> EngineOutput (view, size, generation).
Adds RGBA8 readback, Camera::forward/right and Sun::direction with
documented conventions. ADR 0006 records the design.

GPU test renders a cube and checks exact pixel colours (skips without
an adapter); opt-in test renders a real world and can save a PNG.

Docs: ADR 0006, render-core, scene, overview, crates, dependencies,
testing, glossary, roadmap, CHANGELOG.
Load a world from the command line (aktis --jar <client.jar> --world
<save> [--radius N] [--center x,z]) on a background thread: read the
selection, build block assets and mesh, then upload to the preview
engine. The central panel renders the preview at its physical pixel
size, only when the scene, size or world changes, and shows the output
texture through egui-wgpu native texture registration.

Fly camera: W/S along the view, A/D sideways, Space/Shift up/down,
Ctrl to sprint, right-drag to look, scroll for speed. Frame-rate and
speed overlay, loading progress, world stats, camera and sun controls;
path tracer and shader-pack engines shown greyed out.

eframe's wgpu device now requests the adapter's full limits so block
texture arrays above 256 layers fit. The default camera pitch is +20
(slightly down) instead of -20.

Docs: app, render-core, scene, crates, dependencies, getting-started,
testing, roadmap, CHANGELOG.
Add a left Project panel: pick a Minecraft instance (auto-discovered,
or a folder added through a native rfd dialog) and one of its saves,
set the selection centre (spawn, custom X/Z or the camera column),
chunk radius and Y range, then Load. Loading runs on a worker thread
with progress in the viewport and can be cancelled.

Choices, the scene (camera, sun) and fly speed are saved in eframe
storage; on start without arguments the last world loaded from the
panel reopens with its camera. Command-line --jar/--world still load
directly for that run and aren't remembered.

Default selection stays the full 1.18+ height (-64..319).

Docs: app, render-core, crates, dependencies, getting-started,
testing, roadmap, CHANGELOG.
Fluid block models have no geometry, so the mesher now builds a box
per fluid block (mesh/fluid.rs): water and lava, waterlogged states
and always-underwater plants. The surface height follows `level`
(8/9 for sources, (8 - level)/9 when flowing, full under the same
fluid). Faces next to the same fluid or a full opaque face are
culled. Water uses water_still in the translucent pass with the water
tint; lava uses lava_still, opaque, light 15. Fluid textures are added
to the texture array only when present.

Docs pass: fluids in render-core, data flow in overview, stale open
questions in assets, glossary, a reusable manual smoke-test checklist
in testing, roadmap (Task 11 waits on the Windows smoke test).
Add simple water and lava (Task 11): fluid blocks, waterlogged states
and always-underwater plants get a box with a level-based surface;
water is translucent and tinted, lava opaque and glowing.

Fix three bugs found while checking it:
- 26.x saves store default states as a bare block name. Those states
  matched no blockstate variant and were invisible (grass blocks, logs,
  deepslate, tall plants...). BlockStateDef::fill_defaults adds missing
  properties (per-block overrides, smallest number, false, then a
  preference list) and the mesher selects with the result.
- The preview's strict reverse-Z depth test hid coplanar faces drawn
  later, such as the grass block's side overlay; use GreaterEqual.
- The app viewport sampled the sRGB output through an sRGB view, but
  egui expects gamma-encoded textures, so colours were decoded twice.
  EngineOutput::view is now an Rgba8Unorm view of the output.

Radius 8 of the test world drops from 2.26 M to 1.38 M quads (85 MiB)
because deepslate no longer exposes the faces around it.

Docs: assets (default properties), render-core, overview, glossary,
testing (fluid, defaults and overlay tests; manual smoke test),
roadmap, CHANGELOG.
Hide and grab the cursor while right-dragging (Locked on macOS,
Confined elsewhere since winit can't lock on Windows), turn the camera
by raw mouse motion, and put the cursor back where the drag started on
release, so long drags no longer leave it at the window edge.

Docs: app (mouse look), testing (smoke-test check 5), CHANGELOG.
Mark M1 and its last task as done in the roadmap. Note the fixes made
while closing it and that the Windows (DX12) smoke test still needs a
recorded run before the first release.
Add the M2 checklist (tasks 0-9, each with what it delivers and how
it is verified), the maintainer's design decisions and what is out of
scope. M2 status is now In progress.
- CHANGELOG: meshing no longer produces index data.
- crates.md: aktis-assets status lists the texture array.
- path-tracer.md and render-core.md disagreed on the accumulation
  format (Rgba32Float vs Rgba16Float). Both now describe the M2
  decision: linear f32 storage buffer, exposure + ACES fit, 8-bit
  sRGB (to be built in M2 task 4, ADR 0008).
RenderEngine gains reset() and progress() (Progress) so progressive
engines can accumulate samples; one-shot engines keep the defaults.
aktis_render::camera::CameraRig provides view/projection matrices and
primary rays from one camera; the preview now uses it, and a test
checks that primary rays project back onto their pixels.

The app viewport now schedules frames: one-shot engines render on
change; a progressive engine shows the preview while the camera moves
or the view just changed, then resets and adds one pass per frame
until its target is reached.

Docs: render-core, app, crates, testing, glossary, CHANGELOG, roadmap
(M2 task 1 done).
The path tracer traces the preview's WorldMesh quads (ADR 0007).
QuadGrid::build converts them to 56-byte parallelograms in preview
draw order and sorts them into a two-level grid: a coarse array of
8^3 bricks, per brick an occupancy mask, compacted cell offsets and
quad lists. QuadGrid::trace is the CPU reference traversal (two-level
DDA; front/both faces; alpha-test callback; ties go to the higher
index, matching the preview's depth test for coplanar faces).

Tests cover handmade fixtures and compare 3000 random rays against a
brute-force search; an opt-in test reports real-world memory, build
time and CPU trace speed.

Docs: ADR 0007, path-tracer, render-core, architecture overview,
crates, dependencies (rayon in pt), testing, glossary, CHANGELOG,
roadmap (M2 task 2 done).
Move the texture-array upload, placeholder and sampler from the
preview into aktis_render::textures so the path tracer can use them.
No behaviour change.

Docs: render-core.
PathTracer uploads the quad grid and block textures and traces one
pass per render call in a compute shader (trace.wgsl, a port of the
CPU traversal). The albedo view reproduces the preview's colours
and matches it pixel for pixel on handmade blocks (GPU tests); an
opt-in test compares both engines on a real world. A naga test
validates the shader without a GPU. Quads now carry their pass.

The app builds the grid while loading, uploads both engines, and
offers Preview / Path Tracer in the Render panel (saved); the
preview stands in while the camera moves.

Docs: path-tracer, render-core, app, architecture overview, crates,
dependencies (naga, image, pollster in pt tests), testing, glossary,
CHANGELOG, roadmap (M2 task 3 done).
New default view: one sample per pixel per pass with jittered
camera rays, a sun shadow ray at every hit, cosine-weighted
diffuse bounces with Russian roulette and a constant sky. Samples
accumulate in an f32 storage buffer and are shown as mean x
2^exposure -> ACES fit -> sRGB in the same pass (ADR 0008);
aktis_pt::color mirrors the pipeline on the CPU. The albedo view
stays as a debug view (PtView). Scene gains camera.exposure.

The app shows View and Exposure controls for the path tracer and
the sample count in the viewport overlay. GPU tests check exact
radiance for sky and floor, exposure, a sun shadow and reset.

Docs: ADR 0008, path-tracer, scene (file format), app, testing,
glossary, CHANGELOG, roadmap (M2 task 4 done).
aktis_pt::sky computes per-frame Preetham sky constants (Perez
distribution, zenith luminance/chromaticity from turbidity) and the
sun's irradiance after the atmosphere (Rayleigh + aerosol
transmittance over the Kasten-Young air mass); the shader evaluates
the same sky per direction. Shadow rays sample the sun disk for soft
shadows; camera rays see the disk, bounces don't count it twice.
Sky and sun fade to black between sunset and -6 degrees.

Scene gains sun.angular_diameter and sky.turbidity (Size and Haze
sliders in the Sun panel). GPU tests compare against the CPU sky and
now give each temporary pack its own folder (parallel tests deleted
each other's textures).

Docs: path-tracer, scene (file format), app, testing, glossary,
CHANGELOG, roadmap (M2 task 5 done).
Path rays treat a translucent hit as a diffuse surface with
probability alpha and otherwise pass straight through, filtered by
the surface colour (no refraction, up to 16 layers). Shadow rays
use the expected transmittance, (1 - alpha) x colour per layer, so
light through glass is tinted and smooth. Surfaces with an emission
level add albedo x level/15 x EMISSION_RADIANCE on every hit. Cutout
holes already pass for every ray type; new GPU tests cover tinted
glass shadows, cutout holes and emission.

Docs: path-tracer, testing, glossary, CHANGELOG, roadmap (M2 task 6
done).
aktis_render::export writes 8-bit sRGB PNGs (write_png) and saves an
engine's output texture after readback (save_png), with an
ExportError that names the file. EngineOutput now carries its
texture. The app's Render panel gains "Save PNG...", which saves the
selected engine's current image at viewport size with a file-safe
default name (world + spp or "preview") and shows the result.

Docs: render-core, architecture overview, crates, dependencies
(image in render), app, testing, CHANGELOG, roadmap (M2 task 7 done).
New pt_panel module in the Render panel: view, exposure, samples
target, bounces, a progress bar with render time and ms per sample,
Pause/Resume, Restart and "Continue x2". View, samples and bounces
are saved (clamped on load). The viewport scheduler learns a paused
state: the path tracer keeps its image and adds no samples, and a
moved camera shows the preview until resumed. The render clock only
counts frames that added a sample.

Docs: app, path-tracer, dependencies (serde_json in app tests),
testing, CHANGELOG, roadmap (M2 task 8 done).
Each path-tracer pass is now traced in bands of rows (at most 2^19
pixels, one submission per band, selected by a dynamic uniform
offset) so large images can't trip the Windows GPU watchdog. New
opt-in benchmark on a generated radius-8 world (AKTIS_BENCH=1, no
game assets): 7.4 ms/spp at 1280x720 with 5 bounces on an M5 Max.
pt_real.rs also times the path view, and now compares the albedo
view (it compared the path view since that became the default).

Docs: path-tracer (bands, performance), smoke test rows 10-17,
architecture overview, render-core, app, crates, glossary,
CHANGELOG, roadmap (M2 task 9 done; smoke test pending).
Mark M2 done in the roadmap. The manual smoke test for the path
tracer (rows 10-17) and real-world timings were not run before
closing; the roadmap entry says so and asks for both before the
first release.
Add AssetStack::open(jar, packs), which stacks packs on the client jar
lowest priority first. A pack that can't be opened is left out; a pack
without pack.mcmeta or made for another game version is used with a
warning. Pack formats are read from every pack.mcmeta form
(min/max_format, supported_formats, pack_format) and compared with the
jar's version.json (26.3 = 97.1).

The app's loader takes a pack list, the command line gets a repeatable
--pack flag, and the Loaded box lists packs and their warnings. Loads
from the project panel use no packs until the Resource Packs panel
(M3 task 2).

Docs: M3 plan added to the roadmap (task 1 done); assets.md (pack
formats, AssetStack::open), app.md, testing.md, glossary and
CHANGELOG updated.
Enable packs from the instance's resourcepacks/ or add any zip or
folder, order them (top wins, like the game), and see each pack's
description with a warning for missing packs or packs made for another
game version. Choices are saved per instance; Load uses them, and
Apply reloads the world on screen with the new packs and keeps the
camera (a full reload until the fast re-apply in M3 task 3).

Adds PackMeta::read to read one pack's pack.mcmeta without building a
stack.

Docs: roadmap (M3 task 2 done), app.md (Resource packs, saved state),
assets.md, testing.md and CHANGELOG updated.
Trilleo and others added 29 commits November 30, 2026 19:32
Add "Orbit…" to the timeline header (M7 task 7). Its window takes a
centre, radius, height, start angle, turns (sign = direction,
positive clockwise from above), start and duration, with defaults
that start the orbit where the camera is. Create replaces Position
and Look at keys in that range with 16 smooth constant-speed
position keys per turn and one Look at key on the centre, turns both
stopwatches on and grows the timeline if needed: one undo step.

16 keys per turn instead of the agreed 8: with 8 the camera path's
first and last segment cut 4.9 % inside the circle; with 16 the path
stays within 1.2 % there and 0.06 % elsewhere.

Tests: keys on the circle, turns and direction, defaults at the
camera, look-at key, path accuracy, keys in range replaced, timeline
growth, invalid values.

Docs: app.md (Orbit helper), animation.md, testing.md, roadmap (M7
task 7 done), CHANGELOG.
Add an Output section (M7 task 8): Render size (Output, the default,
or Viewport), resolution presets 1280×720 to 3840×2160 and a custom
size whose sides round up to even, as video codecs need (also when
reading projects). With Output the viewport's engines render at the
output resolution, fitted inside the viewport with linear filtering
when scaled and the frame guide around it, so the path tracer
accumulates and Save PNG saves at that size. Sizes beyond the GPU's
texture limit render at the largest size with the same aspect, with
a note. Render size is saved with the app, not in projects.

Tests: even sides, fitting to the GPU limit, presets, the fitted
display rectangle; GPU test renders preview and path tracer at
1920×1080, a small size and 1920×1080 again.

Docs: app.md (Output, viewport, Save PNG), animation.md, scene.md
(output clamping), testing.md, glossary, roadmap (M7 task 8 done),
CHANGELOG.
Add render jobs (M7 task 9a). "Render animation…" and "Render
still…" in the Render queue tab snapshot the project (engine and its
settings, scene, timeline, frames, output size) and render it through
the viewport's engines in 50 ms slices per UI frame: the preview once
per frame, the path tracer to its spp with the job's settings, a
shader pack once after a 16-frame warm-up before the first frame.
Frames go to <name>_0001.png… (or one file for a still) via a writer
thread while the next frame renders; with Denoise the path tracer's
radiance is denoised one frame at a time and tonemapped on the
writer. The job row shows status, n/N, elapsed and time left with
Pause/Resume and Cancel; existing frames are only replaced after
asking. While a job holds the engines the viewport shows its frame
and can't be flown, and playback, Orbit, world loads, New/Open and
the Render and Output sections are disabled. One log line per frame.

Tests: frame naming, paths, existing files, ETA; GPU tests render
numbered frames with the preview and path tracer, pause/resume/
cancel, a write error; opt-in 10-frame job on a real world.

Docs: app.md (Render jobs), animation.md, testing.md, glossary,
dependencies.md (pollster for app tests), roadmap (M7 task 9a done),
CHANGELOG.
Turn the single render job into a render queue (M7 task 9b). "Add
animation…" and "Add still…" snapshot the project as *.aktis.toml
text (world, selection, packs, texture cap, engine, scene, timeline,
output); Start runs the jobs top to bottom, loading each job's world
and building its shader pack first, and gives the editor its world
and pack back when the queue stops. A failed job doesn't stop the
queue; Cancel does. Jobs can be reordered, duplicated, run again,
removed, opened as an untitled project, and cleared once done.
Adding over existing frames asks Replace or Keep.

Runs skip frames whose PNG exists (frames are written to .part and
renamed); shader packs warm up again after a skipped stretch. The
queue is saved in app.ron, running jobs come back Interrupted, and
closing the window while it runs asks first.

Tests: snapshot isolation, stills and Replace, resume skipping frames
on disk (queue and GPU runner), saved queue round trip, reorder/
duplicate/remove/run again/clear finished, when a job loads its
world.

Docs: app.md (Render queue, saved state), animation.md, testing.md,
roadmap (M7 task 9b done), CHANGELOG.
Add video output (M7 task 10, ADR 0018). The Output section gains
Format (PNG sequence, MP4 H.264, MP4 H.265, MOV ProRes 422 HQ),
Quality (CRF) and Keep frames, and an ffmpeg line: found on PATH or
in the usual install folders (an app started from Finder has no shell
PATH), or chosen with "Choose…" (saved in app.ron). Video formats
are greyed out without ffmpeg.

A video job renders its frames to <video>_frames/, then runs ffmpeg
as a child process (no shell) with the preset's arguments plus
-start_number, -frames:v and BT.709 colour conversion and tags. On
success the frames are deleted unless Keep frames; on failure the job
shows ffmpeg's last lines and offers Encode again over the frames on
disk. Cancel and quitting stop ffmpeg.

Tests: argument lists per preset, CRF limit, discovery folders,
version parsing, frame pattern, Encode again; an encode test that
runs whenever ffmpeg is found encodes and decodes a short sequence
with each preset.

Docs: app.md (Video encoding, queue, saved state), animation.md,
testing.md, roadmap (M7 task 10 done), CHANGELOG.
RenderEngine::render only submits work, so a job slice queued a
whole path-traced frame (256 passes) ahead of the GPU and the
read-back then held the UI thread for ~6.6 s per 1080p frame (and
risked a GPU timeout on Windows). Each job render now polls the
device until the GPU is done, bounding a slice to about 50 ms of GPU
work (76 ms worst case measured) with unchanged throughput.

Add the opt-in M7 benchmark (job_runner::bench::m7_frame_times,
AKTIS_BENCH=1): frame times per engine at 1080p, the longest UI step,
the shader-pack warm-up comparison and ffmpeg encode times. The
runner records per-frame times (logged as a mean at the end); a
test-only shader_pack::build_now builds a pack for it.
Record M7 performance in animation.md (1080p on Test2 radius 8,
M5 Max: preview 9 ms, path tracer 256 spp 6.6 s with or without
Denoise, BSL 17 ms, Complementary 16 ms per frame; encodes of 30
frames 0.4-0.8 s) and answer the warm-up question: 16 frames are
enough for both packs. Docs pass: animation.md Working (it still
said [output] was unused), overview.md and crates.md statuses, Save
PNG at the render size. Add smoke-test rows 26-29 (timeline,
playback, queue, video) and the benchmark to testing.md. Mark M7
done in the roadmap; smoke rows 26-29 and Windows stay open for the
maintainer.
Record the M8 design agreed with the maintainer (all defaults): a
detail area loaded block by block plus far terrain as a column
heightfield in LOD rings (L0-L4), read from chunk Heightmaps and the
top sections and drawn by the preview, the path tracer and shader
packs (dh_terrain/dh_water when a pack has them); a memory budget
(Auto = 50 % of RAM) that shrinks the detail radius; one geometry copy
per engine in use instead of four; and re-centring the detail area as
the camera flies.

Docs: new subsystems/far-terrain.md with baseline load times and
memory on the 26.3 Test save; ADRs 0019 and 0020; planned far_radius
and memory_budget_gb fields in scene.md; M8 section and task list in
the roadmap (task 0 done); pointers in world, render-core,
path-tracer, shader-packs, app and overview; glossary, docs index, ADR
index and CHANGELOG updated. No code changes.
Add the opt-in m8_big_world benchmark (loader::bench): it runs the
app's load stage by stage (chunks, assets, mesh, quad grid, preview
and path-tracer uploads, shader-pack geometry), then frees it, and
prints time, bytes made and, on macOS, the process footprint split
into malloc and GPU with its peak after each step. AKTIS_TEST_CENTER
moves the selection.

Add byte counts used by it and by the coming memory budget:
BlockGrid::heap_bytes (with LightData::heap_bytes),
WorldMesh/SectionMesh/MeshData::heap_bytes, PackMesh::heap_bytes and
ShaderPackRenderer::world_gpu_bytes, with unit tests.

Docs: measurements and the peak-vs-steady explanation in
far-terrain.md (status In progress); roadmap task 1 done; testing.md,
world.md, render-core.md, shader-packs.md and CHANGELOG updated.
Only the engines in use keep world geometry on the GPU (ADR 0020).
A load builds the mesh and quad grid only for the Preview and Path
Tracer engines (loader::Residency); the CPU keeps the blocks,
entities and assets (PackWorld) but no mesh. Switching engine frees
the old engine's geometry at once and builds the new one's on a
worker from the kept blocks (MeshTask, residency_plan,
App::sync_residency). The shader-pack build meshes the world itself,
and ShaderPacks::release_world / ShaderPackRenderer::clear_world free
pack geometry while keeping the compiled programs. The render queue
counts its current job's engine as in use and waits for its geometry.
Meshing trims the vertex lists' spare capacity (100 -> 70 bytes per
quad). The Loaded box shows preview, path-tracer and shader-pack
memory separately.

Radius 64 on the test save: 6.2 GiB steady / 14.9 GiB peak with BSL
(before 14 / 20), 7.0 / 10.9 GiB with the path tracer.

Also: the shader-pack status reports 0 s compiling when the compiled
pack is reused, as documented; "Preparing <pack>..." no longer says
the preview is shown.

Docs: app.md (Engine geometry), far-terrain.md, shader-packs.md,
render-core.md, overview.md, testing.md, roadmap (2c added, 2a done),
CHANGELOG.
Load chunks in batches of up to 4096: regions are read and their
chunks' NBT parsed and checked in parallel, palettes are interned in
the original order (so block-state ids match a sequential load), and
sections are built in parallel, unpacking indices straight into grid
ids. A bad section still fails its chunk after the sections before it,
with its palette interned, as before.

Radius 64 on the test save: 662 -> 252 ms (radius 32 368 -> 113 ms).
The benchmark's path-tracer steady footprint drops from 5.0 to
4.2 GiB; the peak is unchanged.

The pre-2b loader stays as a test reference (load/sequential.rs);
tests compare grid, stats and progress calls for several batch sizes
on the fixture world and a generated four-region world, plus an opt-in
run on a real save. BlockGrid, BlockStates and LightData derive
PartialEq. aktis-world now depends on rayon.

Docs: world.md (Loading), far-terrain.md, dependencies.md,
testing.md, roadmap (2b done), CHANGELOG.
PackVertex shrinks from 52 to 44 bytes: mc_Entity is stored as
Unorm16x2 (value + 1) and at_midBlock as Snorm8x4. The patcher
declares a pack's own input as aktis_raw_<name> and defines the name
as an exact decode, so packs read the same whole numbers as before
in legacy and core declarations.

The app no longer builds a whole-world PackMesh: SectionBuilder turns
one section mesh at a time into pack vertices, and WorldUpload
(begin_world, push, finish_world) fills 32 MiB vertex buffers per
pass as sections arrive, freeing each section mesh as it goes.
upload_world and geometry::build remain for tests.

Radius 64 on the test save with BSL: Shader Pack steady 13.4 ->
5.6 GiB, build 5.8-7.4 -> 4.8-5.2 s, and the build no longer sets
the process peak (18.6 -> 11.5 GiB). Complementary renders identical
pixels; BSL differs in 29 of 921600 pixels by at most 2/255.

Tests: streamed one-quad batches render the same pixels, a pack reads
exact packed values on the GPU, decode compile rules for every float
type, packed value round trips.

Docs: shader-packs.md, far-terrain.md, testing.md, roadmap (2c done),
CHANGELOG.
Project panel → Memory budget (Auto = 50 % of RAM via sysinfo, or
whole GB), memory_budget_gb in project files and --memory-budget.
Before reading chunks the loader counts the save's chunks per ring
and loads the largest radius whose estimated peak (1.66 GiB + saved
chunks x 600 / 1450 / 1180 KiB for Preview / Path Tracer / Shader
Pack, the costliest engine in use) fits; the Loaded box and the log
say when the radius was lowered, and the panel shows the estimate
before Load. Queued jobs follow it. Preview, path-tracer and
shader-pack uploads run in out-of-memory scopes and disable the
engine with a message instead of crashing.

Costs are fitted to the app's peak footprint on the test save; radius
64 requested with 4 GB loads radius 20 (BSL, peak 3.51 GB) or 18
(Path Tracer, 3.08 GB), with 8 GB 35 (7.54 GB) or 31 (7.22 GB).

Docs: app.md, far-terrain.md, scene.md, dependencies.md (sysinfo),
ADR 0020 amendment, testing.md, roadmap (3 done), CHANGELOG.
aktis_world::lod: World::load_far(dim, &FarArea, &mut BlockStates,
progress) returns a FarTerrain with one Column (top, state, floor,
floor_state; 8 bytes) per 2^n x 2^n blocks of every saved, fully
generated far chunk. Columns come from Heightmaps.MOTION_BLOCKING and
OCEAN_FLOOR plus the two blocks they point at (packed data borrowed,
not unpacked); chunks without heightmaps are scanned. The ring sets
the level (L0 1-16 ... L4 beyond 240 chunks outside the detail area),
keeping the highest column. Regions are read in parallel and states
interned in region order; missing region files cost nothing per
chunk. PaletteEntry and for_each_index are shared with the loader.

The whole test save reads in 0.13 s into 4.8 MiB (no disk cache
needed); within radius 15 every level-0 column matches the block
grid on both test saves.

Docs: far-terrain.md, world.md, testing.md, roadmap (4 done),
CHANGELOG.
aktis_render::lod::LodPalette::build_for(&MeshAssets, &BlockStates)
gives each block state one linear RGB colour for far columns: the
coverage-weighted linear mean of its topmost up-facing quads'
textures (first weighted choice of each part) times its tint; fluids
use their still texture times their tint; waterlogged plants without
an up face use water; models without an up face average all faces;
states without a model or texture are grey. snowy=true states use the
snow colour, since the snow layer hiding their top doesn't stop
motion and the heightmap points below it.

On the test saves grass is #526D30, water #29509F, sand #DBD0A4,
snowy grass #F9FEFE; only chests stay grey.

Docs: far-terrain.md, render-core.md, testing.md, roadmap (5 done),
CHANGELOG.
Project panel Detail radius (was Radius) and Far radius (default 64,
up to 512), --far-radius, and far_radius in project files (missing
= 0). The loader reads the far terrain beyond the loaded detail
radius into the grid's block states and meshes it with the preview
geometry (also in MeshTask); PackWorld keeps it. The memory estimate
adds 160 B per far column at its ring's level; the detail radius
shrinks for the budget while the far terrain stays. The Loaded box
shows a Far terrain row.

Test save, detail 8 / far 128: 823k columns read in 142 ms, 839k
quads meshed in 218 ms, 43 MiB on the GPU, app peak 1.4 GB.

Docs: far-terrain.md, app.md, scene.md, testing.md, roadmap (6
done), CHANGELOG.
aktis_pt::far::FarField packs far columns into one u32 storage
buffer (binding 14): max tops per 8 x 8 chunks and per chunk, chunk
entries, 8-byte columns. trace_far walks groups, chunks and cells,
skipping anything below the ray; each cell is a box from y -64 to
its surface with water at the detail mesh's source height.
trace_scene (quad grid, then the far walk up to the near hit) serves
every ray: camera, bounces, shadow and light rays, all views and the
under-water test. Far hits carry a made-up flat quad (FLAT_BIT,
FAR_WATER_BIT) so materials, water and shading are unchanged.
PathTracer::upload_far / clear_far; PtStats::far_bytes.
aktis_render::lod::surface becomes public.

FarField::trace is the CPU reference, checked against brute force on
800 random rays. GPU tests: the albedo view matches the preview on a
generated far ring (0.05 % of pixels differ); a far wall shadows the
detail floor. pt_real.rs takes AKTIS_TEST_FAR.

Docs: path-tracer.md.
Loads and MeshTasks build the path tracer's FarField with its
geometry (build_far_field, 12 ms at far radius 128) and upload it
after the quad grid; a GPU out-of-memory failure there drops only
the far terrain, with a message. The memory estimate's cost per far
column rises from 160 to 176 B.

Test save, detail 8 / far 128: 6.8 MiB on the GPU; the path view
takes 12.0 instead of 6.5 ms per 2-bounce sample when far terrain
fills the horizon.

Docs: far-terrain.md, app.md, testing.md, roadmap (7 done),
CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lod::grid_columns turns a grid's whole chunks into level-0 columns
(highest non-air block; under fluids the highest other block), and
FarTerrain::with_detail_area adds them under the detail area, as
Distant Horizons covers the game's loaded chunks (shader packs' DH
programs need far terrain there too).

Docs: world.md.
As Iris does with the Distant Horizons mod: Environment's
distant_horizons flag defines DISTANT_HORIZONS for every program;
dh_terrain and dh_water draw the far terrain (FarPackMesh, built from
the preview's far quads, which now record a block state per quad)
into the colour buffers with their own depth buffer, copied to
dhDepthTex1/dhDepthTex0. The patcher supplies dhMaterialId (location
5 over the entity bytes); geometry::dh_material guesses DH_BLOCK_*
ids. New uniforms: dhProjection (+Inverse, Previous), dhNearPlane,
dhFarPlane, dhRenderDistance (DrawKind::Distant). Before dh_water the
detail depth is merged into the far depth in the far projection.
While far terrain is drawn, `far` is the distance to the detail
area's nearest edge, since packs hide far terrain within `far` and
detail terrain beyond it.

BSL and Complementary build with no problems and show the far
terrain under their fog and water (164 MiB at far radius 128, BSL
6.0 -> 8.2 ms per frame). GPU test: a handmade DH pack with and
without the flag.

Docs: shader-packs.md.
The shader-pack build compiles with DISTANT_HORIZONS while the world
has far terrain (reusing a compiled pack only with the same flag) and
uploads the far terrain, under the detail area too, when the pack's
dh_* programs built; the Render panel says when a pack has none. The
memory estimate's far column cost is now per engine (Preview 120,
Path Tracer 140, Shader Pack 460 B).

App, BSL at far radius 128: peak 2.3 GB (estimate 2.6 GB).

Docs: far-terrain.md, app.md, testing.md, roadmap (8 done),
CHANGELOG.
The app's saved state (eframe storage key `aktis`, app.ron) never
decoded: Timeline deserializes through RawTimeline, whose `in`/`out`
are Option<f64>, and RON requires `Some(…)` for options while Timeline
writes plain numbers. eframe logs the error only at debug level, so
every start silently fell back to defaults (engine, shader packs,
scene, timeline, queue).

Read `in`/`out` with a deserializer that takes a plain number as Some;
a missing key still means "missing", so project files without them
behave as before. Saved states from earlier builds now restore.

Add ron 0.12 (eframe's version) as a test-only dependency of the scene
and app crates, with tests that round-trip Timeline and the whole
Saved state through RON as eframe does, and that a TOML timeline
without `in`/`out` covers the whole length.

Docs: CHANGELOG, scene.md (timeline reading), app.md (saved state),
testing.md, dependencies.md.
When the camera's chunk is more than max(D/2, 2) chunks from the
detail centre (loader::recentre_target), the app loads the same
request centred on the camera in the background, keeping the camera;
the old world stays until the new one is installed and the far
terrain follows. Not while loading, playing back, rendering the queue
or a job, or with a custom Centre; a failed re-centre isn't retried
in the same chunk. The Loaded box shows the current centre.

Flight east across the test save (detail 8, far 128): a re-centre
every 80 blocks, 0.38-0.46 s each.

Tests: the trigger rule, and an opt-in flight on a real save.

Docs: far-terrain.md, app.md, testing.md, roadmap (9 done),
CHANGELOG.
Record the M8 results in far-terrain.md: steady and peak footprint
per engine at radius 64 (down from 14 / 20 GB to 2.8–6.5 / 5.3–11.3
GB) and at detail 16 / far 256. Mark the subsystem Working with a
table of M8 tasks, fix the planned leftovers and note the start-up
double load when the timeline keys the camera away from spawn as an
open question. Update overview.md, add smoke-test rows 30-35 to
testing.md and close M8 in the roadmap.
Record the M8 results in far-terrain.md: steady and peak footprint
per engine at radius 64 (down from 14 / 20 GB to 2.8–6.5 / 5.3–11.3
GB) and at detail 16 / far 256. Mark the subsystem Working with a
table of M8 tasks, fix the planned leftovers and note the start-up
double load when the timeline keys the camera away from spawn as an
open question. Update overview.md, add smoke-test rows 30-35 to
testing.md (passed on macOS) and close M8 in the roadmap.
Every milestone (M1-M8) is done, so describe Aktis as a beta. Add the
[0.1.0] - 2026-12-01 section to CHANGELOG.md with highlights and known
limitations above the full entry list, rewrite the README status,
features and download notes, mark every crate and subsystem Working,
add a Releases table and an "After 0.1.0" list to the roadmap, and
update vision.md, overview.md and ci-and-release.md. Fix stale lines
in animation.md and path-tracer.md. The workspace version is already
0.1.0.
FXC rejects writes to a vector component with a runtime index
(X3500), so the path tracer failed on Windows. dda_step and
dda2_step now update cell/t_next with a masked select.

Also drop rustdoc links to the private MAX_BATCH_BYTES in aktis-sp,
which failed the CI docs build.

Docs: CHANGELOG, path-tracer.md, overview.md platform rules.
On Windows CI wgpu falls back to WARP; the job-runner GPU tests ran
for minutes there and then crashed the test process (access
violation / heap corruption). Every GPU test helper now treats a
software adapter (DeviceType::Cpu) as "no GPU", matching the
documented "CI has no GPU" rule. A new compile-only test,
shaders_compile_on_any_adapter, still builds the path tracer and
preview pipelines on any adapter so FXC errors stay caught.

preview_gpu.rs tests shared one temp pack folder; one test's cleanup
could delete another's files ("Invalid argument" on macOS CI). Each
pack now gets its own folder.

Docs: CHANGELOG, docs/dev/testing.md, CLAUDE.md GPU-test rule.
pack_geometry.rs and shadow_gpu.rs built their packs in one folder
named after the process id. Tests run in parallel, so one test's
cleanup could delete files another was still reading (a short mesh
failed pack_geometry on Windows CI). Each call now gets its own
folder.

Docs: CHANGELOG, docs/dev/testing.md (temp folders in tests).
@Trilleo
Trilleo merged commit 59a025f into TriBinary:main Dec 1, 2026
6 checks passed
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.

1 participant