How the client renders
This page is a map for a contributor who wants to read the renderer. It gives the idea of each part in a few lines and sends you to the notes that hold the rules and the numbers, so it does not repeat them.
World rendering uses mcrs_minecraft_render for the terrain and sky and mcrs_minecraft_entity_render for mobs. These crates are layer 6 in the crate map, so they work on the data of the layers below and have no network, client or server code. The GUI has its own reusable crates.
Terrain lives in a few large GPU buffers
Section titled “Terrain lives in a few large GPU buffers”The renderer writes chunk meshes into three large geometry buffers called arenas, which hold quads, models and faces. An allocator packs blocks toward offset zero, and an arena grows in steps with spare capacity as geometry arrives.
The frame is a chain of render systems that run in a fixed order. They upload the changed geometry, run the cull, draw the sky into the world image, and draw the opaque terrain into a gbuffer, a set of images that keep the surface of each pixel. Then they run the occlusion test with a second opaque pass, draw the mobs, light the gbuffer in one pass, and draw the clouds and the blended terrain in a forward pass. A last pass presents the world image to the camera’s target, which can be a window or an off-screen image.
The GPU chooses what to draw
Section titled “The GPU chooses what to draw”Culling means leaving out geometry that the camera cannot see. On the full path, a compute pass on the GPU tests each group of quads against the view and writes the draw arguments.
This is the full path, which the renderer takes when the device has compute shaders, indirect draws and storage buffers. WebGL2 has none of them, so in that case the renderer takes a minimal path. The shaders stay the same, the arrays they read become textures, and the renderer draws every resident group, because nothing culls them.
Occlusion is tested against the depth of the last frame
Section titled “Occlusion is tested against the depth of the last frame”A group can be inside the view and still hidden behind a hill. The occlusion test removes the triangles that are behind the terrain. It works against a depth pyramid built from the last frame, and it runs in two passes.
The first cull hides what the old pyramid hides, and it keeps the groups that only this test hides as candidates. The renderer then rebuilds the pyramid from the depth of the current frame, and a second cull brings back the candidates that are visible after all, in a second set of draws. Because of the second pass, nothing appears one frame late.
The occlusion pass costs time even when there is nothing to draw, so it runs only when groups are resident. You can turn it off with MCRS_OCCLUSION=0 to see what it buys.
Mobs are posed and drawn on the GPU
Section titled “Mobs are posed and drawn on the GPU”The design in docs/entity-render.md aims at 100,000 mobs in one world without a frame drop. That number is the goal of the note and is not a measured result. The note has a section for stress scenes and gates, and the numbers behind each size are in docs/entity-render-budget.md.
The ECS holds the state of each mob, and the GPU holds a projection of that state in a persistent slot. The CPU writes a slot only when something changes, which means a packet, a tick or a script input. The GPU does the rest, and only for visible mobs: it culls, computes the poses, expands the faces and draws. The poses come from Molang, the expression language that the client entity definitions use, and mcrs_molang_wgsl lowers the Molang channels to WGSL shader code.
The note defines three execution paths of the mobs for graphics adapters of different capabilities.
| Path | What it needs |
|---|---|
| Full | Compute shaders and vertex storage |
| Compatibility | WebGPU compatibility mode |
| Minimal | No compute, for WebGL2 |
Only the full path of the mobs is built. The renderer runs the entity passes when the device takes the full path of the terrain and the passes fit its limits. Each pass binds at most 8 storage buffers, the limit of WebGPU in a browser, so a Chromium browser draws mobs over WebGPU. On WebGL2 the client draws no mobs. The web client has no measured steady frame yet.4
Far mobs are flat images
Section titled “Far mobs are flat images”A mob that is far away does not need its full rig, the set of bones that poses the model. For each pair of a model and a texture, the renderer bakes a small set of views. A set has 16 yaws and 9 elevations at 64 by 64 texels and takes about 4.7 MB. A far mob is then drawn as an impostor, which is one quad that shows the nearest view. The renderer bakes a set lazily, when a model and a texture first appear on an active mob. Full rigs have a cap, and impostors have none. The note records the cost of each step and the choices that did not help.
A player draws through the same passes. Its skin is a layer of the entity textures that the renderer writes when the skin arrives, so a new skin needs no rebuild. A player with a skin keeps the full rig at each distance, because a baked view would keep an old skin. The server sends the pose of each player, and the client draws another player sneaking, swimming, crawling, sleeping, gliding or in a spin attack with the animations in assets/mcrs/entity/animations/player.animation.json. The camera and the ray that finds the target block follow the eye height of the pose of the local player.5 A program with no server, such as a world viewer, adds a player with host_living_entity from mcrs_minecraft_entity_visual, moves it through its Motion component, and gives it a model with the PlayerModel component and a skin with the PlayerSkin component. The rules are in docs/spec/client-player-render.md.
The survival inventory screen and the survival tab of the creative inventory draw the local player through the same passes. ShowsFigure on the top screen supplies its FigurePlacement. The cull, the pose and the expand run a second time for this figure view, and FigureDraw draws its faces into a render pass of the host.
Reusable GUI crates
Section titled “Reusable GUI crates”The crate map lists the reusable GUI crates and their responsibilities.
Chat, container and creative screens and the game mode switcher use screen entities with an Escape policy. The remaining client screens still use Screen; the GUI split RFD lists the later migration steps. Changes between creative and survival inventories follow the client screen rules.
Chat, screens and tooltips flatten text through mcrs_minecraft_text_flatten. Selector text stays literal; unresolved score and NBT content display nothing. A malformed translation template displays the whole template. Chat and creative search use the same edit-box drawing model, with a caret that blinks from the time the box gains focus.
Name tags and sign text
Section titled “Name tags and sign text”Name tags face the camera above players and named mobs. A host’s NameTag takes precedence over the custom name from entity data; a player’s profile name is the fallback. A mob also needs SyncedData.name_visible. Tags appear at distances below 64 blocks, or below 32 while crouching. Invisible entities and entities marked CameraEntity have no tag. A normal tag draws faint text through blocks and opaque text with depth; a crouching tag draws once with depth.6
NameTagPlugin in mcrs_minecraft_client::name_tag is included by ClientTerrainPlugin. A host can add it after the renderer and entity plugins, set NameTag on an entity and mark the camera’s entity with CameraEntity. The client does not yet supply the crosshair target, hidden-HUD state or passenger state to the visibility check, so those rules do not affect tags yet. Team visibility and a score line below the name are also absent. The text pass works on the minimal WebGL2 path even though that path draws no entity models.6
Signs share the font and glyph atlas with name tags. Standing and wall signs draw each side’s text only toward its viewer, so looking from inside a sign no longer shows the far side mirrored. The fix applies to both rendering paths.7
Health and death use GUI plugins
Section titled “Health and death use GUI plugins”The health HUD draws hearts and food from the local player’s Vitals, FoodLevel and maximum-health attribute, and the death screen’s button requests respawn. Health and death lists the display limits; the crate map lists the GUI crates, and the HUD rules are in docs/spec/client-health-hud.md.8
Where the rules are
Section titled “Where the rules are”| Topic | File |
|---|---|
| Entity rendering design | docs/entity-render.md |
| Workload model and budget of entities | docs/entity-render-budget.md |
| What the client can do today | The client today |
Two more pieces of work are planned: a bound on memory at 96 columns, and rendering inside a host application that owns the window and the camera.910
Footnotes
Section titled “Footnotes”-
Works#16 The first task of the renderer restart: layouts declared once for Rust and WGSL. ↩
-
WIP#37 The last task of the renderer restart: tinted overlays folded into one sprite. ↩
-
WIP#330 Tracks the measurement of the deferred renderer against the pre-restructure baseline. ↩
-
Works#970 Tracks the pose and the eye height of players on the server and the client. ↩
-
Works#1062 Adds name tags with host inputs and records the inputs the client does not yet supply. ↩ ↩2
-
Works#1085 Adds the removable health HUD and death-screen plugins. ↩
-
WIP#337 Tracks a bound on the client’s memory at 96 columns. ↩
-
WIP#506 Tracks rendering that embeds in a host app, which owns the window and the camera. ↩
Sources and verification
Verified: 26.4-snapshot-7, 1cf84286c, 2026-11-30
- docs/entity-render.md
- docs/entity-render-budget.md
- crates/mcrs_minecraft_render/src/arenas.rs
- crates/mcrs_minecraft_render/src/cull.rs
- crates/mcrs_minecraft_render/src/pass.rs
- crates/mcrs_minecraft_render/Cargo.toml
- crates/mcrs_minecraft_entity_render/Cargo.toml
- crates/mcrs_minecraft_entity_render/src/lib.rs
- crates/mcrs_minecraft_entity_render/src/plugin.rs
- crates/mcrs_minecraft_entity_visual/src/host_entity.rs
- crates/mcrs_minecraft_render/src/lib.rs
- crates/mcrs_minecraft_render/src/render_path.rs
- docs/spec/client-player-render.md
- assets/mcrs/entity/animations/player.animation.json
- issue #330
- issue #337
- issue #344
- PR #731
- PR #769
- PR #789
- PR #970
- crates/mcrs_minecraft_client_gui/src/inventory_figure.rs
- crates/mcrs_minecraft_client/src/name_tag.rs
- crates/mcrs_minecraft_client/src/sign_text.rs
- crates/mcrs_minecraft_client/src/client_terrain_plugin.rs
- crates/mcrs_minecraft_entity_visual/src/name_tag.rs
- crates/mcrs_minecraft_client_world/src/sign.rs
- crates/mcrs_minecraft_render/src/name_tag.rs
- crates/mcrs_minecraft_render/src/world_text.rs
- crates/mcrs_minecraft_client_gui/src/sign_text.rs
- crates/mcrs_minecraft_client_gui/src/health_hud.rs
- crates/mcrs_minecraft_client_gui/src/death_screen_plugin.rs
- crates/mcrs_minecraft_client/src/native.rs
- crates/mcrs_minecraft_client/src/web.rs
- crates/mcrs_minecraft_entity_render/src/impostor_frame.rs
- crates/mcrs_minecraft_entity_render/src/impostor_atlas.rs
- docs/spec/client-entity-render.md
- docs/spec/client-sign-text.md
- docs/spec/client-health-hud.md
- PR #1056
- PR #1062
- PR #1085
- issue #16
- issue #37
- issue #506
- crates/mcrs_minecraft_client_gui/src/creative_screen_state.rs
- crates/mcrs_minecraft_client_gui/src/creative_screen_plugin.rs
- crates/mcrs_minecraft_client_gui/src/creative_screen_view_tests.rs
- crates/mcrs_minecraft_gui_screen/src/shows_figure.rs
- crates/mcrs_minecraft_gui_screen/src/screen_entry.rs
- crates/mcrs_minecraft_gui_screen/src/screen_stack.rs
- crates/mcrs_minecraft_font/src/text.rs
- crates/mcrs_minecraft_text_flatten/src/flatten.rs
- crates/mcrs_minecraft_client_widget/src/edit_box.rs
- crates/mcrs_minecraft_client_gui/src/edit_box_draw.rs
- docs/rfd/0005-gui-crates.md
- PR #1149
- PR #1157
- PR #1159
- PR #1177
- PR #1179
- PR #1187
Related open issues:
- #17 WIP Split `Terrain` into resources by task and isolate culling
- #18 WIP Move section residency and the visibility graph into the renderer
- #330 WIP The deferred renderer is measured against the pre-restructure baseline
- #331 Undecided Decide whether the indexed terrain draw comes back
- #332 WIP Scene capture fails when a pipeline never builds
- #334 WIP Profile the per-frame path: allocations, arena stability and overlay cost
- #335 WIP No pipeline compiles after the world is visible
- #336 WIP Window screenshots are sometimes black
- #337 WIP Bound the client's memory at 96 columns
- #344 WIP The web client reaches a steady frame
- #346 WIP Verify coloured static block light and enable it by default
- #506 WIP Rendering embeds in a host app that owns the window, the camera and the render graph
- #1059 WIP Native client: GPU out of memory while a terrain arena grows
- #1150 WIP Client stalls after join during terrain arena growth
- #1202 WIP Client terrain arenas grow to about 2 GB while the player stands still