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.
Hi,
This is the proof of concept of shadow catcher feature. This code relies on specific object naming, just to show how the feature might work.
There's no special shader or any other way to mark an object as a shadow catcher except specific name, which is "Box001_sc_inst" instance name.
How it basically works is it gathers two additional values from all light sampling functions - one is the light value before
transmission
parameter is applied, and another is the light value after tranmission but and without object's material contribution. Having these two values allows us to calculate shadow "intensity" and affect alpha channel accordingly. Also shadow catcher object is shaded with environment color multiplied by shadow value.I tried to replicate Ospray approach: https://github.com/ospray/ospray/blob/7c01f46bb9ee9f7ebcb95e116bffd39d23f5a2f3/ospray/render/pathtracer/ShadowCatcher.ispc#L80
PR contains test scene and some images in
/sandbox/tests/shadow_catcher/
folder. The most recent scene istest_shadow_catcher.appleseed
, it contains reflective and refractive materials. To see the box object in a normal way just rename the instance to something else.Only one lighting engine is modified and it's Path Tracing lighting engine and
PathVisitorNextEventEstimation
visitor.I'm not sure how to dedicate an object to be a shadow catcher. Easiest way would be to have a boolean value on the instance level.
Also I'm not sure about the cleanness of the approach. You might think it looks like a hack and I would agree. Please share your ideas.
Thanks for review,
Sergo.