What is Nostr?
laanwj /
npub1p23…rnl6
2024-11-07 20:41:29
in reply to nevent1q…njhl

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 bp​y​.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(attri​bute.n​ame)`
- 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
Author Public Key
npub1p23eukh0nxsqpfaakz6fj9vvj27y4gs0kevnrffdq4d4adkl7uuq7crnl6