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

    Add and Remove Edge Loops Poly Object

    Cinema 4D SDK
    python r19
    4
    12
    2.5k
    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.
    • A
      AndreAnjos
      last edited by m_adam

      Hi all,

      I'm trying to understand how to add and remove edge loops from a polygon object, by using a slider in User Data and a Python Tag.

      Like replicating the segments change with a Procedural Cube, for example.
      e53562f1-ba0f-4bc1-9cc2-59ce0ad6968f-image.png

      Not completely sure how I would start this, to be honest.

      Would be very grateful for any direction, please.

      Thank you all in advance!

      Andre

      1 Reply Last reply Reply Quote 0
      • CairynC
        Cairyn
        last edited by

        Procedural objects and arbitrary polygon objects are two very different things.

        The settings in the cube do not add edge loops, they set the parameters under which the whole object is created. "Segments Y = 2" for example would mean (simplified): On the whole height of the cube, generate three points for every vertical, at Y positions -height/2.0, 0.0, and +height/2.0.

        This is not difficult if you know the rules by which the parametric object is constructed.

        Adding arbitrary loops to a poly object of which you don't know the theoretical structure requires a ton more work. First, you can't guarantee that the object only has quads and no poles, so your algorithm needs to consider these cases. Then, there may be ambivalences in what polygons your additional edge loop shall branch to (see loop cut issues). Then, what should the slider even do? Do you want to slice the object in one direction in regular intervals? That would require a complete retopology of the object.

        Unless you are a excellent programmer and have a very good understanding of 3D and know exactly what you want to achieve, you are probably wasting your time.

        1 Reply Last reply Reply Quote 0
        • A
          AndreAnjos
          last edited by

          Hi @Cairyn ,

          Thank you very much for that!
          Good to know from someone with more experience than myself. 😁

          We have a rig that already works with procedural objects, which is great. But at the moment if we want to have flexibility with it, I need to be able to control specific points/polygons of the objects to give animation the flexibility they need. I'm just trying to get a solution that takes aspects of both procedural and polygon objects, thus my question.

          Have to think in a different way for now!

          Thanks again!

          Andre

          1 Reply Last reply Reply Quote 0
          • CairynC
            Cairyn
            last edited by

            Maybe the question is just too broad... do you really need edge loops in arbitrary polygon objects, or can you perhaps construct your needed objects parametrically yourself? In which case you would have full control over the way they're constructed...

            Okay, "animation" sounds more like character objects, in which case this solution may be difficult. You may want to post some examples with images what loops you actually want to insert where. And "rig"... hmm, do you want to make geometrical changes on the fly in some XPresso or Python tag? This is always fairly critical; you may need to create a generator object to change virtual objects. (Just throwing around a few ideas.)

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

              Hi,

              I mostly agree with @Cairyn and I also think that your question lacks definition regarding what you want and what you have. You should post code, pictures and/or scenes for that "rig" you have (not quite sure what that means in that context).

              I would however like to point out (@Cairyn already did this, but I want to put extra emphasis on it 😉 that subdividing a polygon is rather trivial, the harder part is finding the edge loop from whatever input data you have (the easiest case would be you having a a polygon loop as a selection).

              But the main problem is all the dependent data you have to deal with and potentially update - texture coordinates, weight information, face orientation and so on. This all makes writing such a functionality not a particularly hard, but rather laborious task.

              And last but not least, a Python Tag doesn't seem to be the right choice for this kind of tool in the first place, due to its constant execution. A script manager script, a Python Generator Object or a fitting plugin type would be much appropriate choices.

              Cheers,
              zipit

              MAXON SDK Specialist
              developers.maxon.net

              1 Reply Last reply Reply Quote 0
              • r_giganteR
                r_gigante
                last edited by

                Hi @AndreAnjos thanks for reaching out us.

                We indeed appreciate the support offered by @Cairyn and @zipit to define the perimeter of your request but I can't add anything unless you come with a specific request on API rather than on the overall workflow design.

                Cheers, R

                A 1 Reply Last reply Reply Quote 0
                • A
                  AndreAnjos
                  last edited by

                  Hi all,

                  Thank you very much for your help and apologies for the slow reply (been off a few days)!

                  You are absolutely right, my question is too broad.
                  Had a few days to think about other options and perhaps I'm overthinking this.

                  Nevertheless, I will share with you the specifics.

                  • Use of 3 basic (procedural) shapes: cube, tube and cylinder.
                  • Shapes require to be changed dynamically to meet artists needs and required shapes. For example, a tube should be able to bend meet a 0, 90 and 180 degrees angle, without losing volume, while still be able to be shaped with secondary controls.
                  • Animators will need to use the rig to make the changes to this shape with all necessary controls. This could be with user data sliders or splines.
                  • Poly Counts needs to change depending on the shot and render software (Unreal or Cinema)

                  So this is the current rig:
                  d7fb9676-ae41-4f7c-b75d-55c808201299-image.png
                  You have a dynamic change of shapes that supports all the parameters that you see in the image.
                  It does lack the secondary controls needed to shape it as we want and this is a big point as I currently can't create the nuances with Xpresso.

                  A possible solution would be to use three poly objects with different levels of subdivisions that are controlled with the same rig. Keep some elements procedural, as the bevel and bend deformers and connected all by Xpresso.
                  This would give us the benefit of accessing the point information and deformed it manually for animation as we need.

                  Also as @zipit said, this can also be a potential design, if rest fails

                  And last but not least, a Python Tag doesn't seem to be the right choice for this kind of tool in the first place, due to its constant execution. A script manager script, a Python Generator Object or a fitting plugin type would be much appropriate choices.

                  I understand that this is a design question and not API, so please delete if it's inappropriate. ☺

                  Will come back with some results!

                  Thank you all again for your time!

                  Andre

                  1 Reply Last reply Reply Quote 0
                  • CairynC
                    Cairyn
                    last edited by

                    Does your setup react to the global Level of Detail controls?
                    If not, could you use a local LOD object with differently subdivided children?

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

                      Hi,

                      I am somehow even more confused than before, lol. You want the geometry in the screenshot to be subdivided, right? And the geometry is somehow procedurally generated by a Xpresso rig?

                      I do not quite understand why you cannot just implement that choice of subdivision in that rig? Doing it after the fact seems incredible cumbersome, because this is probably not a static polygon mesh, but some kind of generator object that your rig produces there.

                      I am also just seeing now that you are asking also for a unsubdiving feature in your first post, which is quite a can of worms for an arbitrary mesh. I would go for your LOD-thingy if you see there a solution, because it is probably the fastest solution for you.

                      Cheers,
                      zipit

                      MAXON SDK Specialist
                      developers.maxon.net

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        AndreAnjos @Cairyn
                        last edited by

                        Hi @Cairyn,

                        Does your setup react to the global Level of Detail controls?

                        I'm afraid not! It's all done by changing the number of segments for the objects.

                        If not, could you use a local LOD object with differently subdivided children?

                        I'm currently exploring this. I think I will be able to do that. Need to make sure it it does not break with the rest of setup 🙂
                        Will keep you posted!

                        Cheers!

                        Andre

                        1 Reply Last reply Reply Quote 0
                        • A
                          AndreAnjos @ferdinand
                          last edited by

                          Hi @zipit,

                          I am somehow even more confused than before, lol. You want the geometry in the screenshot to be subdivided, right? And the geometry is somehow procedurally generated by a Xpresso rig?

                          I'm sorry if it made it more confusing! 😄
                          The Xpresso just connects the userdata to the generator object. So the subdivisions are controlled by changing the object's number of segments.

                          I do not quite understand why you cannot just implement that choice of subdivision in that rig? Doing it after the fact seems incredible cumbersome because this is probably not a static polygon mesh, but some kind of generator object that your rig produces there.

                          That's correct! Which leads me to think that having a poly object in the first place is probably the best way.

                          I am also just seeing now that you are asking also for a unsubdiving feature in your first post, which is quite a can of worms for an arbitrary mesh. I would go for your LOD-thingy if you see there a solution, because it is probably the fastest solution for you.

                          Yes, that's what I currently testing. I agree as that being the best way to switch from different resolutions.
                          Hopefully, this will work.

                          Will keep you posted!

                          Thanks again!

                          Andre

                          1 Reply Last reply Reply Quote 0
                          • A
                            AndreAnjos @r_gigante
                            last edited by

                            Hi @r_gigante,

                            Not to worry! I understand! 😃

                            Thanks for your help!

                            Andre

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