Skip to content

Add AO, lighting, biome colors, and greedy meshing#87

Merged
Purdze merged 12 commits into
masterfrom
feat/ambient-occlusion
Mar 27, 2026
Merged

Add AO, lighting, biome colors, and greedy meshing#87
Purdze merged 12 commits into
masterfrom
feat/ambient-occlusion

Conversation

@Purdze
Copy link
Copy Markdown
Collaborator

@Purdze Purdze commented Mar 26, 2026

Summary

  • Per-vertex ambient occlusion matching vanilla (4-sample formula, quad flipping)
  • Sky/block light from chunk packets with smooth per-vertex averaging
  • Biome grass + foliage colormaps with 5x5 blend, color overrides, and modifiers (dark forest, swamp with exact vanilla simplex noise)
  • Separate foliage.png colormap for leaves/vines
  • sRGB pipeline fix (linearize tint + light in shader to match vanilla's color math)
  • Depth test fix (LESS_OR_EQUAL) for grass block side overlay rendering
  • Re-enabled greedy meshing with AO as merge criterion (vendored binary-greedy-meshing, removed crate dependency)
  • AO only occludes full opaque cubes (not grass, flowers, torches)

Test plan

  • Compare grass/foliage colors against vanilla in plains, savanna, jungle, dark forest, swamp
  • Verify AO shadows on block corners match vanilla
  • Verify grass block side overlay shows biome tint
  • Verify greedy-meshed blocks (stone, dirt) have correct AO
  • Test underground lighting (caves, mines)
  • Test biome transitions for smooth color blending

Closes #86 partially

Purdze added 12 commits March 25, 2026 22:51
- Per-vertex AO matching vanilla formula (4-sample average with quad flipping)
- Directional face shading matching vanilla (Up=1.0, Down=0.5, N/S=0.8, E/W=0.6)
- Sky and block light data stored per-chunk from server packets
- Light level applied to vertex brightness via vanilla light table
- Biome query methods added to ChunkStore and mesher snapshot
- Greedy meshing disabled to enable per-vertex AO on all blocks
- Load grass.png colormap at mesher init
- Query biome per block during meshing for temperature/downfall
- Look up colormap pixel for biome-specific grass/foliage color
- All tint paths (baked model, cube faces, greedy) use biome color
…ge colormap, smooth lighting

- Remove incorrect sRGB linearization (powf(2.2)) from colormap lookup
- Extract grass/foliage color overrides and grass_color_modifier from server registry NBT
- Implement GrassColorModifier::DarkForest (average with #28340A) and Swamp (noise-based)
- Add separate foliage.png colormap for leaves/vines (was sharing grass.png)
- Change BakedQuad.tinted bool to BakedQuad.tint Tint enum for correct grass vs foliage dispatch
- Add 5x5 biome color blending (radius=2) matching vanilla default
- Per-vertex smooth lighting: average light from 4 neighbors per vertex instead of 1 per face
@Purdze Purdze merged commit 8c7cdd4 into master Mar 27, 2026
7 checks passed
@Purdze Purdze deleted the feat/ambient-occlusion branch March 27, 2026 16:24
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.

Remaining vanilla parity items

1 participant