reddozen Posted February 17, 2015 Share Posted February 17, 2015 I was looking over the documentation in tutorials section 4 about using bones and skeletons, and the example looks pretty inefficient for what I'm trying to do. Maybe I'm looking at this from the wrong approach? We have character model mode up of maybe 10~12 parts, and a single skeleton that controls all those parts. based on the example, you're assigning a whole clone of the skeleton to each sub mesh of the total character model. This would be very bad in the case of our animations that have 17000+ key frames (assuming we can even get the rigging simplified enough to use). Do we need to load in all the sub-meshes and merge them into a single model, then attach the skeleton, or is there a way that we can attach all these sub-models to a single skeleton? I would rather be able to attach the sub-meshes to a single skeleton as it would be a simpler process for swapping equipment rather than reloading every piece of equipment, merging them again, then reattaching the skeleton. I would rather be able to just swap out the section that i need to replace as needed. The may be an issue with inheritance as the model inherits the skeleton instead of the other way around. If this is the case, would it be possible to also let skeletons inherit meshes as needed for complex models like this? Just trying to understand my best solution to this problem. Example from the tutorial:for (j = 1; j < newMeshes.length; j++) { c[j] = newMeshes[j].clone("c" + j); c[j].position = new BABYLON.Vector3(xrand, 0, zrand); c[j].skeleton = newMeshes[j].skeleton.clone(); scene.beginAnimation(c[j].skeleton, 0, 120, 1.0, true);} Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 17, 2015 Share Posted February 17, 2015 Why not creating instances in this case? This way, you do not need to clone the skeleton like I did here:http://www.babylonjs.com/?INSTANCEDBONES Source code:https://github.com/BabylonJS/Samples/blob/master/Scenes/Customs/bones2.js Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 17, 2015 Share Posted February 17, 2015 In other hand I do not wee why this would not work:for (j = 1; j < newMeshes.length; j++) { c[j] = newMeshes[j].clone("c" + j); c[j].position = new BABYLON.Vector3(xrand, 0, zrand); c[j].skeleton = newMeshes[j].skeleton; scene.beginAnimation(newMeshes[j].skeleton, 0, 120, 1.0, true);}I think (I did not try but looking at my code, this seems legit) that a skeleton can by applied to many meshes Quote Link to comment Share on other sites More sharing options...
reddozen Posted February 17, 2015 Author Share Posted February 17, 2015 Wouldn't that cause extra copies of the skeleton? Instance or clone, if I assign the skeleton to my armor, then legs, then hands, then head (all sub-meshes) don't I then have 4 copies of the skeleton for the complete model? All my equipment pieces are separate models that I need to combine into a single animated character. My scenario is this: ( there are actually probably 50 different pieces of each equipment type or more )3 different armor3 different legs5 different arms1 skeleton Quote Link to comment Share on other sites More sharing options...
Seyren Posted February 17, 2015 Share Posted February 17, 2015 The deal here is that each model has the whole skeleton included in the file (for example, even if it's the gloves, the whole biped is in the file) for rigging purposes. Everytime we add a piece of armor we would add the whole skeleton here, therefore, if we add Legs, armor, even an accessory that is rigged for some reason would add up the skeleton. A fast solution by reading this could be removing the unused skeletons, however it is obvious that pieces are going to use the same bones, for example the legs on the bottom of the shirt. What i've done before in 3ds max for example, when working with this kind of issues, is cheking if the bone was already in the scene, if it wasn't, i would just add it, else, i would use that bone to apply the rigging of the mesh. However, didn't check the documentation, but i assume there are any functions of add vertex weights and rigging, so it would be kind of waste of time i guess. Not sure if i explained myself properly, but that's the problem, it's fine in the instanced bones example since there are no split parts of the mesh used and it's a whole body for it. The ideal thing would be selecting a skeleton, then add a mesh, look in the rig section of the file the rigged mesh and the bones and look for them in the skeleton, and apply the rig, or at least that's what i always did when i could, but i wonder if we can do it here. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted February 17, 2015 Share Posted February 17, 2015 "Wouldn't that cause extra copies of the skeleton": No actually this is the opposite. Only one skeleton shared betwwen meshes Quote Link to comment Share on other sites More sharing options...
reddozen Posted February 18, 2015 Author Share Posted February 18, 2015 Thanks DK, we'll test it out. Quote Link to comment Share on other sites More sharing options...
Macbeth Posted May 30, 2015 Share Posted May 30, 2015 Thanks DK, we'll test it out. Did you manage to solve this? I'm trying to get my hands around this as well and I'm having no luck with it..Would you mind sharing your solution if you managed to fix it? I also have a player model which I want to equip with meshes on the specific parts. Quote Link to comment Share on other sites More sharing options...
reddozen Posted June 2, 2015 Author Share Posted June 2, 2015 I have not had time to revisit it sorry. I have been working on general scene loading. Quote Link to comment Share on other sites More sharing options...
Macbeth Posted June 7, 2015 Share Posted June 7, 2015 I have not had time to revisit it sorry. I have been working on general scene loading. Alright! Let me know if you figure out how to do is. I'm struggling. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.