KhronosGroup/glTF-Sample-Models

Some draco compressed models have invalid accessor count

shannon opened this issue · 0 comments

I recently ran into the issue where the number of points coming back from dracoGeometry.num_points() did not match the value specified in accessor.count.

It seems that this is considered in the spec
but some of the samples models are seemingly incorrect.

I see there is a related issue but it seems to be a bit more widespread than that one.

I discovered that the following models (glTF-Draco variants) appear to be incorrect:

  • 2CylinderEngine
  • BrainStem
  • Buggy
  • CesiumMan
  • CesiumMilkTruck
  • GearboxAssy
  • Lantern
  • Monster
  • ReciprocatingSaw
  • RiggedFigure
  • VC

The issue I ran into was that my initial array buffers were not large enough to accept all of the values from the draco decoder. This results in very strange rendering with missing normals or positions.

My code (JS/WebGL) initializes all array buffers (and typed arrays) based on the accessor and it's not really feasible to resize after the decompression.

I have created a gist that contains a breakdown of all the models and accessors where the counts don't match. As you can see, in some cases the descrepiency is rather large, in other cases the number of points returned from draco is less than the accessor count. In that case the result usually rendered ok but this means that I have much more memory allocated for the buffers than I need and wasted cycles on the draw.

Based on the discussion from #147 it seems that the exporters needed to be updated. That was quite a while ago so I don't know if it's already been done and these models just need to be updated.