External Publication
Visit Post

Blocks

jMonkeyEngine Hub June 4, 2026
Source

Ialon code is publicly available here. It doesn’t compute classic geometric AO but uses Minecraft-style smooth lighting baked into per-vertex colors at mesh-generation time, where neighbouring solid blocks (which carry light level 0) automatically darken the corners next to them, producing the soft-shadow / AO look.

Here is the detailed pipeline:

  1. Light is stored per block, in a light map. Each block has a packed light byte (Chunk.lightMap): the high nibble is sunlight (0-15), the low nibble is torchlight (0-15). Solid/opaque blocks end up with light 0. getLightLevel(...) (Chunk.java:553) returns aVector4f where xyz is a light color (white, or tinted for water) and w is that packed level byte.
  2. Each face vertex averages the light of its surrounding neighbours. For a visible cube face, Cube.softShadow(...) (Cube.java:93) drives the effect: it fetches the 8 neighbouring blocks’ lights around that face. For each of the 4 face corners it averages the two adjacent side neighbours, the diagonal corner neighbour, and the face’s own light.
  3. Because a solid neighbour contributes light 0, a corner touching solid geometry gets a lower average (darker corner). That darkening is the ambient-occlusion effect.
  4. These four colors are pushed into the mesh’s color buffer.
  5. Anti-artifact triangle flip : a quad split into two triangles interpolates AO unevenly along its diagonal. A couple of methods must choose a triangle winding so that the darkened corner interpolates correctly (the classic Minecraft AO-seam fix).
  6. The shader turns the vertex color into final brightness.

Hope it helps !

Discussion in the ATmosphere

Loading comments...