Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Cubic Spline Looks Jagged

    General Talk
    2
    5
    945
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      johntravolski
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • J
        johntravolski
        last edited by johntravolski

        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.

        ferdinandF 1 Reply Last reply Reply Quote 0
        • ferdinandF
          ferdinand @johntravolski
          last edited by

          @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 a LineObject.

          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.

          365de8fc-59fd-41e8-bb38-1c22a853117b-image.png

          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 via GeListNode.__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

          MAXON SDK Specialist
          developers.maxon.net

          J 1 Reply Last reply Reply Quote 0
          • J
            johntravolski @ferdinand
            last edited by johntravolski

            @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.)
            
            1 Reply Last reply Reply Quote 0
            • ferdinandF
              ferdinand
              last edited by ferdinand

              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

              MAXON SDK Specialist
              developers.maxon.net

              1 Reply Last reply Reply Quote 0
              • First post
                Last post