Rust voxel sandbox (wgpu + wasm + axum multiplayer)
Find a file
Maximus Gorog dccb06dddf Round D: bake bounce_color + material per vertex; specular for ice/snow (#7, #9, #15, #17 foundation)
sim/lighting.rs:
  - New compute_ambience(world, pos, normal) -> VertexAmbience
    returns BOTH sky_vis AND bounce_color from the same 8-ray
    hemisphere cast. No double walks of the voxel grid.
  - walks_until_solid(world, origin, dir) -> Option<Vec3> is the
    primitive: None = escaped to sky, Some(color) = first solid hit.
    Used by compute_ambience to accumulate the bounce_color average.
  - sky_visibility is now a thin wrapper around compute_ambience for
    tests and clarity.

world.rs:
  - Block::average_color() returns the mean across all 6 faces — the
    contribution this block makes to a neighbor's bounce when hit by
    a hemisphere ray.
  - Block::material_id() returns 0 (matte) for most blocks, 1
    (specular) for Ice + Snow. Reserved 2 for future emissive blocks.

mesh.rs:
  - Vertex grows `bounce_mat: [f32; 4]` packing baked bounce color
    (rgb) + material id (a). Float32x4 attribute at @location(6).
  - build_chunk_mesh now calls compute_ambience for each quad corner
    (same one-pass ray-cast that produced sky_vis already, plus the
    bounce accumulation). Material id taken from cell.block.

shader.wgsl:
  - VsIn / VsOut grow bounce_mat (vec4).
  - ambient_term now takes the per-vertex bounce_albedo instead of a
    hard-coded gray-brown. A red brick wall thus casts a faint red
    bounce on dirt next to it — real GI hint, baked once at mesh
    time, zero cost at runtime per fragment.
  - material_for(id) lookup: Phong specular for ice/snow (m.specular
    = 0.45 with cos⁴⁸ half-vector); emission slot reserved.
  - fs_main pipeline now includes the specular + emission terms.
  - Camera.frame keeps Round C accessor names; ambient_strength
    untouched.

Tests: 63 passing. Native + wasm release clean.

Deferred from this round (own sessions): #18 water (new pipeline +
animation), #19 transparent/cutout (new blend state), #8 wider AO
(current 4-corner is sufficient for now; the wider-occlusion effect
is now coming through bounce_color anyway).

Visual change: bounce-tinted ambient (red walls glow red onto
neighbors); ice + snow get specular highlight in direct sun.
2026-05-24 10:24:59 -06:00
server pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00
src Round D: bake bounce_color + material per vertex; specular for ice/snow (#7, #9, #15, #17 foundation) 2026-05-24 10:24:59 -06:00
web Render + UI polish since pre-alpha-0.0.1 2026-05-23 18:44:56 -06:00
.dockerignore Add Docker + Caddy deploy for voxel.mxvs.art 2026-05-23 18:45:05 -06:00
.gitignore pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00
ARCHITECTURE.md Add ARCHITECTURE.md mapping the functional-core/imperative-shell split 2026-05-23 23:33:02 -06:00
build-web.sh pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00
Caddyfile Add Docker + Caddy deploy for voxel.mxvs.art 2026-05-23 18:45:05 -06:00
Cargo.lock pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00
Cargo.toml pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00
DEPLOY.md DEPLOY.md: add active-deployment runbook for voxel.mxvs.art 2026-05-23 22:52:43 -06:00
docker-compose.prod.yml Add Docker + Caddy deploy for voxel.mxvs.art 2026-05-23 18:45:05 -06:00
docker-compose.yml Add Docker + Caddy deploy for voxel.mxvs.art 2026-05-23 18:45:05 -06:00
Dockerfile Add Docker + Caddy deploy for voxel.mxvs.art 2026-05-23 18:45:05 -06:00
run.sh pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00