Describe the bug
- An err is thrown when i call
render()
onEffectComposer{}
which is added aSSRPass
. - The err only occurs when my scene contains both
Mesh
s andInstancedMesh
s.
To Reproduce
Steps to reproduce the behavior:
- add 1 instanced mesh and 1 regular mesh to then scene
- make an effect composer; add a RenderPass .. followed by a SSRPass.
- call
composer.render()
in animation loop. - bring up devtools, it shows
Uncaught TypeError: can’t access property “isInterleavedBufferAttribute”, attribute is undefined
stacktrace:
get https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.module.js:12445
setupVertexAttributes https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.module.js:14100
setup https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.module.js:13770
renderBufferDirect https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.module.js:23733
renderObject https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.module.js:24269
renderObjects https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.module.js:24242
render https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.module.js:24025
renderOverride https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/examples/jsm/postprocessing/SSRPass.js:577
render https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/examples/jsm/postprocessing/SSRPass.js:396
render https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/examples/jsm/postprocessing/EffectComposer.js:150
<anonymous> https://fiddle.jshell.net/_display/?editor_console=true:196
onAnimationFrame https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.module.js:23897
onAnimationFrame https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.module.js:12286
start https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.module.js:12299
setAnimationLoop https://cdn.jsdelivr.net/gh/mrdoob/three.js@dev/build/three.module.js:23911
<anonymous> https://fiddle.jshell.net/_display/?editor_console=true:195
Live example
- jsfiddle (see devtools console for the err)
Expected behavior
it should render a box and two spheres .. w/ reflection on their surfaces.
Platform:
- Device: [Desktop]
- OS: [Windows]
- Browser: [Firefox]
- Three.js version: [dev]
Thanks.
Probably a duplicate of #18533.
Yeah, I also found in this non-composer scene https://jsfiddle.net/gonnavis/hjgdrfv5/2/ , the instancedMeshes (two spheres) which probably caused this problem are rendered, but the ordinary mesh (the cube) not rendered. So it should be the error throwed in instancedMesh blocked the subsequent ordinary mesh render.
After swap the creation in this non-composer scene https://jsfiddle.net/gonnavis/hjgdrfv5/5/ , I see one ordinary mesh and one instance rendered ( should be the first instance rendered ). So the normal infos still not all correct, this is why in https://jsfiddle.net/trch4517/ just one sphere has reflection.
Okay, in this case I mark this issue as a duplicate of #18533 since it’s the same cause (and the same generic solution is required).
@ycw @Mugen87 The main problem may because of instancedMesh and regular mesh can’t share same material now.
One obvious low-performance workaround is, at here
three.js/examples/jsm/postprocessing/SSRPass.js
Line 256
in
c21b290
insert
and replace these codes
three.js/examples/jsm/postprocessing/SSRPass.js
Lines 576 to 578
in
c21b290
with
then it works well. If do some type check, just create two

MeshNormalMaterial
s for instanced or regular mesh seperately, would be better.But the fundamental problem seems too in-depth for me to solve~~
If it’s only about material sharing, #20135 should fix it.
In any event, we should not start to add fixes per pass. The renderer should handle this internally.
@gonnavis @Mugen87 @mrdoob i tried to merge #20135 ( w/ few bugfixes ) to r126 dev and .. it works!
https://jsfiddle.net/m7bcex6s/1/
thanks.