Skip to content

Add eForth raytracer showcase - #17

Merged
jserv merged 1 commit into
mainfrom
raytracing
Aug 3, 2026
Merged

Add eForth raytracer showcase#17
jserv merged 1 commit into
mainfrom
raytracing

Conversation

@jserv

@jserv jserv commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

tests/raytracer.fth runs on the baked 32-bit eForth and raytraces two spheres over a checkerboard with shadow rays and half-Lambert + Phong shading, streaming one deterministic 64x32 RGB888 PNG to stdout via the svpng stored-block technique (quadratic ray-sphere intersection, a bitwise isqrt, CRC32 from a 16-entry nibble table, Adler32, one uncompressed DEFLATE block per scanline). The substrate is the unmodified build/muxleq driven by stdin: no VM, CLI, or MMIO change.

Arithmetic is integer-only 16.16 fixed point (rescaled x256 from nand2raytrace's 8.8), so the output is byte-stable across runs and machines. It is also portable across Forth implementations: the same source runs on gforth and emits the identical 6399-byte PNG. The CRC folds are masked to 32 bits (a no-op on muxleq's 32-bit cell) and the prompt/warning setup lines are guarded with defined ... [if] so gforth skips what it lacks.

The golden-raytracer target byte-compares the render against tests/expected/raytracer.png. It stays standalone rather than in the fast check gate, since one frame is a few minutes of pure-eForth interpretation.


Summary by cubic

Adds a deterministic eForth raytracer showcase and a golden-raytracer Makefile target that verifies the PNG output byte‑for‑byte. It renders a 64x32 RGB888 frame to stdout using the unmodified build/muxleq interpreter.

  • New Features
    • New test tests/raytracer.fth: 16.16 fixed‑point raytracer (two spheres, checkerboard, shadows, half‑Lambert + Phong).
    • Portable and byte‑stable: identical PNG on build/muxleq and gforth.
    • Makefile: adds golden-raytracer (respects RAYTRACE_TIMEOUT, default 600s; warns if no timeout) that byte‑compares against tests/expected/raytracer.png; excluded from check due to multi‑minute runtime.
    • No VM/CLI/MMIO changes.

Written for commit 0227c87. Summary will update on new commits.

Review in cubic

tests/raytracer.fth runs on the baked 32-bit eForth and raytraces two
spheres over a checkerboard with shadow rays and half-Lambert + Phong
shading, streaming one deterministic 64x32 RGB888 PNG to stdout via the
svpng stored-block technique (quadratic ray-sphere intersection, a
bitwise isqrt, CRC32 from a 16-entry nibble table, Adler32, one
uncompressed DEFLATE block per scanline). The substrate is the
unmodified build/muxleq driven by stdin: no VM, CLI, or MMIO change.

Arithmetic is integer-only 16.16 fixed point (rescaled x256 from
nand2raytrace's 8.8), so the output is byte-stable across runs and
machines. It is also portable across Forth implementations: the same
source runs on gforth and emits the identical 6399-byte PNG. The CRC
folds are masked to 32 bits (a no-op on muxleq's 32-bit cell) and the
prompt/warning setup lines are guarded with `defined ... [if]` so gforth
skips what it lacks.

The golden-raytracer target byte-compares the render against
tests/expected/raytracer.png. It stays standalone rather than in the
fast check gate, since one frame is a few minutes of pure-eForth
interpretation.
@jserv
jserv merged commit 626ddeb into main Aug 3, 2026
11 checks passed
@jserv
jserv deleted the raytracing branch August 3, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant