Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: rendering an alpha key

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    15

    rendering an alpha key

    Hello,
    I'm writing an opengl TV broadcast "game" that has some transparent elements in it. The game will be overlayed over the video by sending an alpha key map to the external video mixer. The alpha key is a grayscale rendering of the game scene using the alpha values of each pixel. I plan to render the alpha key map in a split screen layout using one window, to avoid syncronisation problems.
    Is there an easy way to generate this alpha key map from my opengl scene?


    [This message has been edited by hcatry (edited 11-21-2003).]

    [This message has been edited by hcatry (edited 12-08-2003).]

  2. #2
    Member Regular Contributor
    Join Date
    Nov 2003
    Location
    Czech Republic
    Posts
    318

    Re: rendering an alpha key

    First, render the scene to the texture.
    Then draw it once for color channel and once for alpha channel.

    BTW: Why split screen?

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    15

    Re: rendering an alpha key

    Originally posted by mfort:
    First, render the scene to the texture.
    Then draw it once for color channel and once for alpha channel.

    BTW: Why split screen?
    Isn't one big window faster than 2 seperate windows? (I'm using SDL for windowing)

    Do I have to use pbuffers to render a scene as a texture?
    Thanks for your input.

  4. #4
    Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    466

    Re: rendering an alpha key

    render the scene and after that render a fullscreen white quad with blending enabled and glBlendFunc(GL_DST_ALPHA, GL_ZERO); after that your framebuffer contains the alpha component as a grayscale image. Be sure that you have a pixelformat with alpha

  5. #5
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    15

    Re: rendering an alpha key

    Originally posted by ScottManDeath:
    render the scene and after that render a fullscreen white quad with blending enabled and glBlendFunc(GL_DST_ALPHA, GL_ZERO); after that your framebuffer contains the alpha component as a grayscale image. Be sure that you have a pixelformat with alpha
    Interesting technique. But it doesn't address the problem of needing 2 "windows" per frame: one that contains the current frame rendered normally and a second window that has the grayscale alpha rendering of the frame.
    The external video mixer receives the size and position of the 2 windows over a serial link (doesn't change normally) and uses the first one to overlay the graphics over the video and the second to determine the transparancy of the overlay.

  6. #6
    Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    466

    Re: rendering an alpha key

    so the video renderer has direct access to the framebuffer?

    serial link is just used to transmit the dimension of the 2 windows. has this video mixer access to for example a pixel buffer? can you control the video mixer using an opengl extension?

  7. #7
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    15

    Re: rendering an alpha key

    I found this pdf on nVIDIA's site: "OpenGL Render-to-Texture" http://developer.nvidia.com/attach/3478

    While this probably is a solution, it's complicating my application a lot. Performance is important though.

  8. #8
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    15

    Re: rendering an alpha key

    [QUOTE]Originally posted by ScottManDeath:
    [B]so the video renderer has direct access to the framebuffer?

    No, I skipped a step in may explanation. The DVI-I output of the graphics card is send to a Miranda DVI-Ramp (a convertor for DVI to SDI (digital broadcast video norm)

    You can see how it works over here: http://www.miranda.com/pdf/datasheet/DVI-Ramp.pdf
    on page 2 (broadcast application)

  9. #9
    Member Regular Contributor
    Join Date
    Mar 2001
    Posts
    466

    Re: rendering an alpha key

    öhm, now I got it
    so you have to have your scene and your alpha key map at the same time om the framebuffer? So render the scene once with color and a smaller size, then do a glCopyPixels to for example the right part of the screen and then do the thing with the quad and blending as mentioned before.

    do you have additional control over the dvi ramp?

  10. #10
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    15

    Re: rendering an alpha key

    Thanks. Using glCopyPixels is a good solution I think. Since it operates within the frame buffer it should be fast, is it?

    the dvi-ramp has some other controls but I don't have the documentation with me, nothing else for controlling the alpha key I think.


    do you have additional control over the dvi ramp?[/B]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •