shen

Members
  • Content count

    31
  • Joined

  • Last visited

  1. shen

    clone mesh from GLTF

    Maybe the loader can provide nodes with meshes, particle, skeletons, and follow "meshes" and other keywords in glTF to fill mesh and bone bins. If certain cases like you mentioned happen, users can check nodes and solve them manually.
  2. shen

    clone mesh from GLTF

    That's not right. It make all gltf files awful in Babylonjs, that's not better than "working for most cases". I've described the problems it caused with clone, unnecessary targets in animation and etc. above.
  3. shen

    clone mesh from GLTF

    Can't we sure that "mesh" means mesh? At this moment, light nodes are considered as mesh too. It shouldn't be difficult to exclude obvious no-mesh nodes from meshes. In three.js, "mesh", "bone" and other known types are labeled correctly ("Object3D" for unknown), while the hierarchy of nodes is kept. Of course, I can't guarantee for all the gltf file cases, but so far so good.
  4. shen

    clone mesh from GLTF

    For the first question, I just checked babylon.glTFLoader.ts and found that it generated meshes from all "nodes". Shouldn't it just check all the "nodes" contains "meshes" https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#meshes? private _getMeshes(): Mesh[] { const meshes = new Array<Mesh>(); // Root mesh is always first. meshes.push(this._rootBabylonMesh); const nodes = this._gltf.nodes; if (nodes) { for (const node of nodes) { if (node._babylonMesh) { meshes.push(node._babylonMesh); } if (node._primitiveBabylonMeshes) { for (const babylonMesh of node._primitiveBabylonMeshes) { meshes.push(babylonMesh); } } } } return meshes; }
  5. shen

    clone mesh from GLTF

    @Deltakosh Thanks! I followed your example and tried to go further. I found that gltf loader seems create meshes from bones, and they are not necessary. In https://www.babylonjs-playground.com/#PSR2ZX#44 line 81-87, I deleted them, and nothing went wrong. In line 112, I also delete the animation targets without _skeleton, and animations all worked correctly without them. Then I cloned skeletons in skeletonClones and meshes in meshClones, and they are all fine. I cloned "abduction_rings" animationGroup in animationClone, and re-targeted it's animations to skeletonClones. Click "abduction_rings_clone" and you can see the animation is different from "abduction_rings". In line 127, I output the original targets and bones in skeletonClones. Bones in original targets seem have more information than the cloned ones.
  6. shen

    clone mesh from GLTF

    Is it possible to clone models with exactly the same meshes, skeletons and animations?
  7. shen

    clone mesh from GLTF

    @RaananW Thanks! doNotCloneChildren flag seems just do the opposite of your code. In your sandbox, the clones meshes are still different from the original ones. Except the size, I found that they got different boundaries by using the debug layers.
  8. shen

    clone mesh from GLTF

    I tried to clone meshes imported from GLTF file and found that meshes were cloned twice. https://www.babylonjs-playground.com/#PSR2ZX#38 https://www.babylonjs-playground.com/#PSR2ZX#39 use the debug layer, you can find that the original root mesh was used as the parent of a set of cloned meshes. I also wonder whether the scale of the cloned meshes is correct?
  9. https://www.babylonjs-playground.com/#B2S8JX Here is the demo. Both assetsManager.onProgress and assetsManager.onFinish stop working as the document described now. https://doc.babylonjs.com/how_to/how_to_use_assetsmanager#manager-callbacks-and-observables Is it a bug, or we need to update the document now? Sorry, they are working correctly. It's my fault to ignore the "loadingUIText". I expect that assetsManager.onFinish = function(tasks) will give the processed tasks.
  10. @Deltakosh Thanks! You are a 🌟!
  11. If it's model's problem, why weights are working in three.js https://jsfiddle.net/shenzhuxi/hvvz9bc8/? I just checked out the latest Babylon.js code, and now seems it's working ... some kind ... in a hilarious way https://www.babylonjs-playground.com/#PSR2ZX#18 In the model https://gist.github.com/shenzhuxi/cf7ad7ce73ca6228a99a0a64a7eb6ab8/raw/d919fd82a5768a236b55fb0011603ca7b46ded5d/ybot.gltf, the animations of Alpha_Surface are working, but the animations of Alpha_Joints (the balls) are not.
  12. https://www.babylonjs-playground.com/#PSR2ZX#33 It's working. All the demos I provided before were based on your code...
  13. It's generated from ybot.fbx (I guess the same as dummy3.babylon) with https://github.com/Kupoman/blendergltf following https://www.donmccurdy.com/2017/11/06/creating-animated-gltf-characters-with-mixamo-and-blender/. The animation blending is working with three.js (you can try to open it with https://gltf-viewer.donmccurdy.com/). I guess that 400 animations are targeting different bones. How many animations are there normally in a group?
  14. As I understand, if two 2 animationGroups with weight say 0.5 are playing together, they can blend like https://www.babylonjs-playground.com/#BCU1XR. In the playground, weight of different animationGroup can be controlled by the sliders, and the blending in UFO case seems working but not in the ybot case. I updated the demo here https://www.babylonjs-playground.com/#PSR2ZX#31, and let it start with default weight. You can only the third animation run although all three animationGroups are playing. If you use the slider set weight between 0 and 1, the animation will just stop playing. Forget about what I said "-1 and 0 are confusing". It's off topic. In animationGroups.start public play(loop?: boolean) for (const targetedAnimation of this._targetedAnimations) { this._animatables.push(this._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this._from, to !== undefined ? to : this._to, loop, speedRatio, () => { this.onAnimationEndObservable.notifyObservers(targetedAnimation); })); } I found that animations pushed in _animatables didn't have value on enableBlending. So I just wonder is it the cause of the blend problem.
  15. First, animationGroup.setWeightForAllAnimatables works for the UFO file https://www.babylonjs-playground.com/#PSR2ZX#17, but not https://www.babylonjs-playground.com/#PSR2ZX#18. Is it because of the skeleton animation? /** * Start all animations on given targets * @param loop defines if animations must loop * @param speedRatio defines the ratio to apply to animation speed (1 by default) * @param from defines the from key (optional) * @param to defines the to key (optional) * @returns the current animation group */ public start(loop = false, speedRatio = 1, from?: number, to?: number): AnimationGroup { if (this._isStarted || this._targetedAnimations.length === 0) { return this; } for (const targetedAnimation of this._targetedAnimations) { this._animatables.push(this._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this._from, to !== undefined ? to : this._to, loop, speedRatio, () => { this.onAnimationEndObservable.notifyObservers(targetedAnimation); })); } this._speedRatio = speedRatio; this._isStarted = true; return this; } In AnimationGroup, beginDirectAnimation was used. Will beginWeightedAnimation make weight and blending working? Second (I guess is't a different issue), scene.animationPropertiesOverride = new BABYLON.AnimationPropertiesOverride(); scene.animationPropertiesOverride.enableBlending = true; scene.animationPropertiesOverride.blendingSpeed = 0.02; That works with https://www.babylonjs-playground.com/#BCU1XR, but not with scene.animationGroups._targetedAnimations.animation.enableBlending (in both https://www.babylonjs-playground.com/#PSR2ZX#17 and https://www.babylonjs-playground.com/#PSR2ZX#18). The value of enableBlending is always undefined. BTW, Weight -1 means stop while 0 also means stop too. That's confusing.