EffectPass introduces facing problems with InstancedGeometry
See original GitHub issueHello!
I premise that I have not yet been able to reproduce the bug on a codesandbox because the model I am using is in a special format and I have to ask the client I am working for to export a gltf one. As soon as I can I’ll do that, in the meantime I’ll expose the problem I’m experiencing, maybe we don’t even need the demo.
I am using a simple pipeline with RenderPass + EffectPass[BloomEffect]
, to render a lowpoly model as shown in the attached image.
Basically it is a model of a rock made up of several pieces, to which I will then have to apply an animation for the explosion (I think this info is not very relevant)
This model must be reproduced several times, so I am using an InstancedBufferGeometry
.
The bug consists of a strange rendering of the mesh faces, in particular these strange artefacts increase as the distance from the camera increases. as shown in the figure.
In particular the problem only occurs when I use the EffectPass
, even when it has no effect and is therefore “empty”.
If I only use RenderPass instead, there is no problem whatsoever
I am already aware of the possible problems with InstancedBufferGeometry
and the use of the OverrideMaterialManager
, but using only the BloomEffect
should not be the case, right? (in any case the bug exists even with workaroundEnabled
)
I don’t seem to be doing strange things at the code level
OverrideMaterialManager.workaroundEnabled = true;
...
const renderer = new THREE.WebGLRenderer({ canvas: this.canvas, context: this.gl, powerPreference: 'high-performance', antialias: false, stencil: false, depth: false });
...
this.composer = new EffectComposer(this.renderer, {
frameBufferType: THREE.HalfFloatType,
multisampling: 8,
});
this.renderPass = new RenderPass(this.scene, this.camera);
this.composer.addPass(this.renderPass);
this.bloomEfx = new BloomEffect({
mipmapBlur: true,
});
this.effectPass = new EffectPass(this.camera, this.bloomEfx);
this.composer.addPass(this.effectPass);
The doubt came to me that this is a model-related problem. But then I cannot explain the different behaviour with and without EffectPass.
Library versions used
- Three: ^0.143.0
- Post Processing: ^6.28.5
Thank you!
Issue Analytics
- State:
- Created a year ago
- Comments:10 (10 by maintainers)
Top GitHub Comments
I had to change the default depth texture type back to
UnsignedIntType
inpostprocessing@6.28.7
because the previous switch toUnsignedInt248Type
caused another issue with multisampling due to a missing stencil buffer.I recommend enabling
stencilBuffer
explicitly if you require at least 24 bits of depth precision on any device. Otherwise try to tune your camera near/far plane settings to still produce satisfactory results with lower precision if possible.With
stencilBuffer
set totrue
, theEffectComposer
usesUnsignedInt248Type
instead for the depth texture which absolutely has to be supported by all devices. I’m considering using that as the new default now that there’s actually a reported case ofUnsignedIntType
failing.