Jump to content

Bug import skeleton made with Blender in BabylonJS version 3.1.1


Zino54220
 Share

Recommended Posts

Hi everyone,

I need your help a new time...

I updated my BabylonJs version from 2.2 to 3.1.1 and I have a problem with an import skeleton :

here the code (from the doc) calls which is very simple :
 

function importSquelette(nomSkelAtelier, chemVersFichierSkelAtelier, nomFichierSkelAtelier, laScene)
{
    BABYLON.SceneLoader.ImportMesh(nomSkelAtelier, chemVersFichierSkelAtelier, nomFichierSkelAtelier, laScene,
        function (newMeshesSkel, particleSystems, skeletons)
        {
            var dude = newMeshesSkel[0];

            //dude.rotation.y = Math.PI;
            dude.position = new BABYLON.Vector3(0, 0, 10);
                

        }
    );
}

parameters values :

- nomSkelAtelier = 'Armature_Striker_AZ_9'

- chemVersFichierSkelAtelier = '../Scripts/Bll_IFC/Mesh/MeshSkelette/'

- nomFichierSkelAtelier = 'Striker_AZ_9.babylon'

- lascene = the scene loaded before

 I specify that :

- the scene.babylon file and the skeleton.babylon file aren't in the same folder.

- the exporter for Blender was the version 5.5

- the version of Blender is 2.79

And here the consol log when i click to the button which call the import skeleton function:

BabylonJs.3.1.1.png.49716cd8d350b7889415789e35308c99.png

 

How can I fix it ? I try to finish a game fight robot and import skeleton is the main part of the game ....

Thanks !

 

Link to comment
Share on other sites

So a little point of my research...

I tried different version of Babylon JS and :

- the version 3.1.0 does the same thing.

- the version 3.0.7 (with exporter 5.4.0) gives no error in consol but doesn't do the job, always give an empty array in call back function :

BabylonJs.3.0.7.png.38f900570568407012bccc232f132711.png

I tried to set up the name of my skeleton mesh but no more effects... Here all the parameters of my skeleton from Blender 2.79 :

5a9d491468806_Blender_2.79_Skeletonparamsvalues.png.f5ccd99c8b079285cbc45d571f0aa909.png

- the version 2.5.0 give no error but make not the job, always a empty array in call back function like for the version 3.0.7.

There is a problem with exporter ? or this version of Blender ?? ...

