gpt4 book ai didi

javascript - 三.js错误: "Feedback loop formed between Framebuffer and active Texture" - Rendering Reflections

转载 作者:行者123 更新时间:2023-12-05 03:36:03 24 4
gpt4 key购买 nike

我正在使用 CubeCameraWebGLCubeRenderTarget渲染出类似于此处示例的周围反射 - 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 自行渲染。

关于javascript - 三.js错误: "Feedback loop formed between Framebuffer and active Texture" - Rendering Reflections,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69710407/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com