0
votes

I'm trying to write an exporter in Maxscript, to JSON format, to parse in Three.js. I've found very little documentation. But about this: https://github.com/mrdoob/three.js/wiki/JSON-Geometry-format-4

Do I have to use BufferGeometry or geometry? What's the difference? Where are the materials?

1
Assuming by "raw webgl" you mean you're writing all of the code yourself, not using any helper libraries, then there really isn't any sort of "standard" json geometry format. You just need to structure the geometry data in a way that makes it simple to read it back in again. For example, for each mesh you might export the vertex positions as an array, followed by the indices for each face, followed by any additional data you need (vert colour, UVs, etc) each as their own array. Then in js you can just loop over these structures and pull in the data.benjymous

1 Answers

1
votes

You may want to take a look at the max exporters that come with Three.js. The only problem I have found with it is that it does not respect smoothing groups when exporting.
github.com/mrdoob/three.js/tree/master/utils/exporters/max

To answer your questions, You should use BufferGeometry. I think BufferGeometry is a better version of Geometry and everything is moving towards it. Materials are not stored in the Three.js JSON format AFAIK.