The problem is scene.removeMesh(ground, true);
. If a mesh is removed from a scene it won’t be handled correctly afterwards.
If you want the ground to appear only in the RTT and not in the regular scene, you can create an additional camera, set a layerMask
so that the ground will only render through that camera and use it for the RTT rendering:
Cameras should not be cloned because they always use the same camera.
Also don’t add rtt to the scene for extra (necessary additional rendering loops)
scene.customRenderTargets.push(renderTarget)
Is there any other way to handle this? I just need normal lighting.
Can I assign lights to rtt?
Can I assign lights to the mesh?
You can’t assign lights to RTT but you can exclude/include meshes to a light with light.excludedMeshes
/ light.includedOnlyMeshes
.
Thanks a lot for your answer.
But haven’t got the desired result yet.
If you want to keep the scene.removeMesh
call you will need to resync the light sources yourself by calling ground._resyncLightSources();
after you created the light:
Thank you very much. This is the answer I want