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
    1. Maxon Developers Forum
    2. T1001
    T
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 6
    • Best 0
    • Controversial 0
    • Groups 0

    T1001

    @T1001

    0
    Reputation
    4
    Profile views
    6
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    T1001 Unfollow Follow

    Latest posts made by T1001

    • RE: How to draw HDR bitmaps into a dialog?

      Hi, thank you for the detailed explanation!

      • I'm aware of HDR display capabilities, including 10-bit per channel output (and in some setups, 12-bit or 8+2 FRC displays).
      • I also understand that using GPU APIs like OpenGL or DirectX, it’s possible to display HDR images and perform real-time tone mapping from 32f float data.
      • While I realize that Cinema 4D's standard UI (e.g., GeUserArea) doesn't currently support HDR/OCIO display workflows out of the box, I’m exploring the idea of integrating a custom OpenGL pipeline into a plugin (e.g., within a GeDialog), to handle float texture rendering and tone mapping myself.

      Do you have any suggestions or best practices for integrating this kind of GPU-accelerated image display pipeline in a plugin?
      Any insight into safely embedding an OpenGL context, or managing drawing inside a GeUserArea-backed dialog window, would be appreciated.

      Thanks again for your support and insight!

      posted in Cinema 4D SDK
      T
      T1001
    • How to draw HDR bitmaps into a dialog?

      Thank you again for your help and the great examples on creating images using RGBAf!

      I'm now looking for a way to draw and display HDR RGBAf (or ARGBf) images directly inside a GeUserArea. It seems standard methods like DrawImageRef or DrawBitmap automatically convert HDR images down to LDR, losing HDR details.

      Is there any way to initialize or configure a GeUserArea to support displaying HDR images properly?

      Additionally, if there's an option to achieve this using OpenGL or another hardware-accelerated method, that would be great (though hardware acceleration is not strictly required—just preferred).

      Previously (e.g., R21), there was an OpenGL-related class in cd4_gl.h, but it seems to have been removed from newer SDK versions. What's the current recommended approach?

      Thanks again for your support!

      posted in Cinema 4D SDK 2025 c++
      T
      T1001
    • RE: Transparency Issue with MultipassBitmap in GeUserArea

      Hey @ferdinand ,

      Thank you for the clarification and for offering to share a code example—I'm looking forward to it!

      I’ve been exploring maxon::PixelFormats::RGBA, and it seems like it might fit my use case. Could you confirm if that’s the correct approach?

      Here’s what I aim to achieve:

      • Transparency: Drawing a background image first, then overlaying another image with an alpha channel (transparency).
      • Cropping: Rendering only a specific portion of an image within the User Area.
      • Resizing and other image operations.

      If possible, I’d like to make all image processing hardware-accelerated or leverage parallel processing for optimal performance using the Maxon Image API.

      Could you provide any guidance or examples on how to effectively utilize the API for these purposes? Any insights would be greatly appreciated.

      Thanks again for your support and expertise. Looking forward to your example whenever you get a chance!

      Cheers,
      T1001

      posted in Cinema 4D SDK
      T
      T1001
    • RE: Transparency Issue with MultipassBitmap in GeUserArea

      Thank you for your quick reply and guidance on using the forum.

      I'm working on an existing plugin that needs to render an image in RGBAf format in real-time within the User Area. Currently, it achieves this by converting the buffer to ARGB, then to a BaseBitmap, and finally using DrawBitmap to display it on the User Area. This method is slow, and now I also need to add a background, which isn’t possible with BaseBitmap.

      Following your guidance, I understand I should use the Maxon Image API (maxon::ImageRef) instead of BaseBitmap and use cinema::GeUserArea::DrawImageRef to display it in the User Area instead of DrawBitmap.

      Is there a way to work directly with RGBAf format rather than converting to ARGBf to improve performance?

      Thank you!

      posted in Cinema 4D SDK
      T
      T1001
    • Issue Retrieving Alpha Layer from a Layer in MultipassBitmap

      Hello,

      I'm experiencing an issue with the Cinema 4D SDK when working with layers and alpha layers in MultipassBitmap objects. Specifically, after adding an alpha layer to a layer within a MultipassBitmap, I'm unable to retrieve it using the available functions.

      Here's a simple code snippet demonstrating the problem:

      // Allocate a MultipassBitmap
      AutoFree<MultipassBitmap> bmp = MultipassBitmap::Alloc(800, 600, COLORMODE::ARGBf);
      if (!bmp) return;
      
      // Set parameters for the MultipassBitmap
      bmp->SetParameter(MPBTYPE_NAME, "bitmap");
      bmp->SetParameter(MPBTYPE_SAVE, TRUE);
      bmp->SetParameter(MPBTYPE_SHOW, TRUE);
      
      // Get the first layer of the MultipassBitmap
      // The first layer is automatically created at the [bmp] allocation time
      MultipassBitmap* layer = bmp->GetLayerNum(0);
      if (!layer) return;
      
      // Set parameters for the layer
      layer->SetParameter(MPBTYPE_NAME, "layer0");
      layer->SetParameter(MPBTYPE_SAVE, TRUE);
      layer->SetParameter(MPBTYPE_SHOW, TRUE);
      
      // Get the initial alpha layer count
      Int32 cn = layer->GetAlphaLayerCount(); // Returns 0 as expected
      
      // Add an alpha channel to the layer
      MultipassBitmap* alpha = layer->AddAlpha(nullptr, COLORMODE::GRAYf);
      if (!alpha) return;
      
      // Set parameters for the alpha layer
      alpha->SetParameter(MPBTYPE_NAME, "alpha0");
      alpha->SetParameter(MPBTYPE_SAVE, TRUE);
      alpha->SetParameter(MPBTYPE_SHOW, TRUE);
      
      // Get the updated alpha layer count
      cn = layer->GetAlphaLayerCount(); // Now returns 1, which is correct
      
      // Attempt to get the alpha layer
      MultipassBitmap* tmpAlpha = layer->GetAlphaLayerNum(0); // Returns null pointer unexpectedly
      
      if (!tmpAlpha)
      {
          // tmpAlpha is null, even though we just added an alpha layer
          // This is unexpected behavior
      }
      else
      {
          // Proceed with tmpAlpha
      }
      

      Issue:

      • After adding an alpha layer to bitmap layer, layer->GetAlphaLayerCount() correctly returns 1.
      • However, when I call layer->GetAlphaLayerNum(0), it returns a null pointer.
      • It seems that GetAlphaLayerNum() does not retrieve the alpha layer from within the layer, or perhaps I'm using it incorrectly.

      Questions:

      • How can I retrieve the alpha layer that I've added to a layer within a MultipassBitmap?
      • Is there a specific function to access alpha layers within layers of a MultipassBitmap?
      • Am I missing any steps or using the functions incorrectly in this context?

      Additional Information

      • I'm using Cinema 4D SDK version [2024].
      • The AddAlpha method seems to work correctly, as the layer count increases after calling it.
      • The documentation isn't clear on how to retrieve alpha layers from layers within a MultipassBitmap.

      Any insights or solutions would be greatly appreciated!

      Thank you in advance for your assistance.

      posted in Cinema 4D SDK windows c++ 2024
      T
      T1001
    • Transparency Issue with MultipassBitmap in GeUserArea

      Hello,

      I'm encountering an issue with transparency when drawing a MultipassBitmap over a background in a custom GeUserArea. The transparent areas appear black unless I save the bitmap before drawing it.

      Code Snippet:

      // ARGBfbuf is a Float32 image buffer with ARGB data
      // w = width, h = height
      
      auto Bmp = MultipassBitmap::Alloc(w, h, COLORMODE::ARGBf);
      if (!Bmp)
      {
          // Handle allocation failure
          return;
      }
      Bmp->SetColorProfile(ColorProfile::GetDefaultSRGB());
      
      // Set parameters for the MultipassBitmap
      Bmp->SetParameter(MPBTYPE_NAME, "bitmap");
      Bmp->SetParameter(MPBTYPE_SAVE, FALSE);
      Bmp->SetParameter(MPBTYPE_SHOW, TRUE);
      
      // Add root alpha channel to the MultipassBitmap
      auto rootAlpha = Bmp->AddAlpha(nullptr, COLORMODE::GRAYf);
      if (!rootAlpha)
      {
          // Handle error
          return;
      }
      // Set parameters for the root alpha
      rootAlpha->SetParameter(MPBTYPE_NAME, "rootAlpha");
      rootAlpha->SetParameter(MPBTYPE_SAVE, FALSE);
      rootAlpha->SetParameter(MPBTYPE_SHOW, TRUE);
      
      auto layer = Bmp->GetLayerNum(0);
      if (!layer)
      {
          // Handle error
          return;
      }
      
      // Set parameters for the layer
      layer->SetParameter(MPBTYPE_NAME, "layer0");
      layer->SetParameter(MPBTYPE_SAVE, FALSE);
      layer->SetParameter(MPBTYPE_SHOW, TRUE);
      
      // Add alpha channel to the layer
      auto alpha = layer->AddAlpha(nullptr, COLORMODE::GRAYf);
      if (!alpha)
      {
          // Handle error
          return;
      }
      
      // Set parameters for the alpha layer
      alpha->SetParameter(MPBTYPE_NAME, "alpha0");
      alpha->SetParameter(MPBTYPE_SAVE, FALSE);
      alpha->SetParameter(MPBTYPE_SHOW, TRUE);
      
      for (Int32 y = 0; y < h; ++y)
      {
          Float32* ptr = ARGBfbuf + (y * w * 4);
      
          // Copy image line to the layer
          layer->SetPixelCnt(0, y, w, reinterpret_cast<UChar*>(ptr), COLORBYTES_ARGBf, COLORMODE::ARGBf, PIXELCNT_0);
      
          // Copy alpha line to the alpha layer
          alpha->SetPixelCnt(0, y, w, reinterpret_cast<UChar*>(ptr), COLORBYTES_ARGBf, COLORMODE::GRAYf, PIXELCNT_0);
      }
      
      // In the GeUserArea render function:
      
      // Draw background image
      DrawBitmap(Background, 0, 0, GetWidth(), GetHeight(),
                 0, 0, Background->GetBw(), Background->GetBh(),
                 BMP_NORMAL);
      
      // Draw bitmap with transparency
      DrawBitmap(Bmp, 0, 0, GetWidth(), GetHeight(),
                 0, 0, Bmp->GetBw(), Bmp->GetBh(),
                 BMP_NORMAL | BMP_APPLY_COLORPROFILE | BMP_TRANSPARENTALPHA);
      

      Issue:

      Transparent areas (where alpha = 0.0f) appear black instead of showing the background.
      Workaround:

      Saving the bitmap before drawing fixes the issue:

      // Save and delete the file
      String path = GeGetStartupWritePath() + "/temp.tga";
      Bmp->Save(path, FILTER_TGA, nullptr, SAVEBIT_ALPHA);
      GeFKill(path);
      
      // Then draw as before
      DrawBitmap(Bmp, ...);
      

      Additional Information:

      • I tried using BaseBitmap instead of MultipassBitmap, but BaseBitmap does not support floating-point color modes (COLORMODE::ARGBf), which I need for my application.
      • Even when using BaseBitmap and saving the image, the transparency issue persists.

      Questions:

      1. Why does saving the MultipassBitmap make the transparency work?
      2. How can I achieve proper transparency without saving the bitmap?
      3. Is there a way to handle floating-point ARGB data with transparency using BaseBitmap, or is MultipassBitmap the only option?
      4. Do the SetParameter calls on the Bmp, Layer, root alpha, and alpha layers have any effect on this issue, and am I using them correctly?

      Any insights or solutions would be greatly appreciated!

      posted in Cinema 4D SDK c++ 2024 windows
      T
      T1001