Exporters to export LinesMesh

The C# exporters (GitHub - BabylonJS/Exporters: Exporters for Babylon.js and gltf file formats) do not currently support lines meshes.
Is there a plan to add this? I’m happy to contribute but may need some guidance on how to actually recognise a LinesMesh when given a generic BabylonMesh.
I’m looking at GLTFExporter and will experiment with an extension function for now.
Cheers.

Adding @Drigax and @bghgary for guidance.

Welcome and thanks a lot for your proposed contribution :slight_smile:

Hi @geometry, welcome to the community!

Currently I don’t plan to add this feature, but I’d be more than happy to help guide you :slight_smile:

The exporters go from Max/Maya -> Babylon serialized format -> glTF.
I’m personally not sure how a line mesh is represented in Max and Maya, but if we can retrieve the geometry and lines properties, we should be able to translate that data to the babylon format:

https://doc.babylonjs.com/api/classes/babylon.linesmesh

since LinesMesh inherits from Mesh, it should be pretty straightforward to add another serialization class to the C# exporters to handle it. We may just need a way to retrieve from 3dsMax/Maya whether or not the mesh in scene is a LinesMesh.

The important parameters we need to preserve would be the geometry (vertex position, connectivity indices, and color).

Afterwards, we would most likely lose data translating to glTF if there are any other parameters like thickness, as we only support the gl Line primitive:

So we may not be able to preserve any specific line thickness without converting to rectangular prisms, but this definitely seems possible.

Got any sample scenes to start off of?

2 Likes

Hi,
Thanks for your support. We’re developing an exporter for our own CAD system using the Max/Maya exporters for inspiration.
CAD parts tend to show edges as well as faces and contain wireframe dimensions and other markup.

I suspect we’ll add a bunch of intelligence in the online viewer component to do things like constant-sized billboards and dimension arrowheads. Line-thickness will doubtless become a problem.

We now have line meshes coming through. I guess we’ll tidy up the code and issue a pull request?
Steve

1 Like

I had experimented getting vertices out of Blender instead of faces for hair. Yes, actual line meshes are worse than just being one in width. When you rotate your view, they tend to disappear.

I eventually went to converting to an extruded triangle, but did not export that. I exported the chain positions, then had code on the load side construct. In addition to export compactness, upside to that is that you can also do things like change the width, vertex colors afterward. Still to many vertices for this application, so mothballed. here was the test scene from then.
https://palmer-jc.github.io/scenes/QueuedInterpolation/hair_coloring/index.html

1 Like

Sounds great, I like having an evergreen release status for the 3dsMax and Maya exporters, If it works, I’ll be happy to review it.