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

    Can we draw alpha image in viewport

    Scheduled Pinned Locked Moved Cinema 4D SDK
    windowspython2026
    4 Posts 2 Posters 20 Views 2 Watching
    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.
    • DunhouD Offline
      Dunhou
      last edited by

      Hey,

      I want to draw images with alpha in viewport, but what I got is a image with black bg, I already test DrawTexture flag DRAW_ALPHA_NORMAL_FROM_IMAGE and DRAW_ALPHA_FROM_IMAGE, they will not work.

      Can I draw bitmaps with alpha in viewport, like the little icon under the mouse?

      Cheers~
      DunHou

      https://boghma.com
      https://github.com/DunHouGo

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

        Hey @Dunhou,

        Can you please share code and possibly a bug report? Alphas with DrawTexture have a troubled history but when I tried in the py-ocio_node_2025 example right now, it works for me.

        Cheers,
        Ferdinand

        Result

        We draw the little cube icon with alphas next to the existing drawing examples.
        3e9a125b-4fce-495e-8d79-470a306b51b9-image.png

        Code

        I just added the highlighted code in the py-ocio_node_2025 example.
        81d64c88-0967-41d2-8f90-2520431af192-image.png

                        # Draw the texture and a label for the flag below it.
                        bd.DrawTexture(self._bitmap, points, texColors, texNormals, texUVs, 4, 
                                       c4d.DRAW_ALPHA_NORMAL, flags)
        
                        # --- new code: start ---
                        
                        icon: c4d.bitmaps.BaseBitmap | None = c4d.bitmaps.InitResourceBitmap(c4d.Ocube)
                        if icon:
                            points: list[c4d.Vector] = [
                                c4d.Vector(xb, ya, 0),
                                c4d.Vector(xb + 20, ya, 0),
                                c4d.Vector(xb + 20, ya + 20, 0),
                                c4d.Vector(xb, ya + 20, 0)
                            ]
        
                            bd.DrawTexture(icon, points, texColors, texNormals, texUVs, 4, 
                                           c4d.DRAW_ALPHA_NORMAL, flags)
        
                        # --- new code: end ---
        
                        bd.DrawHUDText(xa, yb, "USE_PROFILE_COLOR" if isProfile else "NONE")
        

        edit: I made my changes part of the official code example, as I thought it does not hurt to show that there too.

        MAXON SDK Specialist
        developers.maxon.net

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

          Sorry for my stupid question @ferdinand , I should use c4d.DRAW_ALPHA_NORMAL but not c4d.DRAW_ALPHA_FROM_IMAGE.

          Shame on me 😂

          Cheers~
          DunHou

          https://boghma.com
          https://github.com/DunHouGo

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

            I do not think that DRAW_ALPHA_FROM_IMAGE should not work. I just picked DRAW_ALPHA_NORMAL because it is the "most default one" out of the DRAW_ALPHA flags. I will have a look later. But you can for now probably just use DRAW_ALPHA_NORMAL.

            MAXON SDK Specialist
            developers.maxon.net

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