I'm using a CubeCamera with WebGLCubeRenderTarget to render out the surrounding reflection similar to the example here - https://threejs.org/examples/#webgl_materials_cubemap_dynamic
But the example keeps giving this error:
[.WebGL-000052760009C700] GL_INVALID_OPERATION: Feedback loop formed between Framebuffer and active Texture.
Anyone see the issue?
My Code:
const reflection=()=> {
renderer.outputEncoding = THREE.sRGBEncoding; // for post processing pass
cubeRenderTarget1 = new THREE.WebGLCubeRenderTarget( 256, {
format: THREE.RGBFormat,
generateMipmaps: true,
minFilter: THREE.LinearMipmapLinearFilter,
encoding: THREE.sRGBEncoding // prevents the material's shader from recompiling every frame
} );
cubeCamera1 = new THREE.CubeCamera( .01, 10, cubeRenderTarget1 );
cubeCamera1.position.z = 3
cubeCamera1.position.y = -4
reflectionMaterial = new THREE.MeshBasicMaterial( {
envMap: cubeRenderTarget1.texture,
color: 0x011111,
} );
}
reflection()
gltfLoader.load(
'/exportPackages/sceneMaya.glb',
(gltf) =>
{
let meshGLB= gltf.scene.children.find(child => child.name === 'mesh_0')
meshGLB.material = reflectionMaterial
scene.add(gltf.scene)
})
const animate =()=> {
cubeCamera1.update( renderer, scene ); }; animate()
The Fix: I needed to add
meshGLB.visible = false;
cubeCamera1.update( renderer, scene );
meshGLB.visible = true;
in my animate() to keep the material from rendering itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With