Java shader packs: occlusion culling while the pack draws the terrain

The pack's terrain program draws the solid sections the last test saw,
the boxes of the others are tested against the pack's depth in a pass
of their own (OpenGL's layout: y flipped, depth 0 near, so a second
depth-only culling pipeline), and the program then draws the sections
in sight from the culling's phase 2 draws. The flat path, which has no
occlusion culling, is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-22 23:05:26 +02:00
parent 6a58fc20da
commit c344a26e80
6 changed files with 213 additions and 86 deletions
+5 -1
View File
@@ -367,6 +367,10 @@ sprite arrays (animated sprites copied in each frame), `lightmap` is Horizon's l
and fragments under alpha 0.1 are discarded (`alphaTestRef`). `RGBA16` targets are 16-bit unorm where the GPU can
render them (Chocapic13' packs its G-buffer into them; half floats broke it).
Occlusion culling works as in Horizon's world pass where the GPU has it: the pack's terrain program draws the
sections the last test saw, the boxes of the others are tested against that depth (in OpenGL's layout, in a pass of
their own since the pack's targets vary), and the pack's program then draws the ones in sight.
What makes Horizon look like OpenGL to the pack:
- **Layout.** The translator ends every vertex shader by flipping `gl_Position.y` and moving depth from `[-w, w]` to
@@ -401,7 +405,7 @@ grade and light Horizon's world as their post-processing would. Sildur's Vibrant
Without the other `gbuffers_*` and `shadow`, no pack has its shadows or sky look yet; Distant Horizons' and Voxy's depth read as far. Not supported yet: images and
compute (`.csh`; a pack that needs them doesn't load), mipmapped targets (`colortexNMipmapEnabled` is read but
ignored), custom textures, the option screen; shadow matrices are identity. With the pack's terrain: entities, the
sky, the hand, weather and clouds are still Horizon's (in `colortex0` only), GPU occlusion culling is off, block ids
sky, the hand, weather and clouds are still Horizon's (in `colortex0` only), block ids
come from sprite names rather than block states, distant (LOD) terrain doesn't repeat its textures, and only the
overworld has been checked.