Hello,
I have a problem with ReflectorForSSRPass, here an example with a simple new THREE.PlaneGeometry as groundreflector, it works as expected !
Here’s another example with a custom geometry created in Blender and exported as GLB, it’s a simple Plane too.
Reflection is going wrong. What did i miss ?
Here’s my code for custom GLB geometry :
const loader = new GLTFLoader();
const glb = await loader.loadAsync('models/gltf/eshop/eshop.glb');
const glbground = await loader.loadAsync('models/gltf/eshop/eshop_groundSSR.glb');
const eshop = glb.scene;
const groundSSR = glbground.scene;
var selectSSR = [];
groundSSR.traverse((child) => {
if (child.isMesh) {
if (child.userData.reflectorSSR ) {
console.log('Adding geometry to selectSSR !', child.geometry);
selectSSR.push(child.geometry);
}
}
});
scene.add(eshop);
if (selectSSR.length === 0) {
console.log('Aucune geometrie SSR trouvee.');
}
const mergedGeometry = BufferGeometryUtils.mergeGeometries(selectSSR);
groundReflector = new ReflectorForSSRPass( mergedGeometry, {
clipBias: 0.0005,
textureWidth: window.innerWidth,
textureHeight: window.innerHeight,
color: 0x000000,
useDepthTexture: true,
} );
groundReflector.position.set( 0, 0.001, 0 );
groundReflector.material.depthWrite = false;
groundReflector.visible = paramSsr.visible;
groundReflector.fresnel = paramSsr.fresnel;
groundReflector.distanceAttenuation = paramSsr.distanceAttenuation;
groundReflector.maxDistance = paramSsr.maxDistance;
groundReflector.opacity = paramSsr.opacity;
scene.add( groundReflector );
Any suggestions would be appreciated.