PDA

View Full Version : Using green screen with opengl



pugsy
11-13-2009, 01:03 PM
I am doing a project where I need to implement the use of the green screen into opengl source code and I have never done this before of course, that's why its a project. But I cannot find anything where I am able to link the two. Does anyone have any ideas whatsoever? Has anyone done this before?

ZbuffeR
11-13-2009, 03:00 PM
"implement the use of the green screen into opengl source code" is pretty vague.
Do you want to make transparent the green parts of an image ?
There are number of techniques :
1) the most basic is to let the user pick a "typical" green screen color, and for each pixel if each R,G,B value is near the typical color +-a threshold, then set alpha to 0.
2)There are more subtile ways, such as gradual transparency instead of binary, desaturation of green screen bleeding, smoothing/feathering of the edge between transparent and opaque, etc.

How to implement in OpenGL ? I can think above several different ways, a simple start to do 1) is do it on the CPU side, update each video frame texture to set its alpha. Only rendering compositing will be done with OpenGL.
More dynamic and modern would be to do that at runtime on a GLSL fragment shader, OpenGL would do both green screen removal and compositing.

Do you have some experience with OpenGL ?

pugsy
11-14-2009, 11:30 AM
What exactly is happening is that I am doing a movie for this semester. I'm in grad school at a university. No I have no experience with opengl before now. We have animated a room with other things involved, but I will be in the movie, hence the use of the green screen to place me inside the animated room. Filming me in the green screen room is fine, its how do I connect it to my opengl coded animation that I have already done is the question.