iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.11k stars 303 forks source link

Instanced 3D Tiles - Start Animation? #2428

Open bertt opened 1 month ago

bertt commented 1 month ago

Hi, how can I start an animation on Instanced 3D Tiles containing a windmill (blades are animated), sample https://www.itowns-project.org/itowns/examples/3dtiles_loader.html?tileset=https://bertt.github.io/cesium_issues/i3dm_animating/issue/tileset.json

image

On Cesium it works see https://bertt.github.io/cesium_issues/i3dm_animating/issue/

animated_windmill

AnthonyGlt commented 1 month ago

Apparently, we don't have any code to run the animations. They are accessible though. It looks like we are losing the name of the mesh when we are creating the instances from 3dtilesrenderer. So the animations can't hook to the mesh. Also, I've tried to make this animation works on iTowns, without success (from your issue) So some modif should be done in the external lib but also in iTowns

I've tried to use this to update the mixer:


  view.render = function render() {
                if(mixer){
                    mixer.update(clock.getDelta())

                }
                var g = view.mainLoop.gfxEngine;

                g.renderView(view);

};
Desplandis commented 1 month ago

I had some doubts with the fact that AnimationMixer indeed supported instanced meshes, but it seems I was wrong! I managed to make it working in three with a simplified loader for the windmill glb file (i.e. GLTFLoader + traversal of the scene to convert each mesh to instanced meshes).

We have some work to do to make it working in itowns:

P.S.: I'm on holidays until the first week of november, I will tackle this issue when I'm back!

yhzcode commented 2 weeks ago

@Desplandis I'm also looking forward to solving this problem