react-three-gpu-pathtracer
react-three-gpu-pathtracer copied to clipboard
Can't add lights to pathtracing scene
I'm trying to figure out how to insert lights within a pathtracing generated scene. Link to the relevant codesanbox:
https://codesandbox.io/s/react-three-gpu-pathtracer-forked-g2l8l2?file=/src/App.js
In this example, I added a red RectAreaLight within lines 116-131. I copied the methods that were mentioned on one of the repo issues: https://github.com/pmndrs/react-three-gpu-pathtracer/issues/4 https://codesandbox.io/s/react-three-gpu-pathttracer-gltf-lights-3t7bqu?file=/src/App.js
But with no luck. As you can see, the light only appears when you move the OrbitControls within the codesanbox, since that shows the normal render of the scene. When the pathtracing render is enabled (when you do not move the OrbitControls for half a second), the light dissapears. I want the light to also be visible whenever pathtracing is enabled, as in this example from the original pathtracing library, on vanilla Three.js. https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/spotLights.html
Here, the light is visible on both modes.
After trying for a while, I figured that DirectionalLight is working. How is that? I can't get SpotLight or PointLight to work with this.
Pretty sure this is an issue upsteam and only supported with Multiple Importance Sampling : https://github.com/gkjohnson/three-gpu-pathtracer?tab=readme-ov-file#gotchas
This is an upstream issue . Please try suggestion by Dennis and re-open if it persists.