here’s my code, super simple. trying to create some sorta frosted class effect with refractions. any idea what’s up the the ugly black in top left corner? my guess is that it’s something with the thickness value, but i can’t figure it out. the model is just a simple 2d plane with 4 vertices
any help appreciated !
function Banner() {
const groupRef = useRef();
const lightRef = useRef();
const scroll = useScroll();
const texture = useTexture(ice);
texture.repeat.set(3,3);
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
texture.offset = new THREE.Vector2(0.5, 0.5);
const {nodes} = useLoader(GLTFLoader, bannerBG);
const rawMouse = useMousePosition();
useFrame(() => {
var mouse = new THREE.Vector2(
rawMouse.x - window.innerWidth / 2,
rawMouse.y - window.innerHeight / 2,
);
var y = scroll.range(0 / 2, 1 / 2) * 5;
groupRef.current.position.set(
groupRef.current.position.x,
y,
groupRef.current.position.z,
);
lightRef.current.position.set(mouse.x / 100, -mouse.y / 100, 5);
});
return (
<group ref={groupRef}>
<mesh position={[0, 0, -10]} scale={[100, 100, 100]}>
<planeGeometry attach="geometry" args={[1, 1, 1]} />
<meshPhysicalMaterial attach="material" color="rgb(0, 0, 0)" />
</mesh>
<mesh
geometry={nodes.Plane.geometry}
position={[0, 0, 2]}
rotation={[Math.PI / 2, 0, 0]}
scale={[1, 1, 1]}
>
<BackgroundParticles />
<meshPhysicalMaterial
normalMap={texture}
attach="material"
transmission={1}
metalness={0.0}
roughness={0.0}
opacity={1}
ior={1.5}
thickness={0.1}
color="white"
/>
</mesh>
<pointLight ref={lightRef} intensity={111} />
</group>
);
}