Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What am I supposed to do with Intersections with outside barycentric coordinates? #462

Open
Raildex opened this issue Oct 3, 2023 · 3 comments

Comments

@Raildex
Copy link

Raildex commented Oct 3, 2023

In my rtcSetGeometryIntersectFilterFunction for a triangle mesh I receive a negative barycentric coordinate.
Since the intersection is outside of the triangle, what am I supposed to do with it?

@svenwoop
Copy link
Contributor

svenwoop commented Oct 4, 2023

In fast mode (default) it can happen that u/v coordinates are slightly out of the triangle. You can just interpolate vertex data as usual using these uv's. If this is an issue, you can also enable robust mode (RTC_SCENE_FLAG_ROBUST) which will not have this issue.

@svenwoop svenwoop closed this as completed Oct 4, 2023
@Raildex
Copy link
Author

Raildex commented Oct 5, 2023

My Scene is set to RTC_SCENE_FLAG_ROBUST and I receive illegal barycentric coords.

Within an Occluded Filter Function I use

auto u = RTCHitN_u(args->hit, args->N, i);
auto v = RTCHitN_v(args->hit, args->N, i);
if (u < 0 || u > 1 || v < 0 || v > 1) {
    throw Exception("Illegal Barycentric Coordinate!");
}

@svenwoop
Copy link
Contributor

svenwoop commented Oct 5, 2023

Please also reproduce the issue in the minimal tutorial.
Is u/v smaller 0 or larger than 1?

@svenwoop svenwoop reopened this Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants