Stalker Posted November 2, 2015 Share Posted November 2, 2015 Hi! I successful rigged and animated a model in Blender and exported it to .babylon format.After loading and running everything, the results is not what I expected. A running demo here on plunker (press run to start, and detach a window to be able to move). It should be a single step where all of the parts hold together (as it can be seen in Blender). I also attached a Blender file for example above. After experimenting a bit I'd say that the problem lies in inverse kinematics, but can't confirm that. Has anyone experienced such problem? What causes it and the way to solve it? Thanks! Robot.zip Quote Link to comment Share on other sites More sharing options...
gryff Posted November 3, 2015 Share Posted November 3, 2015 Welcome to the BJS forum stalker i'll take a look stalker see if I can find any issues. cheers, gryff Quote Link to comment Share on other sites More sharing options...
Stalker Posted November 3, 2015 Author Share Posted November 3, 2015 Thanks!please let me know if you succeed or not, just so that I know how doomed am I .Otherwise entire idea is that rig is controlled via handles (small circle at an ankle at a example). I'm currently going through actions and dope sheet, to see if any actions might overlap causing this strange movement (and a tutorial just in case I didn't screw up anything in Blender). Quote Link to comment Share on other sites More sharing options...
Mikhail Luzyanin Posted November 3, 2015 Share Posted November 3, 2015 I'm not so familiar with babylon.js, but may be you need to rebake you IK animation into direct animation? Also, if you are using blender may be it will more comfortable to use Blend4Web engine, it allow you to export your model dircetly from the blender to the webgl engine without converting into another format. There's also you can find some tools for baking IK animation into direct animation and so on. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 3, 2015 Share Posted November 3, 2015 I disagree with Mikhluz:) we have an excellent Blender exporter and I do not think that Blend4Web has the same goal than Babylon.js. Quote Link to comment Share on other sites More sharing options...
Stalker Posted November 3, 2015 Author Share Posted November 3, 2015 Blend4Web looks like a cool project, but I share my opinion with Delkatosh - seems like a different goal (not primary game oriented). After a day figuring out what the problem might be I found out that the problem is in Blender as the "bug" can be recreated in it.I recreated all of the handles, linked to Inverse Kinematics bone modifiers, reanimated and it works (for now). But am still interested what went front the first time, because I did everything exactly the same (not exactly I guess). Quote Link to comment Share on other sites More sharing options...
gryff Posted November 3, 2015 Share Posted November 3, 2015 Well stalker, is this what you are looking for? Robot cheers, gryff Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted November 3, 2015 Share Posted November 3, 2015 I cannot export my scene from Blender to babylon, (animated rig with IK too).I don't know yet what to do with this... A bit similar problem." recipe = BakingRecipe(object) "Looks like something about baking animation, but I don't have a clue - yet. Log:Exporter version: 3.0.0, Blender version: 2.75 (sub 0)========= Conversion from Blender to Babylon.js =========Python World class constructor completedprocessing begun of skeleton: Armature, id: 0processing begun of bone: elbowR, index: 0animation begun of bone: elbowRprocessing begun of bone: kneeR, index: 1animation begun of bone: kneeRprocessing begun of bone: legIKR, index: 2animation begun of bone: legIKRprocessing begun of bone: footR, index: 3animation begun of bone: footRprocessing begun of bone: armIKR, index: 4animation begun of bone: armIKRprocessing begun of bone: elbowL, index: 5animation begun of bone: elbowLprocessing begun of bone: kneeL, index: 6animation begun of bone: kneeLprocessing begun of bone: legIKL, index: 7animation begun of bone: legIKLprocessing begun of bone: footL, index: 8animation begun of bone: footLprocessing begun of bone: armIKL, index: 9animation begun of bone: armIKLprocessing begun of bone: fsceIK, index: 10animation begun of bone: fsceIKprocessing begun of bone: hip, index: 11animation begun of bone: hipprocessing begun of bone: upperlegR, index: 12animation begun of bone: upperlegRprocessing begun of bone: lowerlegR, index: 13animation begun of bone: lowerlegRprocessing begun of bone: chest, index: 14animation begun of bone: chestprocessing begun of bone: head, index: 15animation begun of bone: headprocessing begun of bone: upperarmR, index: 16animation begun of bone: upperarmRprocessing begun of bone: lowerarmR, index: 17animation begun of bone: lowerarmRprocessing begun of bone: handR, index: 18animation begun of bone: handRprocessing begun of bone: upperlegL, index: 19animation begun of bone: upperlegLprocessing begun of bone: lowerlegL, index: 20animation begun of bone: lowerlegLprocessing begun of bone: upperarmL, index: 21animation begun of bone: upperarmLprocessing begun of bone: lowerarmL, index: 22animation begun of bone: lowerarmLprocessing begun of bone: handL, index: 23animation begun of bone: handLprocessing complete of skeleton: Armatureprocessing begun of mesh: archerprocessing begun of baked material: archerInternal baking texture, type: TEXTURE, mapped using: BakingUVnum positions : 2448num normals : 2448num uvs : 4896num uvs2 : 0num colors : 0num indices : 2448num skeletonWeights: 9792num skeletonIndices: 9792processing begun of mesh: kopeny========= An error was encountered ========= File "X:\programfiles\blender\2.75\scripts\addons\io_export_babylon.py", line 287, in execute mesh = Mesh(object, scene, nextStartFace, forcedParent, nameID, self) File "X:\programfiles\blender\2.75\scripts\addons\io_export_babylon.py", line 687, in __init__ recipe = BakingRecipe(object) File "X:\programfiles\blender\2.75\scripts\addons\io_export_babylon.py", line 1602, in __init__ self.billboardMode = BILLBOARDMODE_ALL if len(mesh.material_slots) == 1 and mesh.material_slots[0].material.game_settings.face_orientation == 'BILLBOARD' else BILLBOARDMODE_NONEERROR: 'NoneType' object has no attribute 'game_settings'========= end of processing =========elapsed time: 0 min, 5.2462 secs ijasz1.zip Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 3, 2015 Share Posted November 3, 2015 You have some really strange meshes in this .blend. Nothing even appears on the materials property tab when you select the kopeny, fej, or test meshes. I deleted them. It ran. Here is a log run on an unreleased version of the exporter: Exporter version: 4.0.0, Blender version: 2.75 (sub 0) ========= Conversion from Blender to Babylon.js ========= Scene settings used: selected layers only: false no vertex optimization: false inline textures: false00:00 Python World class constructor completed00:00 processing begun of skeleton: Armature, id: 000:00 processing begun of bone: elbowR, index: 000:00 animation begun of bone: elbowR00:00 processing begun of bone: kneeR, index: 100:00 animation begun of bone: kneeR00:00 processing begun of bone: legIKR, index: 200:00 animation begun of bone: legIKR00:00 processing begun of bone: footR, index: 300:00 animation begun of bone: footR00:00 processing begun of bone: armIKR, index: 400:00 animation begun of bone: armIKR00:00 processing begun of bone: elbowL, index: 500:00 animation begun of bone: elbowL00:00 processing begun of bone: kneeL, index: 600:00 animation begun of bone: kneeL00:00 processing begun of bone: legIKL, index: 700:00 animation begun of bone: legIKL00:00 processing begun of bone: footL, index: 800:00 animation begun of bone: footL00:00 processing begun of bone: armIKL, index: 900:00 animation begun of bone: armIKL00:00 processing begun of bone: fsceIK, index: 1000:00 animation begun of bone: fsceIK00:00 processing begun of bone: hip, index: 1100:00 animation begun of bone: hip00:00 processing begun of bone: upperlegR, index: 1200:00 animation begun of bone: upperlegR00:00 processing begun of bone: lowerlegR, index: 1300:00 animation begun of bone: lowerlegR00:00 processing begun of bone: chest, index: 1400:00 animation begun of bone: chest00:00 processing begun of bone: head, index: 1500:00 animation begun of bone: head00:00 processing begun of bone: upperarmR, index: 1600:00 animation begun of bone: upperarmR00:00 processing begun of bone: lowerarmR, index: 1700:00 animation begun of bone: lowerarmR00:00 processing begun of bone: handR, index: 1800:00 animation begun of bone: handR00:00 processing begun of bone: upperlegL, index: 1900:00 animation begun of bone: upperlegL00:00 processing begun of bone: lowerlegL, index: 2000:00 animation begun of bone: lowerlegL00:00 processing begun of bone: upperarmL, index: 2100:00 animation begun of bone: upperarmL00:00 processing begun of bone: lowerarmL, index: 2200:00 animation begun of bone: lowerarmL00:00 processing begun of bone: handL, index: 2300:00 animation begun of bone: handL00:00 processing complete of skeleton: Armature00:00 processing begun of mesh: archer00:00 processing begun of Standard material: Material00:00 processing begun of mesh: archer00:00 num positions : 244800:00 num normals : 244800:00 num uvs : 000:00 num uvs2 : 000:00 num colors : 000:00 num indices : 244800:00 Skeleton stats: 00:00 Total Influencers: 373400:00 Avg # of influencers per vertex: 1.525300:00 Highest # of influencers observed: 400:00 exported as 4 influencers00:00 Compute bones using shaders: true00:00 num skeletonWeights: 979200:00 num skeletonIndices: 979200:00 processing begun of camera (FreeCamera): Camera00:00 processing begun of light (HEMI): Hemi00:00 processing begun of light (SUN): Lamp00:00 ========= Writing of javascript file started =========00:00 ========= Writing of javascript file completed =========00:00 ========= end of processing =========00:00 elapsed time: 0 min, 4.044 secs Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted November 3, 2015 Share Posted November 3, 2015 Thank you very much!Runs without problems.Those meshes had modifiers, not applied = source of other mesh. Quote Link to comment Share on other sites More sharing options...
Stalker Posted November 3, 2015 Author Share Posted November 3, 2015 Well stalker, is this what you are looking for? Robot cheers, gryff Yes! Did you delete animation and recreate or just fix something? Quote Link to comment Share on other sites More sharing options...
gryff Posted November 4, 2015 Share Posted November 4, 2015 Did you delete animation and recreate or just fix something? I just applied some fixes. However, some of them I think are not needed so I'm trying various combos to try to get the minimum number of steps. Hopefully, I will be able to give you a step by step guide tomorrow. cheers, gryff Stalker and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
gryff Posted November 4, 2015 Share Posted November 4, 2015 OK stalker, as promised, I have slimmed down the number of steps for fixing your robot leg. You can find the files I started with and finished up with here.The start file is your file but I have removed the "Area" light (not supported by BJS) and added a "Hemi" light instead, added a ground plane, and then I just rearranged the Blender interface a little. So best if you use my start file - but you can use yours if you want.Step 1.a.) If you use your file, make sure that the 3D cursor is at the "origin". Mouse cursor in the 3D window then "Shift + C keys" will put the cursor it at 0,0,0.b.) Open the 3D window "Properties" panel - the mouse cursor still in the 3D window and hit the "N key".Step 2.a.) Select the "Robot" (the mesh) in the Object Mode and look in the "Properties" panel you will see that the "Location" values (x,y,z) are not zero, so with the Robot still selected go:Object -> Transform -> Origin to 3D Cursor. This will zero the location values.b.) Now select the "Robot.Armature". Again you will see that the "Location" values are not zero, so again Object -> Transform -> Origin to 3D Cursor.c.) You will also notice that the Scale values for the armature are not 1, so with the armature still selected go Object -> Apply -> Scale.I know not much seems to have changed, but you would not be the first person on this forum to see the chaos that hits the export of animations to BJS when the Location, Rotation and Scale values of the armature and mesh are different.Step 3.Now to create a frame animation for the armature as currently with the IK setup the "Circle" constraint is being animated and it in turn moves the armature in Blender - so we have to "bake" out the frames for the armature itself.a.) Select the "Robot.Armature" and go into "Pose Mode".b.) Make sure ALL the bones are selected then -c.) From the menu bar for the 3D window - Pose -> Animation -> Bake Action and a little box pops upd.) Make sure that the three boxes "Only Selected, Visual Keying, and Clear Constraints" are all checked (a little tick). And hit the OK button.You will see 24 frames appear in the "Timeline and Action Editor" and "Action" appear as the name of the new animation that has been created. That is the animation we want. Make sure it appears in that box when you export to BJS.Step 4.Now we need to bind that animation to the mesh.a.) Select the Robot (mesh) and then Shift + Select the Robot.Armature and with the mouse in the 3D windowb.) CTRL + P - to make the armature the parent of the mesh. Use the "Use Automatic Weights" option.Step 5.a.) Select the "Circle" and delete it.b.) And if you wish clean out all the other animations making sure to return to the new animation - "Action" - you created as the chosen named animation. It will work without doing this - but it always feels better if unused stuff is cleared out.Now export your animated leg. Here is the Animated Leg exported from the finished file you will find in the .zip file above. It uses an ArcRotate camera - so you can examine it.Looking at your file, I get the feeling the "leg" is part of a bigger project (all those vertex groups like head and arm etc.). All the above should work fine on a whole robot though you may have a lot more 'Circle" constraints to delete. Please don't be offended if you think I am being too simple - bitter experience at the Unity forums taught me to include detail . In the other hand, if you need more info about it - just post here cheers, gryff JackFalcon, Demian and Blax 3 Quote Link to comment Share on other sites More sharing options...
Stalker Posted November 4, 2015 Author Share Posted November 4, 2015 Hi gryff, Not offended at all, a lot of info is quite welcome (I'm not really a Blender expert) and your detailed explanation might help save some desperate souls . That leg it is indeed part of a bigger mesh, it can be seen in this thread, but I removed most of it because all that moving everywhere it was just hilarious, sad and confusing. While recreating my animation (a couple of posts back) I managed to successfully export it with Inverse Kinematics (no need to bake), I'll see if I can succeed again following your steps with IK. I'll try first thing in the morning!Thanks for all of the help ! Look like you really put a lot of effort into it. Quote Link to comment Share on other sites More sharing options...
gryff Posted November 5, 2015 Share Posted November 5, 2015 Well let me know how it works out. I was unaware that it was possible to use IK in BJS. About 5 years ago I was using some IK rigged models and had a similar issue with Unity 3D basically ignoring the IK rig - so I adopted the baking technique. I guess that has changed now. Do you mind if I use your leg model - as I have been thinking of maybe creating some video tutorials about issues with animations in BJS? Sorry that I could not be of more help. cheers, gryff Quote Link to comment Share on other sites More sharing options...
Stalker Posted November 5, 2015 Author Share Posted November 5, 2015 I tested it out and it works! I currently went only through the first two steps (didn't bake the frames and left IK as it is). Works without any problems! Of course you can, I attached the full model if you want it (a friend of mine helped me with rigging, that's why it looks cool IMHO). In attached model curves are used as a handles (to control IK), which are perfect because they aren't exported leaving all of the clutter in blender file (or they can be moved to another layer). There are also a couple of bugs left, but I'll get there soon. A big thanks! I couldn't have asked for more help.Robot.zip Quote Link to comment Share on other sites More sharing options...
gryff Posted November 5, 2015 Share Posted November 5, 2015 Glad it works stalker. As I said above: I know not much seems to have changed, but you would not be the first person on this forum to see the chaos that hits the export of animations to BJS when the Location, Rotation and Scale values of the armature and mesh are different. Blender Animation Export Issue What are the "couple of bugs left" ? cheers, gryff Quote Link to comment Share on other sites More sharing options...
Stalker Posted November 5, 2015 Author Share Posted November 5, 2015 I recall a few thing back from my Blender days, but I forgot most of it.A couple of bugs in a model, flickering right arm, a couple of things could be better, a few normals to fix etc... small things, nothing Babylon related. I really don't know how I missed that... 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.