Hi all. I’m trying to figure out how to insert lights within a pathtracing generated scene. Link to the relevant codesanbox:
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:
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.
Edit: I do not know much about the topic, but I see this example is using IESLoader, is it required to load any light into the scene? As far as I understand, it is optional to load any IESProfile, but you can make lights show in a pathtraced scene without the need to use IESLoader, right?
That codesandbox example is taken straight from the react-three-gpu-pathtracer repo, so it is the oficial one:
As you can see, the basic example is the same I’m using. No tweaks from my end have been applied other than re-adding the lights just like this post said to do:
When it comes to the original pathtracing library, I actually went with this example since the light that is most useful to me is the SpotLight, while it is also supported (or so does this example demostrate):
I cloned the repo and commented out code to see what would give me the same result as the one I’m experiencing in the codesandbox. I see that, disabling multiImportanceSampling;
or disabling the updating of the pathtracing material with lights:
ptRenderer.material.lights.updateFrom( lights );
Are both giving me the result I get on my codesandbox example. I did however check if they were being applied on the react-three-gpu-pathtracing example and they are indeed being applied. So I really do not know how to proceed from here.
Any help or guidance on what I might be doing wrong is greatly appreciated.
After an entire morning of trying to figure it out, I discovered that it works with DirectionalLight without any additional tweaks required. But it is not working for PointLight or SpotLight (the other 2 ones that I need it to work with.)