diff --git a/components/canvas/GlassModels.tsx b/components/canvas/GlassModels.tsx index 217a570..d994961 100644 --- a/components/canvas/GlassModels.tsx +++ b/components/canvas/GlassModels.tsx @@ -404,11 +404,18 @@ function GlassModel({ return merged; }, [gltf]); - // Glass renders on layers 0+10: visible in the main pass, excluded from the - // layer-0-mask FBO pass that feeds the refraction texture (no self-refraction). + // Glass renders ONLY on layer 10: the FBO refraction pass forces the camera + // mask to layer 0, so the glass mesh is excluded from its own refraction + // texture (an object with layer 0 kept enabled would pass the mask test and + // draw into the FBO it samples — a GL feedback loop, GL_INVALID_OPERATION + // every frame). The main camera enables layer 10 below, so glass stays + // visible in the normal pass. Matches the original GlassSystem. useEffect(() => { - meshLayerRef.current?.layers.enable(10); - }, [mergedGeometry]); + const mesh = meshLayerRef.current; + if (!mesh) return; + mesh.layers.set(10); + camera.layers.enable(10); + }, [mergedGeometry, camera]); const tintYRange = useMemo<[number, number]>(() => { if (!mergedGeometry) return [0, 1];