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
    • Register
    • Login
    1. Maxon Developers Forum
    2. karthikbp
    K
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 15
    • Groups 0

    karthikbp

    @karthikbp

    0
    Reputation
    12
    Profile views
    15
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    karthikbp Unfollow Follow

    Latest posts made by karthikbp

    • RE: Tile rendering with Cinema 4D

      Hmm, I was able to reassemble the tiles within Cinema 4D as well. Here's the script with reassembly.

      Feel free to chime in if we should not be doing this (performance impact, does not work with different renderers etc)

      import c4d
      import os
      
      doc: c4d.documents.BaseDocument
      op: c4d.BaseObject | None
      
      
      def main() -> None:
          """Renders the scene as a grid of tiles, then reassembles into the final image."""
          # --- Configure these ---
          tiles_x = 2
          tiles_y = 2
          output_dir = os.path.join(os.path.expanduser("~"), "Desktop", "tiles")
          final_path = os.path.join(output_dir, "final_assembled.png")
          # ------------------------
      
          os.makedirs(output_dir, exist_ok=True)
      
          base_rd = doc.GetActiveRenderData()
          full_w = int(base_rd[c4d.RDATA_XRES])
          full_h = int(base_rd[c4d.RDATA_YRES])
          tile_w = full_w // tiles_x
          tile_h = full_h // tiles_y
      
          tile_bmps = {}
      
          for ty in range(tiles_y):
              for tx in range(tiles_x):
                  rd = base_rd.GetClone()
      
                  left = tx * tile_w
                  top_ = ty * tile_h
                  right = left + tile_w
                  bottom = top_ + tile_h
      
                  rd[c4d.RDATA_RENDERREGION] = True
                  rd[c4d.RDATA_RENDERREGION_LEFT] = left
                  rd[c4d.RDATA_RENDERREGION_TOP] = top_
                  rd[c4d.RDATA_RENDERREGION_RIGHT] = right
                  rd[c4d.RDATA_RENDERREGION_BOTTOM] = bottom
      
                  bmp = c4d.bitmaps.MultipassBitmap(full_w, full_h, c4d.COLORMODE_RGB)
                  bmp.AddChannel(True, True)
      
                  print(f"Rendering tile ({tx}, {ty}) region=({left},{top_})-({right},{bottom})")
                  result = c4d.documents.RenderDocument(
                      doc,
                      rd.GetData(),
                      bmp,
                      c4d.RENDERFLAGS_EXTERNAL | c4d.RENDERFLAGS_SHOWERRORS,
                  )
      
                  if result != c4d.RENDERRESULT_OK:
                      print(f"Tile ({tx}, {ty}) failed with code: {result}")
                      return
      
                  # Crop tile — use same coords as region
                  tile_bmp = c4d.bitmaps.BaseBitmap()
                  tile_bmp.Init(tile_w, tile_h)
                  for y in range(tile_h):
                      for x in range(tile_w):
                          r, g, b = bmp.GetPixel(left + x, top_ + y)
                          tile_bmp.SetPixel(x, y, r, g, b)
      
                  tile_path = os.path.join(output_dir, f"tile_{tx}_{ty}.png")
                  tile_bmp.Save(tile_path, c4d.FILTER_PNG)
                  print(f"Saved {tile_path}")
      
                  tile_bmps[(tx, ty)] = tile_bmp
      
          # --- Reassemble: place each tile at its matching position, no flip ---
          print("Assembling final image...")
          final_bmp = c4d.bitmaps.BaseBitmap()
          final_bmp.Init(full_w, full_h)
      
          for ty in range(tiles_y):
              for tx in range(tiles_x):
                  tile_bmp = tile_bmps[(tx, ty)]
                  dst_x = tx * tile_w
                  dst_y = ty * tile_h
                  for y in range(tile_h):
                      for x in range(tile_w):
                          r, g, b = tile_bmp.GetPixel(x, y)
                          final_bmp.SetPixel(dst_x + x, dst_y + y, r, g, b)
      
          final_bmp.Save(final_path, c4d.FILTER_PNG)
          print(f"Saved assembled image to {final_path}")
          c4d.bitmaps.ShowBitmap(final_bmp)
      
          c4d.gui.MessageDialog(
              f"Done! {tiles_x * tiles_y} tiles rendered and assembled.\n{final_path}"
          )
      
      
      if __name__ == "__main__":
          main()
      
      
      posted in Cinema 4D SDK
      K
      karthikbp
    • RE: Tile rendering with Cinema 4D

      I was able to get tile rendering done by running a script like this:

      import c4d
      import os
      
      doc: c4d.documents.BaseDocument
      op: c4d.BaseObject | None
      
      
      def main() -> None:
          # --- Configure these ---
          tiles_x = 2  # columns
          tiles_y = 2  # rows
          output_dir = os.path.join(os.path.expanduser("~"), "Desktop", "tiles")
          # ------------------------
      
          os.makedirs(output_dir, exist_ok=True)
      
          base_rd = doc.GetActiveRenderData()
          full_w = int(base_rd[c4d.RDATA_XRES])
          full_h = int(base_rd[c4d.RDATA_YRES])
          tile_w = full_w // tiles_x
          tile_h = full_h // tiles_y
      
          for ty in range(tiles_y):
              for tx in range(tiles_x):
                  rd = base_rd.GetClone()
      
                  left = tx * tile_w
                  top = ty * tile_h
                  right = left + tile_w
                  bottom = top + tile_h
      
                  # Region at full resolution
                  rd[c4d.RDATA_RENDERREGION] = True
                  rd[c4d.RDATA_RENDERREGION_LEFT] = left
                  rd[c4d.RDATA_RENDERREGION_TOP] = top
                  rd[c4d.RDATA_RENDERREGION_RIGHT] = right
                  rd[c4d.RDATA_RENDERREGION_BOTTOM] = bottom
      
                  # Full-res bitmap — C4D renders region into this
                  bmp = c4d.bitmaps.MultipassBitmap(full_w, full_h, c4d.COLORMODE_RGB)
                  bmp.AddChannel(True, True)
      
                  result = c4d.documents.RenderDocument(
                      doc,
                      rd.GetData(),
                      bmp,
                      c4d.RENDERFLAGS_EXTERNAL | c4d.RENDERFLAGS_SHOWERRORS,
                  )
      
                  if result != c4d.RENDERRESULT_OK:
                      print(f"Tile ({tx}, {ty}) failed with code: {result}")
                      continue
      
                  # Crop the tile region out of the full bitmap
                  tile_bmp = c4d.bitmaps.BaseBitmap()
                  tile_bmp.Init(tile_w, tile_h)
                  for y in range(tile_h):
                      for x in range(tile_w):
                          r, g, b = bmp.GetPixel(left + x, top + y)
                          tile_bmp.SetPixel(x, y, r, g, b)
      
                  path = os.path.join(output_dir, f"tile_{tx}_{ty}.png")
                  tile_bmp.Save(path, c4d.FILTER_PNG)
                  print(f"Saved {path}")
      
          c4d.gui.MessageDialog(
              f"Done! {tiles_x * tiles_y} tiles saved to:\n{output_dir}"
          )
      
      
      if __name__ == "__main__":
          main()
      
      
      posted in Cinema 4D SDK
      K
      karthikbp
    • Tile rendering with Cinema 4D

      Dear community,

      Is there a recommended way to do tile rendering—dividing a large image into smaller pieces that can be rendered quickly and then reassembled into one final image?

      Current Approach:

      We currently use the "Render Tiles" camera to divide an image into smaller pieces, then assemble them using software like FFmpeg or OpenImageIO.
      Here's our detailed step-by-step procedure: https://github.com/aws-deadline/deadline-cloud-for-cinema-4d/blob/mainline/docs/tile_rendering/tile_rendering.md based on this old article.

      Alternative approach:

      But while going over some of the render settings, I stumbled on "RDATA_RENDERREGION_LEFT" (similarly for left, top and bottom).
      Could we use this approach instead—rendering specific regions of the image separately and then assembling them into the final image?

      Has anyone implemented a similar solution or can provide guidance on whether this approach is feasible?

      Thank you for your assistance.

      posted in Cinema 4D SDK python 2026
      K
      karthikbp
    • RE: Bundle fonts with Cinema 4D submissions

      Hey @ferdinand ,

      Sorry for the late replies.

      You can only answer these with end user support and the beta community.

      I will do that. Although I haven't used the beta community yet, I'll post the same question there to better understand what the recommended workflows are right now.

      you would either have to limit the feature to 2024+ clients

      That's good enough for us. Our plugin officially supports only the latest versions of 2024 and 2025.

      posted in Cinema 4D SDK
      K
      karthikbp
    • RE: Bundle fonts with Cinema 4D submissions

      Hi @ferdinand ,

      Thanks for your support so far. I should be able to go forward from here.

      I do have a question though. Is there a reason why the flag "ASSETDATA_FLAG_WITHFONTS" does not appear in the docs? https://developers.maxon.net/docs/py/2025_3_1/modules/c4d.documents/index.html#c4d.documents.GetAllAssetsNew

      The users of our plugin generally have Cinema 4D 2024 and 2025 installed. Will there be any issues using this flag? I tried running the script that you shared above on 2024 and that seemed to work as well so I assume there are no issues on that front.

      Thanks,
      Karthik

      posted in Cinema 4D SDK
      K
      karthikbp
    • RE: Bundle fonts with Cinema 4D submissions

      Hi @ferdinand,

      Thanks so much for your responses and sharing the code above. I really appreciate it! But our plugin users still want to have completed renders.

      Which leads me to wonder if we can convert all the text objects into editable before submission through code? I was thinking of something like this:

      • check if there is a custom font in the scene (this should be possible with the code that you just shared)
      • find all the text objects in the scene
      • convert it to the editable state just before submitting to the render farm (similar to what happens when we select the Text and press 'C')

      Is this approach feasible? Are there downsides for it, would animations stop working with this approach when the object turns into several different objects?

      The article mentioned that if we need to keep the text objects "procedural" we need to install the fonts.

      What does "procedural" mean in this context?

      Thanks again

      posted in Cinema 4D SDK
      K
      karthikbp
    • Bundle fonts with Cinema 4D submissions

      Dear community,

      I'm facing an issue with custom fonts when rendering on a render farm. Is there a way to bundle fonts with a scene so that Cinema 4D automatically uses these bundled fonts when rendering on a render farm?

      I have already reviewed the official documentation: https://support.maxon.net/hc/en-us/articles/1500006439721-Why-don-t-fonts-look-correct-on-machines-rendered-with-Team-Render-but-appear-correct-when-rendered-locally. However, making the text editable (as suggested in the article) is not an acceptable solution for our plugin users.

      Is the following approach possible through the Cinema 4D SDK?

      • Get the location of the fonts used in the scene (Could c4d.documents.GetAllAssetsNew() help with this?)
      • Bundle these fonts with the scene file
      • And then we could:
        • Get Cinema 4D to recognize and use the bundled font while rendering?
        • Or at least install the now bundled font on the render node and then uninstall the font once it's done rendering?

      Has anyone implemented a similar solution or can provide guidance on whether this approach is feasible?

      Thank you for your assistance.

      posted in Cinema 4D SDK python 2025 2024
      K
      karthikbp
    • RE: Path mapping in Cinema 4D using Redshift does not work

      Hi @ferdinand ,

      We are starting to run here in circles. Please consider applying for MRD as lined out here and via chat.

      I think that makes sense. I'll apply for MRD right away.

      posted in Cinema 4D SDK
      K
      karthikbp
    • RE: Path mapping in Cinema 4D using Redshift does not work

      Hi @ferdinand ,

      when for a pyro sim we render the first frame isolated on a node, then it is black unless we do this

      Yup. We only saw an improvement for Pyro scenes at our end. Other scenes work correctly even without adding the doc.ExecutePasses line.

      posted in Cinema 4D SDK
      K
      karthikbp
    • RE: Path mapping in Cinema 4D using Redshift does not work

      Hi @ferdinand ,

      Firstly, I would like to thank you for your help so far and we have now been able to get successful renders. Let me try replying to your previous response.

      I am pretty sure that you have hardcoded paths in your PYRO_OBJECT_CACHE_PATHS parameters as explained above, which will break when you just move the scene, explaining the output

      Yup. I think I forgot to mention this in my previous post but I've been using relative paths while submitting. To get relative paths, we have been using "Window" > "Project Asset Inspector" and then clicking on all the assets and "Localize Filenames". Also we have been saving the scenes with "Save Project with Assets"

      The reason your script is doing what it is doing is because that scene does not have its passes executed (among other things - caches built) when you loaded it from disk.

      Thanking you for sharing this. Adding doc.ExecutePasses(None, True, True, True, c4d.BUILDFLAGS_NONE) seems to have fixed the issue for us and we are able to get successful renders.

      But I've a question. Can we add ExecutePasses before rendering any Cinema 4D scene file? I've not experienced issues so far after adding this line but I'd like to know your thoughts as well if adding this line for even still images (i.e. single frame) has any drawbacks?

      There is also the oddity that Pyro considers frame zero not part of the animation, i.e., you must nudge Pyro to frame 1 for it to start building its caches and therefore in this case also asset messages.

      I've a question about this. What are the drawbacks of not adding doc.SetTime(c4d.BaseTime(1, 30)) ? I've seen that even without adding the line the renders have been successful.

      As mentioned before, you should also use ASSETDATA_FLAG_MULTIPLEUSE and your node material handling is completely wrong (at least form what I saw on GitHub). Both can lead to incorrect renderings.

      Yup. We will be reworking our code to just use relative paths for assets or using the "Save Project with Assets" as you suggested so that we don't need to apply specific path mapping.

      PS: I have resent your validation mail to the e-mail handle your account is bound to.

      Thanks, I've verified the email now.

      posted in Cinema 4D SDK
      K
      karthikbp