Skip to content

Problem with using InstancedMesh, non-instanced meshes and SSAO together #19566

@threedian

Description

@threedian
Description of the problem

Hi - I'm working in a react-three-fiber project but I can reproduce the issue in threejs standalone.

Context: I have a scene with many objects loaded in via gltfLoader, some of which are instanced and some of which aren't. A background environment model, non-instanced, and lots of smaller objects instanced many times. It all works fine until I try to add ambient occlusion. If I just have the background model it works, and similarly if I only have instanced meshes and no background model it also works. It's the combination of the two where it fails with:

Uncaught TypeError: Cannot read property 'isInterleavedBufferAttribute' of undefined
    at Object.get (three.module.js:10446)
    at setupVertexAttributes (three.module.js:17652)
    at WebGLRenderer.renderBufferDirect (three.module.js:17538)
    at renderObject (three.module.js:17976)
    at renderObjects (three.module.js:17957)
    at WebGLRenderer.render (three.module.js:17830)
    at SSAOPass.renderOverride (SSAOPass.js:231)
    at SSAOPass.render (SSAOPass.js:142)
    at EffectComposer.render (EffectComposer.js:91)
    at Object.current (Effects.js:22)
    at web.js:81
    at Array.forEach (<anonymous>)
    at renderGl (web.js:81)
    at web.js:100
    at Map.forEach (<anonymous>)
    at renderLoop (web.js:97)

I can reproduce the error (I took the dynamic instancedmesh example and added two boxes and ambient occlusion) :
https://jsfiddle.net/threedian/kLve6f1g/12/

Some other info/observations:

Appreciate any advice or nudges in the right direction

Thanks!

Three.js version
  • Dev
  • r115
  • r117
Browser
  • All of them
  • Chrome
  • Firefox (untested)
  • Internet Explorer (untested)
OS
  • All of them
  • Windows
  • macOS (untested)
  • Linux (untested)
  • Android (untested)
  • iOS (untested)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions