在我的场景中,我有一个发光的立方体。首先,我在纹理上渲染立方体,然后应用高斯模糊后处理渲染纹理。这样,当我不在 VR 模式下时,我就能得到正确的结果。这里是 -
但是当我进入 VR 模式时,它给了我扭曲的结果。请检查以下图片 -
谁能告诉我为什么会发生?我是否必须进行任何调整才能在 VR 模式下渲染纹理?
更新:
我的代码是这样的 -
function render() {
generate_blur_texture();
effect.render(scene, camera);
}
var rtTexture = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat});
var rtTextureFinal = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat});
function generate_blur_texture() {
// i think the key point is, i am using `renderer` here instead of 'effect'
renderer.render(scene, camera, rtTexture, true);
// then further rendering on rtTexture and rtTextureFinal (ping pong) to generate blur, this time i only draw a quad to sample from the texture
// ultimately, rtTexture contains the blurred texture
}
三.js 修订:77