-
Notifications
You must be signed in to change notification settings - Fork 248
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
BSplineCurve interpolation currently assumes uniform B-splines? #1402
Comments
Hi Mandy, I vaguely recall that we are using the clamped formulation. But there is a conversion between I am not quite following this. What is the expected behavior and what is our current result?
|
Hi Ziyi, I think for enforcing the curve to go through a particular endpoint, we can use a clamped B-spline where we repeat the endpoint 4 times (including itself), so when interpolated, that point is guaranteed to be on the curve. To evaluate a non-uniform B-spline (including the clamped case because towards the end the knots are not uniformly spaced), I believe we need to use Cox-de Boor recurrence to compute things https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.BSpline.html. I have compared Mitsuba's cubic_interpolation and Scipy's B-spline evaluations and they give slightly different results when we have clamped B-splines. For simple illustrations, the code I attached in the first post shows how the basis functions look like on one segment. You can see that only in the first case they look the same as the image containing the formula Mitsuba uses, because there we have uniformly spaced knots. However in the other two cases the basis functions look different, thus using the same formula would result in inaccurate B-spline evaluation I think. |
Hi Mandy, High level comment: I think that Mitsuba merely exposes what is (consistently) implemented by both Embree and OptiX. So there is not much freedom to change the definition, but perhaps we can better document the specifics. Could you take a look at the Bspline curve primitive in OptiX and Embree to see if this identifies the reason for why the resulting curves do not match your expectation? |
1 similar comment
Hi Mandy, High level comment: I think that Mitsuba merely exposes what is (consistently) implemented by both Embree and OptiX. So there is not much freedom to change the definition, but perhaps we can better document the specifics. Could you take a look at the Bspline curve primitive in OptiX and Embree to see if this identifies the reason for why the resulting curves do not match your expectation? |
Hi Mandy, We do not have a Mitsuba implementation of ray-curve intersection (for meshes, we still have the KD-tree if we don't use Optix/Embree). The related code you quoted about cubic interpolation is only to compute derived quantities (uv, normal, differentials) from the preliminary result Optix returns ( If we want the behavior to match the scipy one, an easy workaround would be to write a conversion script so Optix sees processed control points that follows its convention. |
Hi Ziyi and Wenzel, Thanks for the pointer to the Optix documentation regarding their curve representation. They mentioned that their curve representation is defined by cubic uniform B-spline curve (or a quadratic uniform B-spline curve, a Catmull-Rom spline curve, a Bézier curve, or a series of linear segments). Therefore the control points need to be uniformly spaced in the cubic B-spline case, unless they process the control points input to Optix (I couldn't find that information in their guide). Similarly, in the |
Hi, I was wondering whether the current BSplineCurve evaluation
mitsuba3/src/shapes/bsplinecurve.cpp
Line 1122 in 59d980a
The text was updated successfully, but these errors were encountered: