Repository navigation
Add a per-light bounce limit like Cycles' light max_bounces - #67
Merged
Merged
Conversation
…/crucible#2015) A light input may carry maxBounces (0 to 254). The packer stores it as limit + 1 in bits 8 to 15 of LightRecord.flags; 0 keeps today's behaviour, so older inputs render the same and the record size does not change. The kernel adds a limited light's direct light, and its MIS hit from a bounced ray, only at path vertices 0..limit, so the sample and the hit share one rule. Tests: a pack test (no GPU) pins the bits, the default and the refusal of bad values; a trace test for a GPU runner pins the kernel on a wall that only the floor bounce lights. Not run here: the kernel was not compiled or traced on this machine.
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.
Part of codepawl/crucible#2015. Crucible moves its pin to this commit in its own pull request.
A light input may carry
maxBounces(0 to 254), the equivalent of a Cycles light'smax_bounces. The Classroom sun (limit 2) is 1.6 times too bright in Crucible only because Cook runs every light to the scene limit (codepawl/crucible#2013).Design
LightRecord.flagsholdlimit + 1; 0 means no limit beyond the scene's. No new field and no change in record size, and an input packed before this reads as no limit, soPACK_REVISIONstays. Documented in FORMAT-v2.md section 6.0..limit. The light sample (surface, tree and volume paths) reads the current vertex; a bounced ray that reaches a light reads the vertex that cast it, so the sample and the hit of one MIS pair pass the same test. Camera rays are not limited.maxBouncesfrom them (the path Crucible's render jobs take).lights.sun,points[],spots[]andareas[]takemaxBounces; anything but a whole number from 0 to 254 throws a RangeError that says what to pass.How I checked it
node --test tests/light-bounce-limit.test.mjs-> 3 pass; withpack-input-v2.mjsreverted to main, 2 of the 3 fail.tests/light-bounce-limit-v1.test.mjs-> 2 pass (v1 sun slot, upgrade). Alltests/*.test.mjs-> 185 pass; earlier 2 fail (bits not written, bad values not refused).node --teston js-surface-validation, legacy-kernel-pack, shadow-ray-pick, test-discovery, pack-revision, shading-parity -> 47 pass.tests/gpu/light-bounce-limit.test.mjs(a sun of limit 0 leaves a wall that only the floor bounce lights dark; limit 1 lights it; limit 254 equals no limit) skips here. This machine has no GPU budget; the lavapipe job compiles the kernel and traces the room fixture.Evidence
Nothing to show for the default: a light without
maxBouncespacks the same bits as before.