Announcement

Collapse
No announcement yet.

Alpha blending of two VRayImages

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Alpha blending of two VRayImages

    We would like to add a logo on top of the rendered image. The logo has some transparency. The rendered image has VRayImage type, which in turn has is a draw() function, but this function does not support alpha. Is there is a way to preserve the transparency of the logo and combine it with the rendered image?

    We could convert the image to opencv mat and then add the logo using opencv functions, but this additional conversion will considerably affect the interactive performance. The performance is very critical in our case.

    P.S. We use Python 2.7 bindings of the latest V-Ray Next SDK.

  • #2
    We can quickly add alpha blending to the draw() function.

    Comment


    • #3
      Hello Stanislav,

      thank you for the prompt reply. It sounds great!

      Would it be a boolean option to use the alpha of the image to be drawn or an extra float parameter to globally control the transparency of the drawn image? Or may be both?

      P.S: You could also consider adding some blending modes like screen or multiply.

      Best regards,
      Alex

      Comment


      • #4
        Hello Alex,

        We haven't decided yet what exactly to implement but we would like to keep it as simple as possible and extend it in the future. Does your logo has a meaningful alpha channel we could use directly for alpha blending?

        Best regards,
        Stan

        Comment


        • #5
          Hello Stan,

          yes it has a meaningful alpha channel. The idea is to use a texture with alpha channel saved in png format. The image would then be loaded via the createFromBuffer(image_binary_data, "png") function and blended with the current frame buffer.

          Best regards,
          Alex

          Comment


          • #6
            Hello Alex,

            We'll probably add this in the nightly builds after the 4.3 release which is planned for the next week.

            Best regards,
            Stan

            Comment


            • #7
              Hey Stan,

              thank you for the good news!

              Best regards,
              Alex

              Comment


              • #8
                Added a fast alpha-blending mode. It should be available in next (Monday) nightly builds. We may add more blending modes in the future.

                Comment


                • #9
                  Thank you Stan, I will try it!

                  Comment


                  • #10
                    Hey Stan,

                    just wanted to give you some feedback.

                    It works like a charm gives us at least x2 performance gain in comparison to 'OpenCV-conversion' way. Thank you once again!

                    Best regards,
                    ​​​​​​​Alex

                    Comment


                    • #11
                      Great, Alex!

                      Thank you for the feedback!

                      The good performance is probably due to the hand-written SSE code.

                      Best regards,
                      Stan

                      Comment

                      Working...
                      X