Jump to content

Serialize ground probleme


Dad72
 Share

Recommended Posts

I have some problem when I serialize a terrain. then the serialized data is not reloaded with ImportMesh.

As soon as there is a texture on the ground, the serialization it passes bad. The only time it works is when a texture is not added. For exemple :

With no material :

If I take the case of a simple ground with CreateGround()  it will work (Because no textures are added here) . But if I create now with CreateGroundFromHeightMap() it will not work (Here we add a texture)

http://www.babylonjs-playground.com/#1SQFJP#16

With TerrainMaterial :

If I create a terrain and use TerrainMaterial, this time neither CreateGround() and CreateGroundFromHeightMap() will not work for serialization for reloading with ImportMesh (Here we add textures with the materials)

https://www.babylonjs-playground.com/#E6OZX#191

With MixMaterial :

Same thing if I use MixMaterial instead CreateGround() and CreateGroundFromHeightMap() will not work for serialization for reloading with ImportMesh  (Here also we add textures with the materials)

https://www.babylonjs-playground.com/#E6OZX#190

Thanks

Link to comment
Share on other sites

I wanted to serialize only the mesh and not the scene because the file is bigger. I record using PHP and I wanted to create a file with just the mesh because my editor create the basic scene with camera, light ....

Why this does not serialize the mesh correctly, should it? Is there a bug in the mesh serializer?

Link to comment
Share on other sites

Ok, I find why. we would say that the material that is relaunching in the json serializer is missing.

If I do that, it works:

let serialization = BABYLON.SceneSerializer.SerializeMesh(ground);
serialization.materials = [];
let str_serialized = JSON.stringify(serialization);

I think that is missing in the mesh serializer

https://www.babylonjs-playground.com/#E6OZX#196

Link to comment
Share on other sites

But this will create a bug if the material is not serialized, because the name is referenced in the serialized file (in "materialId":"terrainMixMaterial"), but it does not exist of material which is search by the serializer by searching for terrainMixMaterial, so this creates a bug.

because add serialise.materials = []  => all material is serialized. Maybe an option would help.

so I think there is a bug because no material is serialized with the mesh.

I think that when we serialize a mesh, the texture it contains must also. Why else a material should not be serialized with the mesh? We lose all the mesh that is incomplete. When we serialize a scene, we serialize all the materials as well.

Thanks

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