question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EffectPass introduces facing problems with InstancedGeometry

See original GitHub issue

Hello!

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:closed
  • Created a year ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
vanruesccommented, Aug 31, 2022

I had to change the default depth texture type back to UnsignedIntType in postprocessing@6.28.7 because the previous switch to UnsignedInt248Type 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.

1reaction
vanruesccommented, Aug 27, 2022

With stencilBuffer set to true, the EffectComposer uses UnsignedInt248Type 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 of UnsignedIntType failing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Instanced Geometry Suggestion #13995 - mrdoob/three.js
I successfully created a ground foliage system using instanced buffer geometry. Setting up the instancing wasn't nearly as bad as I though ...
Read more >
Fluffy predator with THREE.js & instanced geometry
Fluffy predator with THREE.js & instanced geometry ... Geometry, you can access the object's faces' list where every Face object holds the ...
Read more >
Instanced Geometry - RenderMan
Instanced geometry is a reference to an original geometric master and is particularly efficient, being only a reference to the original object.
Read more >
Three.js: Handling per-instance texture offsets with instanced ...
The quads are rendered using an indexed, instanced geometry; so there are 4 vertices that define the "prototype" for all quad instances, and...
Read more >
Instanced Geometry and Texture Buffer Extensions - PyOpenGL
This tutorial: uses an instanced geometry rendering extension to draw lots of geometry; introduces the use of texture buffer objects and the texelFetch...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found