Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THREE.SkinnedMesh loading support to dev2 #78

Open
antont opened this issue Sep 11, 2015 · 2 comments
Open

THREE.SkinnedMesh loading support to dev2 #78

antont opened this issue Sep 11, 2015 · 2 comments

Comments

@antont
Copy link
Member

antont commented Sep 11, 2015

I think we should support skinned skeletal animated meshes out of the box.

In Ogre-Tundra EC_Mesh supports them so that there is a separate skeleton ref attribute which makes sense as Ogre's skel anims are in separate files.

With Three.js however the skeleton and animations are in the same JSON with the geom. But different code is needed to handle them: static meshes with plain Mesh and animated with SkinnedMesh.

In WebTundra 1.0 (master now) the EC_Mesh implementation supports that by detecting whether the geometry has bones or not, and chooses Mesh or SkinnedMesh based on that. That code is in: https://github.com/realXtend/WebTundra/blob/master/src/view/ThreeView.js#L286

I propose the same for 2.x (in dev2 now). I think the place to port that bones check code is: https://github.com/realXtend/WebTundra/blob/dev2/src/view/threejs/asset/ThreeJsonAsset.js#L147

Interestingly the clone() method there already has this kind of check: https://github.com/realXtend/WebTundra/blob/dev2/src/view/threejs/asset/ThreeJsonAsset.js#L110

I wonder when that hits if the loading code never creates SkinnedMesh?

Made a test case for this first using the deer from lvm / chesapeake bay:
source: https://github.com/playsign/webtundra-deer
demo: http://playsign.github.io/webtundra-deer/

The code there is simply:
var deer = this._createMesh("Deer", "webtundra://White_Tailed_Deer_all.json");

Now it shows both without skinning and for some reason also without the correct materials (with col and spec map textures).

The desired result with using Three.js SkinnedMesh directly is:
demo: https://antont.github.io/three.js/examples/webgl_animation_skinning-deer.html
code: https://github.com/antont/three.js/blob/example_skinning_deer/examples/webgl_animation_skinning-deer.html#L91

So unless there are objections I'll give a shot at modifying ThreeJsonAsset.js to do the same automatically (apart from starting the anim).

@jonnenauha
Copy link
Member

We will be porting our skeleton stuff at some point. Dunno if we can get that into the first release though. We also need to make sure the ludocraft avatar stuff will work with this system and the new EC_Avatar and the appearance system.

@antont
Copy link
Member Author

antont commented Sep 12, 2015

is that skeleton code somehow relevant when using the builtin three.js skeleton biz?

i think to have it similar to c++ / ogre-tundra it suffices for mesh & ec_mesh to work so that when the mesh uses a skel it's loaded with the anims and skinning is applied. i'm not sure what the API to play back anims should be then though .. in original Tundra there is the EC_AnimationController for that but am not sure if that's needed just to have a way to trigger animations.

agreed about the EC_Avatar but that's a separate topic too (to have the attachments etc) whereas this is just for skinned meshes that can be used for anything (like in original tundra too, just with EC_Mesh).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants