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

    How to get Viewport pixel color

    Cinema 4D SDK
    s26 python
    2
    4
    409
    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.
    • chuanzhenC
      chuanzhen
      last edited by

      Hi,
      I want to know the active viewport color value of each pixel .
      Like the red rectangular area I marked in the figure未标题-1.png

      Thanks for any help!

      相信我,可以的!

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

        Hello @chuanzhen,

        thank you for reaching out to us. In Python there is no really good way to do this. Your best option is to render the BaseDraw you are interested in with RenderDocument with the OpenGL renderer as the render engine. Which will work fine if you only need a viewport representation once in a blue moon, but will quickly become a giant bottleneck if you need access to a viewport framebuffer dozens of times per second. In this case I would recommend moving to C++, as you have there somewhat direct access to the viewport draw buffer with BaseDraw::GetViewportImage.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        chuanzhenC 2 Replies Last reply Reply Quote 0
        • chuanzhenC
          chuanzhen @ferdinand
          last edited by

          @ferdinand Thanks for your hlep!

          相信我,可以的!

          1 Reply Last reply Reply Quote 0
          • chuanzhenC
            chuanzhen @ferdinand
            last edited by chuanzhen

            @ferdinand Hi,i use RenderDocument in python,although it is a little slow and needs to wait for a second, it works successfully.

            Thanks for your help,gif show it works:
            ssss.gif

            相信我,可以的!

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