Unfortunately, if I can't import my skeleton mesh, I can't finish my game fight :( ... I will try to get the old version of exporter compatible with Babylon Js 2.2.0 and retry again to retrieve a function available.

Link to comment
Share on other sites

First, Blender exporter version is currently 5.6.  There is the last version of the single source file in the repo, if you are stuck at old versions of Blender.

2nd, turn on your JSON logging detail to see what is being done by adding this line before your import.  Do not know what version of BJS this was added:

BABYLON.SceneLoader.loggingLevel = BABYLON.SceneLoader.DETAILED_LOGGING;

Referencing a mesh by index is pretty weak code.  Better to use scene.getMeshByName('BlenderName').  The exporter, Blender, or importer could all change to give a different order.  ImportMesh args are not readable for me, so you could only be asking for a single mesh, but even then children meshes are also loaded.

Link to comment
Share on other sites

Hi "@JCPalmer",

So ...

1° I set up the exporter Blender with the version 5.6.0 and remade the export of my skeleton.

2° I set the babylon file with the version 3.1.1 and (after ...) 3.0.7 of babylon.js

3° I added the line and load BabylonJS:

BABYLON.SceneLoader.loggingLevel = BABYLON.SceneLoader.DETAILED_LOGGING;

4° I modify the import skeleton function with your advices like this :

function importSquelette(nomSkelAtelier, chemVersFichierSkelAtelier, nomFichierSkelAtelier, laScene)
{
    BABYLON.SceneLoader.loggingLevel = BABYLON.SceneLoader.DETAILED_LOGGING;

    BABYLON.SceneLoader.ImportMesh(nomSkelAtelier, chemVersFichierSkelAtelier, nomFichierSkelAtelier, laScene,
        function (newMeshesSkel, particleSystems, skeletons)
        {
            //var dude = newMeshesSkel[0];
            var skeleton = laScene.getMeshByName('Striker_AZ_9');

            //dude.rotation.y = Math.PI;
            //dude.position = new BABYLON.Vector3(0, 0, 10);
            skeleton.position = new BABYLON.Vector3(0, 0, 10);
        }
    );
}

 

5° I got the same things with this result in consol :

For BabylonJS 3.1.1 

BabylonJs.3.1.1_bis.thumb.png.ecd3949a40a83dfefc400d81007db8de.png

For BabylonJS 3.0.7

BabylonJs.3.0.7_bis.thumb.png.16236430d31a9e5e2ec42871a03e2c48.png

There is a specific option to enable in Blender before export or maybe I must made a animation for the skeleton or anything like this  before made export ?

 

Link to comment
Share on other sites

Given that different versions of BJS produce different results, my first thought is this is not directly an export problem.  Having a more robust check shows that the mesh you were expecting is just not there.  Due to the number of time zone apart, here are a number of things to try:

1- Include the .log file from the export.  I guess load logging does not work with importMesh.  It works with scene.Append.

2- Probably want include the .babylon, if possible.

Link to comment
Share on other sites

Here the content of log file (I just modify the path texture directory with '...' instead my name).

Exporter version: 5.6.0, Blender version: 2.79 (sub 0)
========= Conversion from Blender to Babylon.js =========
	Scene settings used:
		selected layers only:  false
		inline textures:  false
		Positions Precision :  4
		Normals Precision   :  3
		UVs Precision       :  3
		Vert Color Precision:  3
		Mat Weight Precision:  2
		texture directory:  C:\Users\...\Documents\Blender\IFC\Squelette\Skeleton Striker AZ 9\Squelette_BabylonJS\
	Python World class constructor completed
	WARNING: No active camera has been assigned, or is not in a currently selected Blender layer
	processing begun of skeleton:  Striker_AZ_9, id:  0
		processing begun of bone:  torse3, index:  0
		processing begun of bone:  torse2, index:  1
		processing begun of bone:  torse1, index:  2
		processing begun of bone:  head, index:  3
		processing begun of bone:  epaule.L, index:  4
		processing begun of bone:  brasHaut.L, index:  5
		processing begun of bone:  brasBas.L, index:  6
		processing begun of bone:  mains.L, index:  7
		processing begun of bone:  mains_index1.L, index:  8
		processing begun of bone:  mains_index2.L, index:  9
		processing begun of bone:  mains_index3.L, index:  10
		processing begun of bone:  mains_majeure1.L, index:  11
		processing begun of bone:  mains_majeure2.L, index:  12
		processing begun of bone:  mains_majeure3.L, index:  13
		processing begun of bone:  mains_annulaire1.L, index:  14
		processing begun of bone:  mains_annulaire2.L, index:  15
		processing begun of bone:  mains_annulaire3.L, index:  16
		processing begun of bone:  mains_oriculaire1.L, index:  17
		processing begun of bone:  mains_oriculaire2.L, index:  18
		processing begun of bone:  mains_oriculaire3.L, index:  19
		processing begun of bone:  mains_pouce1.L, index:  20
		processing begun of bone:  mains_pouce2.L, index:  21
		processing begun of bone:  epaule.R, index:  22
		processing begun of bone:  brasHaut.R, index:  23
		processing begun of bone:  brasBas.R, index:  24
		processing begun of bone:  mains.R, index:  25
		processing begun of bone:  mains_index1.R, index:  26
		processing begun of bone:  mains_index2.R, index:  27
		processing begun of bone:  mains_index3.R, index:  28
		processing begun of bone:  mains_majeure1.R, index:  29
		processing begun of bone:  mains_majeure2.R, index:  30
		processing begun of bone:  mains_majeure3.R, index:  31
		processing begun of bone:  mains_annulaire1.R, index:  32
		processing begun of bone:  mains_annulaire2.R, index:  33
		processing begun of bone:  mains_annulaire3.R, index:  34
		processing begun of bone:  mains_oriculaire1.R, index:  35
		processing begun of bone:  mains_oriculaire2.R, index:  36
		processing begun of bone:  mains_oriculaire3.R, index:  37
		processing begun of bone:  mains_pouce1.R, index:  38
		processing begun of bone:  mains_pouce2.R, index:  39
		processing begun of bone:  cuisse.L, index:  40
		processing begun of bone:  tibia.L, index:  41
		processing begun of bone:  pied.L, index:  42
		processing begun of bone:  cuisse.R, index:  43
		processing begun of bone:  tibia.R, index:  44
		processing begun of bone:  pied.R, index:  45
	processing begun of mesh:  Striker_AZ_9_Main.L
		processing begun of Standard material:  RobocopBlack
			Diffuse texture found "Kd"
				Image texture found, type:  diffuseTexture, mapped using: "UVMap"
		processing begun of Standard material:  CircuitIntegre
			Diffuse texture found "Texture.002"
				Image texture found, type:  diffuseTexture, mapped using: "UVMap"
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#0
		num positions      :  236
		num normals        :  236
		num uvs            :  472
		num uvs2           :  0
		num colors         :  0
		num indices        :  558
		Skeleton stats:  
			Total Influencers:  578
			Avg # of influencers per vertex:  2.4492
			Highest # of influencers observed:  6, num vertices with this:  6
			exported as 6 influencers
			num skeletonWeights and skeletonIndices:  1888
	processing begun of mesh:  Striker_AZ_9_AvantBras.L
		registered as also a user of material:  RobocopBlack
		num positions      :  164
		num normals        :  164
		num uvs            :  328
		num uvs2           :  0
		num colors         :  0
		num indices        :  498
		Skeleton stats:  
			Total Influencers:  275
			Avg # of influencers per vertex:  1.6768
			Highest # of influencers observed:  2, num vertices with this:  111
			exported as 2 influencers
			num skeletonWeights and skeletonIndices:  656
	processing begun of mesh:  Striker_AZ_9_BrasHaut.L
		registered as also a user of material:  RobocopBlack
		registered as also a user of material:  CircuitIntegre
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#1
		num positions      :  273
		num normals        :  273
		num uvs            :  546
		num uvs2           :  0
		num colors         :  0
		num indices        :  933
		Skeleton stats:  
			Total Influencers:  409
			Avg # of influencers per vertex:  1.4982
			Highest # of influencers observed:  2, num vertices with this:  136
			exported as 2 influencers
			num skeletonWeights and skeletonIndices:  1092
	processing begun of mesh:  Striker_AZ_9_Cuisse.L
		registered as also a user of material:  RobocopBlack
		registered as also a user of material:  CircuitIntegre
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#2
		num positions      :  148
		num normals        :  148
		num uvs            :  296
		num uvs2           :  0
		num colors         :  0
		num indices        :  474
		Skeleton stats:  
			Total Influencers:  235
			Avg # of influencers per vertex:  1.5878
			Highest # of influencers observed:  2, num vertices with this:  87
			exported as 2 influencers
			num skeletonWeights and skeletonIndices:  592
	processing begun of mesh:  Striker_AZ_9_Tibia.L
		registered as also a user of material:  RobocopBlack
		registered as also a user of material:  CircuitIntegre
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#3
		num positions      :  109
		num normals        :  109
		num uvs            :  218
		num uvs2           :  0
		num colors         :  0
		num indices        :  342
		Skeleton stats:  
			Total Influencers:  152
			Avg # of influencers per vertex:  1.3945
			Highest # of influencers observed:  2, num vertices with this:  43
			exported as 2 influencers
			num skeletonWeights and skeletonIndices:  436
	processing begun of mesh:  Striker_AZ_9_Pied.L
		registered as also a user of material:  RobocopBlack
		registered as also a user of material:  CircuitIntegre
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#4
		num positions      :  111
		num normals        :  111
		num uvs            :  222
		num uvs2           :  0
		num colors         :  0
		num indices        :  294
		Skeleton stats:  
			Total Influencers:  158
			Avg # of influencers per vertex:  1.4234
			Highest # of influencers observed:  2, num vertices with this:  47
			exported as 2 influencers
			num skeletonWeights and skeletonIndices:  444
	processing begun of mesh:  Striker_AZ_9_Cuisse.R
		registered as also a user of material:  RobocopBlack
		registered as also a user of material:  CircuitIntegre
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#5
		num positions      :  148
		num normals        :  148
		num uvs            :  296
		num uvs2           :  0
		num colors         :  0
		num indices        :  474
		Skeleton stats:  
			Total Influencers:  242
			Avg # of influencers per vertex:  1.6351
			Highest # of influencers observed:  2, num vertices with this:  94
			exported as 2 influencers
			num skeletonWeights and skeletonIndices:  592
	processing begun of mesh:  Striker_AZ_9_Tibia.R
		registered as also a user of material:  RobocopBlack
		registered as also a user of material:  CircuitIntegre
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#6
		num positions      :  109
		num normals        :  109
		num uvs            :  218
		num uvs2           :  0
		num colors         :  0
		num indices        :  342
		Skeleton stats:  
			Total Influencers:  157
			Avg # of influencers per vertex:  1.4404
			Highest # of influencers observed:  2, num vertices with this:  48
			exported as 2 influencers
			num skeletonWeights and skeletonIndices:  436
	processing begun of mesh:  Striker_AZ_9_Pied.D
		registered as also a user of material:  RobocopBlack
		registered as also a user of material:  CircuitIntegre
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#7
		num positions      :  111
		num normals        :  111
		num uvs            :  222
		num uvs2           :  0
		num colors         :  0
		num indices        :  294
		Skeleton stats:  
			Total Influencers:  154
			Avg # of influencers per vertex:  1.3874
			Highest # of influencers observed:  2, num vertices with this:  43
			exported as 2 influencers
			num skeletonWeights and skeletonIndices:  444
	processing begun of mesh:  Striker_AZ_9_BrasHaut.R
		registered as also a user of material:  RobocopBlack
		registered as also a user of material:  CircuitIntegre
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#8
		num positions      :  273
		num normals        :  273
		num uvs            :  546
		num uvs2           :  0
		num colors         :  0
		num indices        :  933
		Skeleton stats:  
			Total Influencers:  409
			Avg # of influencers per vertex:  1.4982
			Highest # of influencers observed:  2, num vertices with this:  136
			exported as 2 influencers
			num skeletonWeights and skeletonIndices:  1092
	processing begun of mesh:  Striker_AZ_9_AvantBras.R
		registered as also a user of material:  RobocopBlack
		num positions      :  164
		num normals        :  164
		num uvs            :  328
		num uvs2           :  0
		num colors         :  0
		num indices        :  498
		Skeleton stats:  
			Total Influencers:  275
			Avg # of influencers per vertex:  1.6768
			Highest # of influencers observed:  2, num vertices with this:  111
			exported as 2 influencers
			num skeletonWeights and skeletonIndices:  656
	processing begun of mesh:  Striker_AZ_9_Torse
		registered as also a user of material:  RobocopBlack
		registered as also a user of material:  CircuitIntegre
		processing begun of Standard material:  BlackRobotSup
		processing begun of Standard material:  RepareBoulette
			Diffuse texture found "Kd"
				Image texture found, type:  diffuseTexture, mapped using: "UVMap"
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#9
		num positions      :  904
		num normals        :  904
		num uvs            :  1808
		num uvs2           :  0
		num colors         :  0
		num indices        :  2634
		Skeleton stats:  
			Total Influencers:  2846
			Avg # of influencers per vertex:  3.1482
			Highest # of influencers observed:  6, num vertices with this:  1
			exported as 6 influencers
			num skeletonWeights and skeletonIndices:  7232
	processing begun of mesh:  Striker_AZ_9_Tete
		registered as also a user of material:  RobocopBlack
		processing begun of Standard material:  MaterialMasque
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#10
		num positions      :  430
		num normals        :  430
		num uvs            :  860
		num uvs2           :  0
		num colors         :  0
		num indices        :  1572
		Skeleton stats:  
			Total Influencers:  458
			Avg # of influencers per vertex:  1.0651
			Highest # of influencers observed:  4, num vertices with this:  1
			exported as 4 influencers
			num skeletonWeights and skeletonIndices:  1720
	processing begun of mesh:  Striker_AZ_9_Main.R
		registered as also a user of material:  RobocopBlack
		registered as also a user of material:  CircuitIntegre
		processing begun of multimaterial:  Striker_AZ_9.Multimaterial#11
		num positions      :  236
		num normals        :  236
		num uvs            :  472
		num uvs2           :  0
		num colors         :  0
		num indices        :  558
		Skeleton stats:  
			Total Influencers:  578
			Avg # of influencers per vertex:  2.4492
			Highest # of influencers observed:  6, num vertices with this:  6
			exported as 6 influencers
			num skeletonWeights and skeletonIndices:  1888
========= Writing of scene file started =========
========= Writing of scene file completed =========
========= end of processing =========
elapsed time:  0 min, 1.7835 secs

 

For the .babylon file, can I share you with private message ? If you want too, i can share your the .blend file of the skeleton.

Link to comment
Share on other sites

Not necessary for .babylon or .blend just yet, based on your log file.  First you do not have a mesh named 'Striker_AZ_9', so the getMeshByName should never work.  That is a skeleton, and a skeleton does not have a position anyway.  Which mesh do you wish to change the position of? Hopefully, a parent of all the others.

I have not really convinced that this is a bug.

processing begun of skeleton:  Striker_AZ_9, id:  0

 

Link to comment
Share on other sites

A little more explication ...

I have a biped mesh cuted in several parts. Like this :

BabylonJs_man_mesh.thumb.png.5bbc97ef95492ad0583cfa5ea732f05b.png

BabylonJs_man_mesh_cuted.thumb.png.9f946113d629116a67abe3cc638e1c7f.png

 

14 meshes in all.

After that, I made my skeleton. Like that :

BabylonJs_man_mesh_skeleton.thumb.png.5db9ee0aa4c919b61158adfa3005c53c.png

46 bones in all.

Here the name of the object in Blender :

skeleton_params_blender.png.699b2b3f97c77115bd1dbe80d5205c3f.png

After, I had reset the center of each meshes with (with CTRL + A -> Location, and CTRL + A -> Rotation & Scale in Blender) and attached all the meshes to the skeleton with CTRL - P  ->Armatur deform ->  Automatic Weight.

Here, we can see the hierarchy of all objects and the correct parenting after the operation :

mesh_child_hierarchy.png.dfef8785c17e3dcc7c5276c8e06c9758.png

All is good after that in pose mode in Blender.

After export, in my web MVC project, I imported the skeleton in the scene with the function describes in the doc. Then, in the rollback function, when I got my skeleton by index, I imported each mesh to attached them to my skeleton

But now, the rollback function always give me an empty array, If I hadn't my skeleton , I can't attached each mesh to it.

I started this little project few years ago and in the older version of babylon (like 2.2 with the Blender 2.73 or 2.75 ...) , this system worked.

The method has been changed ?

 

Link to comment
Share on other sites

Hi everyone,

JCPalmer had right, I made a mistake :

In my first project, I had a skeleton composed by one mesh and fourteen parts of meshes armor, so when I imported the name of skeleton (wich was like the name of object in Blender), it worked.

For my actual case, I simply imported one of the fourteen mesh of my skeleton to get it and after, in the rollback function,  imported others meshs.

Thanks everybody.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...