manifold
manifold copied to clipboard
Build multi-material three.js example
I like the simplicity of @makc's first WASM example, so I plan to keep that (and add some explanation and link it from our readme). However, we could also use a more complex example to show how different objects with textures/materials can be combined into a multi-material result.
I think as part of this I'll also integrate <model-viewer>
as the viewer by exporting the three.js scene as a GLB blob. This work will also dovetail nicely with the other work going in to finishing #73.
I'm thinking about how to store the material information. Maybe we can use the registry I mentioned to store the ID <-> material
association, and automatically apply the material when we convert the mesh object to threejs object?
ha, Ive never got back to uvs thing. @ me if you need any help with this, but like small help 👯
As I started to work on an example for this, I realized that A) reapplying vertex properties is quite a pain and B) our MeshRelation
actually loses some data, which will cause more duplication of verts than is necessary. After enough operations you could potentially end up with triangle soup, which is not great for rendering performance, but especially bad if you want to save to a file like GLB and then try to reconstruct the manifold.
I'm now working on @pca006132's suggestion - basically store and update the optional triProperties
and properties
input vectors. I think I'll end up changing the new MeshGL
type to output these vectors (for easy rendering) rather than the manifold triangles.
The next step will be deciding on a data structure that contains the manifoldness information necessary to go back from MeshGL
to Mesh
- this could form a glTF extension that would enable lossless round-trip of manifold meshes with properties through glTF files. I think it can be pretty compact, as we only need to mark which sets of "open" verts/edges need to be merged.