Skip to content

Render a built-in reference scene to PNG on one thread #2

Closed

Description

@flyingrobots
.dag: issue-dag/2
.id: flyingrobots/lumen#2
.kind: task
.type: feature
.blocked_by: [flyingrobots/lumen#1, flyingrobots/bunny#123, flyingrobots/bunny#138, flyingrobots/bunny#222]
.size_hours: 8
area: lumen workspace
source: Lumen 4K goal plan of 2026-11-13

Feature

Build the reference scene in code. The bumpy sphere on a ground plane from Bunny's scene benchmark is a fine start.
Generate camera rays with `bunny-optics` and find hits with `closest_hit`.
Shade flat or by normal, and write a PNG on one thread.
Choose the PNG encoder (small dependency or hand-written) and justify the choice in the docs.
Check the output hash is the same on two runs.
~/git/devcontainers/bin/devrun lumen ~/git/lumen --worktree -- cargo test --locked --workspace

1. Background Context

This is the first picture Lumen makes. It needs the closest-hit traversal (Bunny), the camera (bunny-optics) and pixel output math.

Plan context: Lumen renders a 4K (3840x2160) reference scene on an Apple M5 Pro in under 60 seconds at 16 samples per pixel, with the same output hash on every run, built on Bunny's deterministic Q32.32 math. Then the same image and hash on the GPU.

2. Problem Description

Lumen cannot render anything.

2b. Proposed Solution

Render the built-in scene to a PNG on one thread with flat or normal shading.

2c. Alternatives considered and rejected

  • Read scenes from files now: rejected, because scene input comes later (S5H).

2d. Acceptance Criteria

  • A command renders the scene to a PNG file.
  • Two runs give the same image hash.
  • The PNG encoder choice is justified in writing.
  • The scene is defined in code.

Rules

Rules. Follow Bunny's Fidelity Rule (docs/topics/performance/README.md in flyingrobots/bunny): existing functions keep every output bit; new APIs ship a stated bound, an oracle test and golden vectors; core crates use integers only; no unsafe, SIMD or GPU code outside a quarantined backend crate. Run builds, tests and timing only through ~/git/devcontainers/bin/devrun (never on the host, never bind-mount). Performance claims use cargo xtask perf --rounds 11 --align-code and get a ledger entry in docs/topics/performance/README.md, including experiments that lost. Make one coherent change per PR. Do not merge without the maintainer's go-ahead.

Activity

  1. flyingrobots commented on Nov 14, 2026

    @flyingrobots
    OwnerAuthor

    Carried over from #1: the scaffold (PR #10) deliberately did not add Bunny as a pinned git dependency, because the Bunny APIs lumen needs were not merged yet. This task adds it: pin flyingrobots/bunny to a full commit SHA on its main that contains the trace kernels and closest_hit, and commit the resolved Cargo.lock.

  2. flyingrobots commented on Nov 14, 2026

    @flyingrobots
    OwnerAuthor

    Requirement from the accepted scene-profile design (flyingrobots/geordi#152, PR flyingrobots/geordi#157): the built-in reference scene must be made of triangles only (no analytic spheres or planes), so that a geordi-ray-traced-scene/1 artifact can describe exactly the same scene and #6 can check that both produce the same image hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions