What's the best way to export the geometry for rendering in modern web front-ends?

Hi there,

I am using Geant4 as a computation engine for some 3D web application. I need to export the Geant4 geometry as a text file that can be sent to a modern web front-end for rendering purposes using, e.g., Three.js.

What would be the best export format to do that?

AsciiTree is kind of hard to parse, VRML is deprecated and while an XMLTree format is mentioned here in the docs, I couldn’t find any examples or code snippets for XML generation. Does that driver still exist anyway?

I would be grateful for any advice. For now, my best bet seems to be VRML despite its deprecation.

Yes, I think VRML2FILE is your best bet. We are working on a VTK driver - may be ready for the next release (December).

Thanks for you reply. How would a VTK driver help me? Isn’t VTK a software library? How is that related to exporting to text files?

Also, I forgot to mention that my system is a headless Linux server with no graphics card which might limit my options further.

I would recommend you to look at JSROOT project. They are able to render Geant4 geometry in the Web browsers.

Hi @Joerg ,

Your project of integrating Geant4 in 3D web application seems to be very interesting.
I have also similar idea (and prototypes) on my mind.
I saw that Geant4 was partially ported to webassembly (Compiling Geant4 to WebAssembly. Continuing from my previous post, we’ll… | by Saurav Sachidanand | Medium), so in principle it can also run on the client-side.

Can you write a bit more about your project ?

Kind regards,

So I have written a set of python classes to manipulate gdml, where manipulation includes access to all the 3D mesh data and exports to more modern 3D formats. If formats are missing assimp can be used. So it is usually very easy to export gdml from an application.

So the code is pyg4ometry and can be found on bitbucket.

To answer a question you asked previously. The VTK libraryis a scientific 3D rendering library and can export data to lots of modern formats like usd, obj, gltf etc.