Three.js Error: "Feedback loop formed between Framebuffer and active Texture" - Rendering Reflections
Three.js Error: "Feedback loop formed between Framebuffer and active Texture" - Rendering Reflections
我正在使用 CubeCamera with WebGLCubeRenderTarget to render out the surrounding reflection similar to the example here - https://threejs.org/examples/#webgl_materials_cubemap_dynamic
但是这个例子一直报错:
[.WebGL-000052760009C700] GL_INVALID_OPERATION: 在帧缓冲区和活动纹理之间形成反馈回路。
有人看到这个问题吗?
我的代码:
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()
修复:
我需要添加
meshGLB.visible = false;
cubeCamera1.update( renderer, scene );
meshGLB.visible = true;
在我的 animate()
中防止 material 自行渲染。
我正在使用 CubeCamera with WebGLCubeRenderTarget to render out the surrounding reflection similar to the example here - https://threejs.org/examples/#webgl_materials_cubemap_dynamic
但是这个例子一直报错:
[.WebGL-000052760009C700] GL_INVALID_OPERATION: 在帧缓冲区和活动纹理之间形成反馈回路。
有人看到这个问题吗?
我的代码:
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()
修复: 我需要添加
meshGLB.visible = false;
cubeCamera1.update( renderer, scene );
meshGLB.visible = true;
在我的 animate()
中防止 material 自行渲染。