1
$\begingroup$

I am currently experiencing an issue of having my blender model disappear in three.js. What happens is that the model will load and it will be visible until I go above or below the origin I had set for the armature inside Blender. I have tried recreating the model and what I have found is that bones that were disconnected but maintained the same parent as connected bones were the ones that would disappear in three.js if the parent bone was not in the same camera view. This is what it looks like in three.js.

$\endgroup$

1 Answer 1

1
$\begingroup$

The model is probably being culled incorrectly, when the renderer believes it may be offscreen. You can disable that entirely...

model.traverse((object) => {
  if (object.isMesh) object.frustumCulled = false;
});

... although you'll lose the performance benefit of not rendering the object when it's offscreen. An alternative is to manually increase the size of the bounding box:

model.traverse((object) => {
  if (object.isMesh) {
    object.geometry.computeBoundingBox();
    object.geometry.boundingBox.expandByScalar(2);
  }
});

The root of the issue is that the skinning animation happens on the GPU, and the renderer needs to cull objects that aren't visible before drawing them on the GPU. So the animation isn't taken into account in that process currently. Sometimes the skinning data changes the scale of the object, not just its pose, which would exacerbate the problem. More details in https://discourse.threejs.org/t/object-bounds-not-updated-with-animation/3749.

threejs r116

$\endgroup$
1
  • $\begingroup$ Thank you so much. $\endgroup$ May 18, 2020 at 9:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .