Skip to content

Carry the camera near distance through the v1 upgrade (crucible#1159) - #60

Merged
anxuanng merged 1 commit into
mainfrom
1159-v1-camera-near
Nov 16, 2026
Merged

anxuanng merged 1 commit into
mainfrom
1159-v1-camera-near

Conversation

@anxuanng

Copy link
Copy Markdown
Contributor

Part of codepawl/crucible#1159.

What

The cycles kernel already starts camera rays at camera_near (FORMAT-v2 word 124, camera.wgsl t_min = near / cos_forward), and the instanced route fills it from camera.near. A flattened job goes through the v1 tables and the upgrade, which carried no near distance, so the kernel always got 0. This writes camera.near into v1 parameter word 62 (free, 0 when unset) and the upgrade reads it back into the camera, so camera_near is set. No kernel, struct or buffer size changes (KernelParamsV2 stays 336 bytes, the v1 block stays 256). A camera without near packs the same bytes as before; the legacy kernel ignores the word.

How I checked it

  • node --test in the checkout: 196 tests, 196 pass (new test: a camera near distance is written to parameter word 62 and a camera without one leaves it 0).
  • node tools/run-cargo-tests.mjs: Rust tests ran, no failure (Rust is unchanged).
  • End to end with the addon built from this branch (node build.mjs): a crucible test traces a glowing green wall 0.5 m ahead of a red wall 3 m ahead. Centre pixel without clipStart is green, with clipStart 1 it is red, with clipStart 0.2 it is green again. Before this change the clipStart 1 pixel stayed green (0,1,0).

Evidence

Numbers above; there is no picture to show for a parameter word.

@anxuanng
anxuanng merged commit 9561416 into main Nov 16, 2026
5 checks passed
@anxuanng
anxuanng deleted the 1159-v1-camera-near branch November 16, 2026 22:36
@anxuanng anxuanng mentioned this pull request Nov 17, 2026
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