Skip to content

How to obtain the barycentric coordinates of the intersection? #1195

Closed Answered by njroussel
woAIxuexiSR asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @woAIxuexiSR

Indeed, the SurfaceInteraction3f struct only holds barycentric coordinates in its uv field if the mesh is untextured. If the mesh is textured, then uv is the texture coordinate.
You could theoretically recompute the barycentric coordinates from the si.p and si.prim_index fields, but that would require access to the mesh's datastructures.

If you need this information, I think the easiest way is to add an extra field to the SurfaceInteraction3f struct, fill it during the ray-intersection routing and apply that change wherever required.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by woAIxuexiSR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants