Jump to content

BABYLON.SceneSerializer.SerializeMesh doesn't include geometry?


nittrus
 Share

Recommended Posts

BABYLON.SceneSerializer.SerializeMesh isn't including the most important bit for meshes, the geometry!

I make a cube and then use BABYLON.SceneSerializer.SerializeMesh(cube) and output to console, sure enough no geometry, thus when I use the importer it spits out no geometry found warning..

var thebox = BABYLON.Mesh.CreateBox("thebox", 10, scene);
thebox.position.x=thebox.position.z=112;
thebox.position.y=5;
thebox.id='thebox';
thebox.receiveShadows = true;

var box = BABYLON.SceneSerializer.SerializeMesh(thebox);

That is all I use, shouldn't the geometry be included in the output of SerializeMesh?

I am using Babylon 2.4.0

Here is the JSON stringified output of the serialized mesh that I stored into a file that I'm trying to load from.

{"geometries":{"boxes":[],"spheres":[],"cylinders":[],"toruses":[],"grounds":[],"planes":[],"torusKnots":[],"vertexData":[]},"meshes":[{"name":"thebox","id":"thebox","position":[112,5,112],"rotationQuaternion":[0,0,0,1],"scaling":[1,1,1],"localMatrix":{"0":1,"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":0,"13":0,"14":0,"15":1},"isEnabled":true,"isVisible":true,"infiniteDistance":false,"pickable":true,"receiveShadows":true,"billboardMode":0,"visibility":1,"checkCollisions":true,"geometryId":"98a28707-f3ba-4062-bfc4-47ca8830cf79","subMeshes":[{"materialIndex":0,"verticesStart":0,"verticesCount":24,"indexStart":0,"indexCount":36}],"physicsMass":0,"physicsFriction":0.2,"physicsImpostor":2,"instances":[],"animations":[],"ranges":[],"layerMask":268435455}]}

No vertexData or geometry matching the geometryId..

Link to comment
Share on other sites

2 minutes ago, Deltakosh said:

Undoubtedly :)

I figured considering I found another post for 2.2 where that issue had been addressed, glad it's not just me, lol

Thanks, migrated to alpha 2.5, now lets see if everything still works, considering I'm not using much yet it should..

Link to comment
Share on other sites

31 minutes ago, Deltakosh said:

it should work. How do you export it? from blender? Can you share your blender file if this is the case

I exported it awhile back using the Blender .babylon exporter, it's been working fine up until I try to load it in using 2.5 alpha
I tried to paste the contents of the .babylon file and locked up my browser for 15 minutes lol, so I've attached it instead.

 

girl.babylon

Link to comment
Share on other sites

I am getting with the model using the new? exporter: babylon.js:51259 Uncaught TypeError: Cannot read property 'length' of undefined

I did notice that the  io_export_babylon.py file as the documentation for installing it mentioned that is needed, that hasn't been modified in over 3 months but the exporter zip file for 5.0 has been edited 22 days ago, I have a feeling that  io_export_babylon.py isn't needed with the 5.0 bit and the documentation is thus out of date, so I haven't a clue how to install the new 5.0 plugin. :(

Any pointers on how to go about installing the new exporter to Blender?

Link to comment
Share on other sites

I installed 5.0 Importer after I discovered the _init_.py file was the same type of internals as the old io_export file but it is listing in the Missing script files section of the add-ons section, I am using Blender 2.77 (latest on their website)

I'll try to get Blender 2.76 like the importer is made for.

Link to comment
Share on other sites

No go for Blender 2.76 x64 on Windows 10, it doesn't show up at all under All categories searching for Babylon like it did on 2.77a, I can not find it in any category.
So for some reason the exporter made for 2.76 isn't working on 2.76 for me :(

Thanks again for the help, maybe we can figure out what's going on, wondering if it is just me or not..

Link to comment
Share on other sites

babylon.js:4895 Uncaught Error: Error status: 0 - Unable to load C:\Users\Nittrus\AppData\Local\galaxia\User Data\Default\store\32z32x_1.babylon

This is what I get now, looking in Network on chrome dev console shows it loads it and has a preview of the file contents but for some reason it just not doing anything with it. I wish it had a better way to say what the error actually is, because that says nothing at all of any use. :(

Link to comment
Share on other sites

9 hours ago, Deltakosh said:

ping @gryff who can hopefully help

You called sir ;-)

I've responded to a PM from nittrus and tried to show him the way to install the latest version of the exporter - v5.0.5

Maybe a new tutorial on how to install the new exporter which is a zip file  - no need to unzip it

Remove all old exporters from Blender then :

File -> User Preferences -> Addons Tab -> Install From File -> Point to the downloaded .zip file.

Any chance of getting the girl.blend file ?

cheers, gryff :)

Link to comment
Share on other sites

8 minutes ago, gryff said:

You called sir ;-)

I've responded to a PM from nittrus and tried to show him the way to install the latest version of the exporter - v5.0.5

Maybe a new tutorial on how to install the new exporter which is a zip file  - no need to unzip it

Remove all old exporters from Blender then :

File -> User Preferences -> Addons Tab -> Install From File -> Point to the downloaded .zip file.

Any chance of getting the girl.blend file ?

cheers, gryff :)

It's actually a girl.3ds file, just a free reference model I'm using for the time being.

The main issue now that I am having is the exporting from BabylonJS to file then using ImportMesh to load it, not sure what's going on there.. If I can get that to work I'll be able to progress with my project! :)

As for the girl.babylon file, no go still, I did get the exporter plugin working but the MeshLoader isn't loading in the girl.babylon file just like it's not loading in anything I save to disk like in the above posts.

I get: babylon.js:51259 Uncaught TypeError: Cannot read property 'length' of undefined

So frustrating oi..

I have attached the girl.3ds which I import into Blender then export using the 5.0 exporter which results in girl.babylon as attached!

girl.3ds

girl.babylon

Link to comment
Share on other sites

OK this is odd, I import into Blender the girl model from the OBJ file instead and export and it exports including the textures and loads into BabylonJS fine!
So for some reason it matters what type of model you import into Blender or something relating to settings contained in those formats possibly.

As long as I import as OBJ or save as OBJ then export using 5.0 exporter it works! :huh:

Link to comment
Share on other sites

@nittrus : well personal experience over the years has taught me that that different file formats created in various types of software (from cheap to expensive) don't always play well. Different people write the importers and exporters for different pieces of software - they may not be be thinking the same way.

The only other formats I have ever used (which is rarely) are .obj and .dae - and even then, recent models.

Here is a .babylon that you can use to test your code - base_model

It has a single mesh (called "Body") with a single material, a camera and a light.- see image below

You can use it to test the BABYLON.SceneSerializer.SerializeMesh code

Glad to see the .obj version works :)

cheers, gryff :)

base-figure1.png

Link to comment
Share on other sites

37 minutes ago, gryff said:

@nittrus : well personal experience over the years has taught me that that different file formats created in various types of software (from cheap to expensive) don't always play well. Different people write the importers and exporters for different pieces of software - they may not be be thinking the same way.

The only other formats I have ever used (which is rarely) are .obj and .dae - and even then, recent models.

Here is a .babylon that you can use to test your code - base_model

It has a single mesh (called "Body") with a single material, a camera and a light.

You can use it to test the BABYLON.SceneSerializer.SerializeMesh code

Glad to see the .obj version works :)

cheers, gryff :)

Yeap the Blender exporting issue is resolved! :)

I'll try that object, will try to serialize and JSON stringify to a file and then load using ImportMesh and get back to you on the results.

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...