Search code examples
three.jsxml3d

Export ThreeJS Geometry to JSON


I need to export Three Geometry to JSON so I can used with xml3D.

I am trying to find the THREE.GeometryExporter() but I can't. Has it been completely deprecated? It is mentioned here

Once I have the Three JSON I should be able to use this converter to obtain the xml3D JSON.

Has anyone tried this before?


Solution

  • You should try the toJSON() method :

    var json = geometry.toJSON();
    

    This method is available for geometries, materials, lights, mesh ...