我刚从r65切换到three.js的r68,并且在使用FXAA后处理着色器时我在浏览器控制台中收到此错误:
THREE.WebGLProgram:gl.getProgramInfoLog()警告:片段着色器无法读取顶点着色器'vUv'的输出... three.js:25545
我用r65尝试了相同的代码,但没有发生错误。 Shader似乎工作正常,但我不喜欢在控制台中出错。以下是相关代码:
// COMPOSER
this.renderTargetScene = new THREE.WebGLRenderTarget( this.width, this.height );
this.renderTargetScene.minFilter = THREE.LinearFilter;
this.renderTargetScene.magFilter = THREE.LinearFilter;
this.renderTargetScene.format = THREE.RGBAFormat;
this.renderTargetScene.stencilBuffer = true;
this.sceneComposer = new THREE.EffectComposer( this.renderer, this.renderTargetScene );
this.sceneCubeUnderPass = new THREE.RenderPass( this.sceneCube, this.cameraCube );
this.sceneCubeUnderPass.renderToScreen = false;
this.scenePass = new THREE.RenderPass( this.scene, this.camera );
this.scenePass.renderToScreen = false;
this.scenePass.clear = false;
this.effectFXAA = new THREE.ShaderPass( THREE.FXAAShader );
this.effectFXAA.uniforms.resolution.value = new THREE.Vector2( 1 / window.innerWidth, 1 / window.innerHeight );
this.effectCopy = new THREE.ShaderPass( THREE.CopyShader );
this.effectCopy.renderToScreen = true;
this.sceneComposer.addPass( this.sceneCubeUnderPass );
this.sceneComposer.addPass( this.scenePass );
this.sceneComposer.addPass( this.effectFXAA );
this.sceneComposer.addPass( this.effectCopy );
onWindowResize: function() {
this.width = window.innerWidth;
this.height = window.innerHeight;
iss.windowHalfX = this.width / 2;
iss.windowHalfY = this.height / 2;
iss.camera.aspect = this.width / this.height;
iss.camera.updateProjectionMatrix();
iss.cameraCube.aspect = this.width / this.height;
iss.cameraCube.updateProjectionMatrix();
iss.renderer.setSize( this.width, this.height );
iss.effectFXAA.uniforms[ 'resolution' ].value.set(1 / ( this.width ), 1 / ( this.height ));
iss.sceneComposer.setSize( this.width, this.height );
},
render: function(){
var timer = -0.0002 * Date.now();
iss.cameraCube.rotation.copy( iss.camera.rotation );
iss.sceneComposer.render( 0.1 );
},
任何帮助都将不胜感激。
答案 0 :(得分:1)
这只是一个警告。
您可以通过修改examples/js/shaders/FXAAShader.js
并删除所有引用vUv
的行来修复它,因为不使用该变量。
three.js r.68