-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAOPass: Wrong behavior when using two canvases #13370
Comments
The problem is that the shader material in this.saoMaterial = new THREE.ShaderMaterial( {
defines: THREE.SAOShader.defines,
fragmentShader: THREE.SAOShader.fragmentShader,
vertexShader: THREE.SAOShader.vertexShader,
uniforms: THREE.UniformsUtils.clone( THREE.SAOShader.uniforms ) // fix
} ); Demo: https://jsfiddle.net/ptgwhemb/25/ It's also necessary to clone the |
@cnspaha Do you wanna make a PR with the fix? 😇 |
@Mugen87 |
Do we really need this line in the SAOPass.js? this.saoMaterial.extensions.drawBuffers = true; As far as I could check we don't use MRT so why add the drawBuffers Extension? Beside that there is almost no support for it (at least on mobile devices) |
PR Done |
Not sure about that but it seems obsolete. |
@Ludobaka |
Actually, my contribution was an update of a former contribution that hadn't been merged with ThreeJS. So my job was mainly to update the code to fit ThreeJS version at this time. It could be a copy/paste error from this previous work. If there is no need for drawBuffers, do not hesitate to remove it. |
Ah okay. |
Since we don't use MRT there is no need for using the WEBGL_draw_buffers extension. check mrdoob#13370
Description of the problem
When using SAOPass in several canvas it won't work, see jsfiddle.
https://jsfiddle.net/ptgwhemb/6/ (I just copied the initializing code so its rather nasty but does its job ;) )
What I expect:
A green cube with SAO on the first canvas and a red cube with SAO on the second canvas.
What I get:
Only a red cube with SAO on the second canvas.
Possible reasons:
After some debugging I found out, that, for both canvases, in the SAOPass render function the texture uniforms of the materials are pointing to the same texture even though their member renderTargets and their textures are fine.
So in this case the first WebGLRenderer tries to access a texture which isn't in its context but in the other WebGL Context.
With spector.js I could verify that, on the first canvas, the texture uniforms
tDepth
andtNormal
of the saomaterial referencing to an empty texture withwidth=height=1
and the uuid of them is the same as the textures from the second canvas...I don't know three.js internally good enough to know why this is happening, but probably some of you guys know where this bug comes from?
Three.js version
Browser
OS
The text was updated successfully, but these errors were encountered: