Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Recent
    • Tags
    • Users
    • Login

    How to compute Redshift MoGraph index ratios (RSMGIDRatioColor)?

    Scheduled Pinned Locked Moved Cinema 4D SDK
    2025
    8 Posts 3 Posters 68 Views
    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.
    • B Offline
      BruceC
      last edited by ferdinand

      Hi,
      Can you help me find out the rule of how RSMGIDRatioColor works when it is applied to a cloner in Honeycomb mode? According to the document here: The index ratio of the clone as a grayscale color. I would expect the greyscale color for each instance would be (index/total number) or (1 - index/total number). This means instances color will from pure black to white or white to black. And when cloner is in Linear mode, it matches this as below snapshot shows.

      c6af6a9e-081a-40ab-980c-a944405f9869-image.png

      However, when the cloner is in HoneyComb mode, the first instance looks like pure white, however, the last instance is far from black as the below snapshot shows.

      420125c3-b9e3-45d9-baf5-483f4a9e4ff4-image.png

      So I'm wondering what the rule of RSMGIDRatioColor is for each instance when cloner is in Honeycomb mode.

      Thanks!

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

        Hey @BruceC,

        Thank you for your question. I just checked, and what RS calls the index ratio does not really have much to do with indices and is instead based on the uvw coordinate of a particle. This might be a bug, but you would have to talk with the Redshift team for that. Anyway, find below some Python code to emulate computing that 'index ratio'.

        Cheers,
        Ferdinand

        Result

        I emulated your setup:

        dfbeebb4-cce6-4ca1-bf31-76e78d3966c1-image.png

        Code

        import c4d
        import mxutils
        
        doc: c4d.documents.BaseDocument  # The currently active document.
        op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.
        
        
        def main() -> None:
            """Called by Cinema 4D when the script is being executed.
            """
            data: c4d.modules.mograph.MoData = mxutils.CheckType(c4d.modules.mograph.GeGetMoData(op))
            uvw: list[c4d.Matrix] = data.GetArray(c4d.MODATA_UVW)
            for i in range(data.GetCount()):
                # That is how the 'index ratio' is computed, it is effectively just the shifted x-component
                # of the uvw coordinate of the particle. The color is then just (ratio, ratio, ratio). Not very
                # 'indexy'.
                ratio: float = 1 - uvw[i].x
                print(f"{i}: {ratio}")
        
        if __name__ == '__main__':
            main()
        

        MAXON SDK Specialist
        developers.maxon.net

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

          FYI: The RS team just told me that they agree that this is a bug and that they will fix this. Please reach out via our beta forums for details.

          So, the code I showed you has an expiration date.

          MAXON SDK Specialist
          developers.maxon.net

          1 Reply Last reply Reply Quote 0
          • B Offline
            BruceC
            last edited by

            Thank you for the reply, Ferdinand.
            I don't have access to the beta forums, can I assume the fix will make RSMGIDRatioColor act something like below for HoneyComb?

            (index/total number) or (1 - index/total number)
            

            Cheers

            i_mazlovI 1 Reply Last reply Reply Quote 0
            • i_mazlovI Offline
              i_mazlov @BruceC
              last edited by i_mazlov

              Hi @BruceC,

              correct, the RSMGIDRatioColor is (tentatively) expected to behave as index / total_number.
              You can check the index in the Transform -> Display attribute of the cloner object (check the screenshot below).

              Cheers,
              Ilia

              0deba902-1d30-474c-b518-aafd6ce079dd-image.png

              MAXON SDK Specialist
              developers.maxon.net

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

                Hey Bruce, multiple people in your company have access. When you do not, reach out to us, so that we can set you up.

                MAXON SDK Specialist
                developers.maxon.net

                B 1 Reply Last reply Reply Quote 0
                • B Offline
                  BruceC @i_mazlov
                  last edited by

                  @i_mazlov Thank you for confirming, Ilia!

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    BruceC @ferdinand
                    last edited by

                    @ferdinand Thanks!

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