Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadow catcher proof or concept #2867

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

usakhelo
Copy link
Contributor

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 is test_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.

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.

None yet

1 participant