3d Model Customized format

Hi all,

Kindly have a look into the link given below.

https://cc.mgmotor.co.in/mgexpert/#/e-model/home?utm_source=mgmotors&utm_medium=web&utm_campaign=expert

I am referring this project for my learning purpose. I would like to know what is format of the model used here.

I didn’t see any .gltf or .glb loaded but Draco GLTF appears to be loaded.

image

It seems the file format is “one3d”:

image

But I don’t know this file format.

yeah. There is no format with the name of one3d. But, It looks like Babylonjs when we see the output. So, how to convert a normal glb or gltf model into a custom format.

yup definitely looks like babylon with Spector cc @thomlucc :slight_smile:

2 Likes

Like here

3 Likes

Wow. This is awesome @MarianG . I think, this is what I need. But I couldn’t understand this. Can you please help me to understand this?

The main ideea is that you need to create your own loader for your own format. The easiest way is to change gltf extension to something else and use gltf loader to load it. In the above example is a babylon string which is exactly like a model.babylon file, you can do your changes to it, change its extension to model.mybabylon and then create your own importer or extend an existed one

Yeah @MarianG , I saw the code. you have used a json string to create a model, then encrypt with that code with a password and decrypt it while loading it. My question is how to encrypt a normal glb model into a json like you have used in the sample.

I’m afraid you can’t with glb. But you can with gltf, because gltf is already a json + bin file, so you already have the json

1 Like

@MarianG Thanks for your quick reply. sorry, I think I missed to communicate it. In the sample project, we can see .one3d format files. How to create these kind of own format.
That is my question. i.e.,. how to convert a normal predefined format (glb, gltf, etc) into our own format.

We can download the model with our blob file using below code. But I am under confusion that how to get the blob file from loaded model.

BABYLON.Tools.Download(blob, "sample.myOwnFormat");

I don’t know one3d format :pleading_face: It looks like a gziped file

1 Like

no @MarianG . That is not a defined format. That is just like a variable name. we can give anything. please have a look into the link given below. I just added a single line with your code. with this code, we can download the imported .babylon json string as a custom formatted(.myownformat)

then we can import this newly generated file into our project like mentioned in the below link.

So, we can create our own format 3d files from the .babylon format file easily. We can create .babylon file from normal .glb with the help of sandbox tool. But now, the only problem is, while exporting the .babylon file from the sandbox tool, the size of the file is very very bigger while comparing with the loaded .glb file. How to convert the glb file to .babylon file with the same size of the glb file?

I would say this is almost expected. Babylon format has alot more properties than glb… And another reason can be that if you are using some compression on glb, maybe you lose it when export as babylon.

Just make sure that your server sends it with gzip compression.

1 Like

sorry @labris . I think I missed to highlight it. I am doing the conversion through the Babylonjs Sandbox only. I am importing a .glb file which is around 412 kb. Then I export it as a .babylon file which is around 22mb. I think, Gzip compression will not work for this much of size reduction. I think the issue here is the environment file, camera, etc also exported along with model while we export as the .babylon file.

Did you find out a way how to convert one3d file to any normal 3d format? And can you please explain me the process or share a tutorial for it because i don’t have any knowledge of coding so it’s hard to understand the process.

No, we can’t convert that custom formatted file back to normal 3d format unless you know about the encryption code used while conversion.

Ok, thank you for the update