Cubic Spline Looks Jagged
-
I am using a Python generator to create a spline, and I set the interpolation to cubic. However, when the points of the spline are spread out enough, even with the cubic interpolation, it looks more like piecewise linear when getting closer. To it. Look at this video showing what I'm observing:
As you can see, it is certainly smoother than when I set the interpolation to linear, but even when it is cubic, when I zoom in enough, it still looks somewhat jagged, enough to be noticeable. At the end of the video I circle the cursor around the joints on the cubic spline.
Is there some way I can make the cubic interpolation smoother? I would prefer that the cubic interpolation splines doesn't look like a bunch of connected straight line segments.
-
Basically, what I'm looking to do is increase the number of intermediate points. It seems like the default is to use "Adaptive" with an angle of 5 degrees. However, I would prefer for it to be lower (such as one degree), but I don't see any documentation on the SplineObject page on how to do this with the Python generator. Any ideas?
I found this page here, but I don't understand how to use that with the SplineObject.
-
@johntravolski Hi @johntravolski,
thank you for reaching out to us. I am not quite sure if I do understand your question correctly. Although videos are usually not necessary to communicate a problem, I would also like to point out that shared YouTube video is private, i.e., only visible to you and the people you specifically included in your space.
I would prefer that the cubic interpolation splines doesn't look like a bunch of connected straight line segments.
Splines have always to be brought into a discrete form for rendering, as Cinema 4D is being built almost exclusively around discrete geometry, i.e., polygons. Splines itself are in principle smooth and of arbitrary precision; these are represented by
SplineObject
in Cinema 4D. For rendering this has to be discretized, i.e., brought into the form of a "bunch of connected straight line segments". This form of a spline is then represented by aLineObject
.The form of discretization is determined by the spline parameters intermediate points and following. For more information about how to use Cinema's spline objects in principle, please refer to the user manual or contact customer support.
The symbols page you did link to are the symbols for the
SplineObject
parameters. They are used like any other node paramater symbol in the Cinema 4D SDK, in Python most conveniently viaGeListNode.__get/setitem__
. In the context of interpolation/discretization they apply like this for example:# Set the interpolation to adaptive. mySplineNode[c4d.SPLINEOBJECT_INTERPOLATION] = c4d.SPLINEOBJECT_INTERPOLATION_ADAPTIVE # Set the interpolation angle to 5° mySplineNode[c4d.SPLINEOBJECT_ANGLE] = c4d.utils.DegToRad(5.)
Cheers,
Ferdinand -
@ferdinand Thank you, your example worked great. Now I understand how to use those symbols. Lowering the the degrees from 5 to 1 solved the issue. Thanks!
Example for anyone curious:
spline = c4d.SplineObject(total_points, c4d.SPLINETYPE_CUBIC) spline[c4d.SPLINEOBJECT_INTERPOLATION] = c4d.SPLINEOBJECT_INTERPOLATION_ADAPTIVE spline[c4d.SPLINEOBJECT_ANGLE] = c4d.utils.DegToRad(1.)
-
Hello @johntravolski,
without further questions or postings, we will consider this topic as solved by Wednesday and flag it accordingly.
Thank you for your understanding,
Ferdinand