gkjohnson / three-gpu-pathtracer

Path tracing renderer and utilities for three.js built on top of three-mesh-bvh.
https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/index.html
MIT License
1.35k stars 133 forks source link

Shadow / Reflection catcher material #443

Open romarybi opened 1 year ago

romarybi commented 1 year ago

I am willing to put $200 towards a PR that implements this feature.

Feature Request

Shadow catcher is an important feature that is present in most renderers. It is also implemented in the three.js library as ShadowMaterial. I propose also adding such material to this library.

Implementation

I am not an expert in GLSL but the solution that I thought would work is creating a second renderTarget on which a grayscale shadow map is rendered and then multiplying it with the beauty render target. I'm not sure if this is the best practice for this library. Here is a good thread that I found useful when researching this issue thread.

An overview of how the shadow material should work:

Reflection property:

nikkuv commented 2 months ago

@romarybi Hey I'm willing to give it a try.