Repository navigation
Perspective still images and a render API for watch - #7
Merged
Merged
Conversation
Adds a perspective "shot" capability next to the tile renderer: - ShotCamera / ShotRenderer: a perspective camera with the same terms as BlueMap's perspective view (target, distance, rotation, angle, fov 75, its near/far rule, and its effective-target-height rule computed from the world data), rendering any image size through a perspective rasterizer variant. Translucent sorting follows the view direction. - A `shot` command that writes a PNG plus the camera transform as JSON. - An HTTP render API served by `watch --api-port`: POST /v1/render with a map name, a camera and a size returns the PNG (base64) and the transform; GET /v1/maps and /v1/health alongside. High-priority requests are served about once a second between tile batches, normal ones a few per step, identical requests hit a short-lived cache, and the API keeps serving when the tile database is unreachable. - Block-entity blocks are baked from built-in models mirroring the client's geometry and entity textures (chests incl. double and copper variants, banners, skulls and heads, shulker boxes); build-data extracts the entity sheets into the texture atlas. Sign text is not drawn. - uvlock variants now keep their texture fixed to the world while the model rotates, recomputed from the rotated face direction and the rotated element box. docs/render-api.md describes the camera, the API and the measured equivalence with the BlueMap screenshot path.
malken21
force-pushed
the
feature/shots
branch
from
November 10, 2026 10:18
01c6246 to
d2425be
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.
Adds a perspective still-image capability to the renderer, next to the tile pipeline:
ShotCamera/ShotRendererimplement a perspective camera with the same terms as BlueMap's perspective view — target, distance, rotation, angle, vertical fov 75°, its near/far rule, and its effective-target-height rule computed from the world data itself (adjust_height: falseopts out). Any image size; translucent sorting follows the view direction.shotcommand writes a PNG plus the camera transform (view/projection matrices, eye, effective target) as JSON.watch --api-portservesPOST /v1/render(map name + camera + size → PNG as base64 + transform),GET /v1/maps,GET /v1/health. High-priority requests are served about once a second between tile batches; normal-priority ones a few per step, so batch sequences (for example background-video frames) cannot starve an urgent single shot; identical requests are answered from a short-lived cache; meshes stay cached across frames. The API keeps serving when the tile database is unreachable (tile updates for that map wait). The API is a general renderer capability — overlays and annotations are the caller's job, computed from the returned transform.build-dataextracts the entity sheets into the texture atlas (existing texture indices unchanged). Sign and bed shapes come from their block models; sign text is not drawn.uvlock: truenow keep their texture fixed to the world while the model rotates, recomputed from the rotated face direction and element box.Verification
Measured on a synthetic test world (block entities, uvlock variants, a damaged area) drawn with the same cameras by BlueMap (Paper + BlueMap, browser capture) and by the shot renderer at 1280×720; the renderer's void was composited over black, the capture's void colour:
The remaining differences are shading and texture filtering of two independent renderers. Details and request/response formats:
docs/render-api.md. Live API check against a runningwatch: health 204, map list, a high-priority 1280×720 render answered in ~1.5 s end to end (~0.4 s render), a repeated request from cache in ~0.1 s, and a 1920×1080 normal-priority render in ~1.8 s.