I have converted the MD2 code from the library to use THREE.BufferGeometry
instead of THREE.Geometry
to vastly improve memory footprint. To do this I just convert the model to THREE.BufferGeometry
after it is done loading. I also had to modify the MorphBlendMesh
code to use attributes for the morphTargetInfluences
.
This is working great except for issue: the shadows don't update during animation, it always uses the shadow from the first frame of the animation.
I haven't seen any documentation on morphTargetInfluences
attributes, so I don't have much to go on.
I can't really post the code since it is too much spread out across the code base.
I am just hoping that someone out there might have some insight as to how shadows get updated during morph animation, and maybe point me in the right direction on how to research this issue.
I have found the problem, and a workaround!
The code in the shader renderer is checking to see if
geometry.morphTargets
has a non-zero length before it decides to set the'usemorphing'
flag. The converted buffergeometry does not have a.morphTargets
field since this information appears to have moved to.morphAttributes
for buffergeometries.My hack workaround is to add a fake
.morphTarget
list like so: