You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
When raycasting against and indexed mesh I am unable to differentiate between two vertices when both vertices start at the same index.
I'm trying to use triangle_index to lookup some attribute data but it looks like, for indexed meshes, triangle_index contains the index after its already been mapped meaning I can't derive the index of the other verts in the tri.
Extra, problem specific, details in case the context is helpful.
Details
I'm trying to get some attribute data from a mesh that I'm raycasting against. I was hoping to use the `triangle_index` field to derive the indices in the attribute I needed to lookup.
I'm having an issue where `triangle_index` is not changing, despite raycasting different triangles. You can see in the attached images I am hitting two different triangles (see the value of `intersection_data.triangle[1]`) but the `triangle_index` field remains the same between both tris.
The second log is my (incorrectly) derived indices to lookup the attribute with.
The final log is my attempt at calculating the position attribute at the hit location using my (incorrectly) derived indices, the position attribute buffer and the barycentric coordinates. It should be equal to the
Hit 1 (Top Left):
Hit 2 (Bottom Right):
Solution?
Not 100% certain but it seems like the solution is we'll need to return all 3 triangle indices as [usize; 3], growing the struct by 2 usize. I'm happy to PR if this is suitable but I worry I might be missing something as well. Can you let me know your thoughts? And thank you for maintaining this great library :)
Description
When raycasting against and indexed mesh I am unable to differentiate between two vertices when both vertices start at the same index.
I'm trying to use
triangle_indexto lookup some attribute data but it looks like, for indexed meshes,triangle_indexcontains the index after its already been mapped meaning I can't derive the index of the other verts in the tri.Extra, problem specific, details in case the context is helpful.
Details
I'm trying to get some attribute data from a mesh that I'm raycasting against. I was hoping to use the `triangle_index` field to derive the indices in the attribute I needed to lookup. I'm having an issue where `triangle_index` is not changing, despite raycasting different triangles. You can see in the attached images I am hitting two different triangles (see the value of `intersection_data.triangle[1]`) but the `triangle_index` field remains the same between both tris.The second log is my (incorrectly) derived indices to lookup the attribute with.
The final log is my attempt at calculating the position attribute at the hit location using my (incorrectly) derived indices, the position attribute buffer and the barycentric coordinates. It should be equal to the
Hit 1 (Top Left):
Hit 2 (Bottom Right):
Solution?
Not 100% certain but it seems like the solution is we'll need to return all 3 triangle indices as
[usize; 3], growing the struct by 2usize. I'm happy to PR if this is suitable but I worry I might be missing something as well. Can you let me know your thoughts? And thank you for maintaining this great library :)