Open mandyxmq opened 23 hours ago
Hi Mandy,
I vaguely recall that we are using the clamped formulation. But there is a conversion between v_local
and v_global
. For instance, if we want an endpoint p0
as the curve endpoint, (I think, haven't checked) we need to put control points like (2p0-p1
, p0
, p1
, p2
, ...).
I am not quite following this. What is the expected behavior and what is our current result?
this evaluation is no longer accurate when we have repeated control points at the end
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?
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, I was wondering whether the current BSplineCurve evaluation https://github.com/mitsuba-renderer/mitsuba3/blob/59d980adcaec77e78120239f7eaee7be28e55ed0/src/shapes/bsplinecurve.cpp#L1122 assumes the control points are uniformly spaced (same as in the formula in the attached image). I tested using simple 1D examples that this evaluation is no longer accurate when we have repeated control points at the end (for clamped B-splines) or non-uniform spacing. I was wondering if a more general evaluation is desired in this case as control points are not guaranteed to be uniformly spaced. Thanks!