Repository navigation
An emitter's probability is what the picker used - #156
Merged
Merged
Conversation
An emitter that changed size in place kept the weight it was loaded with while the kernel's formulas assumed the weight was the triangle's: scaled three times larger as the main light it read 3 to 8 % dark. A candidate is now weighed by the density it was drawn with, and a BSDF ray's hit takes the same probability from where the picker reads it (the tree's path, or the emitter's entry in the CDF, named by its code). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
An emitter that changed size in place (a movable model or mesh scaled, a skinned one) kept the weight it was loaded with, while the kernel took its probability from formulas that assumed the weight was the triangle's. Scaled three times larger as a scene's main light it read 3 to 8 % dark, three times smaller 12 % bright. A move alone was right. The fault is older than scene step D.
What changes
sample_emitter_ris).emitter_pmf): the light tree's path, or the emitter's entry in the CDF, which its code now names (emitter_codes, written at load and after edits).Params::emit_power.Checked
an_emitter_scaled_in_place_is_lit_as_a_build_lights_it: a model and a mesh, three times larger and smaller, with and without a light tree, against a build's picture (0.06 to 0.31 steps; 2.7 to 7.3 before). The readback test also asserts that the entry an emitter's code names is its own.cargo test170 passed, test-render 241 pass.bench-ghosting,test:layer-b,bench-district(no live pass changes).🤖 Generated with Claude Code
Note
High Risk
Changes direct-light sampling and MIS in the path tracer—correctness-critical rendering logic—with live edit updates to emitter metadata.
Overview
Emitter light sampling and MIS now use the same probability the picker used at draw time, instead of recomputing density from stale CDF weights or “power alone” formulas. That fixes visibly wrong brightness when emitters change size in place (scaled movable models/meshes) while their load-time weights stay fixed.
On the GPU,
emitter_selbecomesemitter_pmf, reading the tree path or the CDF entry named byemitter_codes.emit_misandsample_emitter_risweigh candidates and BSDF hits by pick probability over the hit triangle’s actual area; separate particle nominal-area handling, hit-side emitter cull, andParams::emit_powerusage on the kernel side are removed.On the CPU,
emitter_codesis built at load and refreshed after live edits; the emitter CDF always stores positive triangle area (no negated nominal areas). Docs and tests add the roadmap note, scaled-emitter picture tests, and readback checks that each emitter’s code points at its own CDF entry.Reviewed by Cursor Bugbot for commit 8650021. Bugbot is set up for automated code reviews on this repo. Configure here.