Render negative-Y sections on 1.18+ worlds - #488
Open
u9g wants to merge 2 commits into
Open
Conversation
A camera below y=0 renders nothing but the clear color: a bot standing on the surface of any 1.18+ world (surface ~y=-60 in the overworld's lower range, or anywhere in a deepslate cave) shows a uniform sky-blue frame with the surrounding chunks fully loaded. Three spots hardcode the pre-1.18 world range [0, 256): - worldrenderer.js dirty-section loops in addColumn/removeColumn iterate y=0..240, so sections below y=0 are never queued for meshing - worker.js indexes chunk.sections[floor(y/16)], but 1.18+ ChunkColumn indexes from minY (-64): sections[(y - minY) >> 4]; y<0 resolves to sections[-1] = undefined and the section is skipped - models.js culls faces against a hardcoded y<0 instead of the world's minY Derive minY/worldHeight from the version's chunk implementation (defaults 0/256, so pre-1.18 is unchanged), iterate the real range, index worker sections by (y - minY)/16, and gate models.js culling on world.minY. Revives PrismarineJS#485 (closed); no longer stacked on the 26.1 PR.
…enderer Requiring prismarine-chunk from worldrenderer.js pulled all of minecraft-data into the browser index bundle, OOMing webpack in CI. The node-side loadChunk producers already have the column, so they send minY/worldHeight along with the chunk.
u9g
force-pushed
the
render-negative-y-sections
branch
from
September 6, 2026 14:22
e82ce3f to
8049729
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Revives #485 as a standalone change (the original was stacked on #484; this one is based on master and depends on nothing else).
Problem
A camera below y=0 renders nothing but the clear color — a mineflayer bot standing on the surface of any 1.18+ overworld, or anywhere in a deepslate cave, shows a uniform sky-blue frame even with the surrounding chunks fully loaded.
Cause
Three spots hardcode the pre-1.18 world range [0, 256):
worldrenderer.jsdirty-section loops inaddColumn/removeColumniteratey = 0..240, so sections below y=0 are never queued for meshing.worker.jsindexeschunk.sections[Math.floor(y / 16)], but 1.18+ChunkColumnindexes fromminY(-64):sections[(pos.y - minY) >> 4]. For y<0 this resolves tosections[-1]= undefined and the section is skipped.models.jsculls faces against a hardcodedy < 0instead of the world'sminY, so every face on a below-zero surface is culled.Fix
minY/worldHeightfrom the version's chunk implementation insetVersion(defaults0/256, so pre-1.18 behavior is unchanged) and iterate the real range.(y - (chunk.minY ?? 0)) / 16.minYon the worker'sWorldwrapper and gatemodels.jsculling onworld.minY ?? 0.Verification
Confirmed live: a mineflayer bot on a Paper 1.21.8 server standing at y=-60 rendered a blank sky before and a full grass-plains first-person view after (headless-gl + this branch).
setVersion('1.16.5')/'1.12.2'still resolve to{ minY: 0, worldHeight: 256 }, so pre-1.18 is untouched.