I created geometry nodes and want to export them in gltf/glb format (to use with three.js). The important thing here is that as a result I need to have many individual sprinkle meshes with position and !!!rotation!!!
To my understanding such operation requires converting the instances to actual meshes (because geometry nodes are not supported outside of blender).
I figured that I would do the following:
- Apply the geometry nodes modifier and get one big mesh built of many small sprinkles.
- Separate the output mesh with 'Separate by lose parts' tool. This gives me many meshes of individual sprinkles. Great so far.
- Set origin for each mesh to the center of mass, so that the position of meshes is correct.
But the actual output of such operations is many meshes with correct postition but the rotation is set to [0, 0, 0] which is not what I am looking for. Every mesh also has a different geometry (which makes the sprinkles visually rotated while rotation set to 0). Ideally I would like all of them to have the same geometry but the rotation specified relatively to the original mesh which I was gaining the instance geometry from.
Do you have any suggestions or ideas? I think of 3 possible solutions.
- Generating many individual meshes directly from geometry nodes. This could preserve the position and rotation with no need to 'separate by loose parts' and 'set origin to center of mass.
- After doing all steps that I listed, recognizing that all these meshes are in fact the same geometry and rotating them relatively to the original mesh.
- Somehow saving the rotation vector calculated inside the geometry nodes to vertices (or something else?). In result the sprinkle meshes would still have the rotation = [0, 0, 0], but the vertices would store the data about rotation and I would then handle it programatically.
EDIT Actually a thing that would also work for me is if I could print the list of all positions and rotations for each point/instance directly from geometry nodes.