laanwj on Nostr: thank you ! i'm exporting to GLTF for godot; the shader in godot is working for ...
thank you !
i'm exporting to GLTF for godot; the shader in godot is working for manually entered mesh data
i think i mostly figured it out;
- first, triangulate the mesh
- look up the object in bpy.data, then pass it to bmesh to get connectivity information
- for each edge look up the two adjacent triangles through edge.link_faces
- using this, compute the angle between them with facea.normal.angle(faceb.normal), if this is ~0, they're planar with each other
- then, set the custom attributes for the two vertices comprising the edge, based on this result
- bmesh gives access to custom vertex attributes through `bm.verts.layers.float.get(attribute.name)`
- then, export the resulting mesh with the usual gltf exporter
i still need to see how it all fits together and that the data ends up in the right place in godot, will look into it further tomorrow
i'm exporting to GLTF for godot; the shader in godot is working for manually entered mesh data
i think i mostly figured it out;
- first, triangulate the mesh
- look up the object in bpy.data, then pass it to bmesh to get connectivity information
- for each edge look up the two adjacent triangles through edge.link_faces
- using this, compute the angle between them with facea.normal.angle(faceb.normal), if this is ~0, they're planar with each other
- then, set the custom attributes for the two vertices comprising the edge, based on this result
- bmesh gives access to custom vertex attributes through `bm.verts.layers.float.get(attribute.name)`
- then, export the resulting mesh with the usual gltf exporter
i still need to see how it all fits together and that the data ends up in the right place in godot, will look into it further tomorrow