anthony.liot Posted June 10, 2011 Share Posted June 10, 2011 I need to take picture of my 3D object, for that i use renderImage2D, but i want an image without background. The background is the colorBackground of engine, may be it's possible to use or activate the alpha composant for the colorBackground. May be, exist an other solution ??? Link to comment
ulf.schroeter Posted June 10, 2011 Share Posted June 10, 2011 before rendering via renderImage2D set a special background color value not present in your object rendering (e.g. magenta). Afer renderImage2D convert the returned image to matching RGBA format via Image::convertToFormat(). Then check each pixel xyz-component of the image via Image::get2D() for exact value match with your special background color. In case of match set image pixel RGBA color to vec4(0,0,0,0) via Image::set2D() to force transparency. This is the way how normal Blue/green screen image composing works in movies/tv. Link to comment
anthony.liot Posted June 10, 2011 Author Share Posted June 10, 2011 when the object have a transparent surfaces, this method generate artifacts because the blending between textures and background. Link to comment
ulf.schroeter Posted June 10, 2011 Share Posted June 10, 2011 when the object have a transparent surfaces, this method generate artifacts because the blending between textures and background. For proper handling of transparent surfaces where a desired background color (e.g. white) is partly visible through these surfaces you could use the following approach render scene with special mask background color (e.g. magenta) not used otherwise in scene rendering to mask image A render scene with desired background color (e.g. white) to image B so desired background color will be used for transparent surface blending convert image B to RGBA format for transparency masking set all pixels in image B to transparent where pixel value xyz in mask image A exactly matches used mask color Link to comment
anthony.liot Posted June 10, 2011 Author Share Posted June 10, 2011 Thanks, i try that monday. Mode WE Activated Link to comment
ulf.schroeter Posted June 11, 2011 Share Posted June 11, 2011 Updated above procedure for also handling transparent surfaces Link to comment
anthony.liot Posted June 12, 2011 Author Share Posted June 12, 2011 For proper handling of transparent surfaces where a desired background color (e.g. white) is partly visible through these surfaces you could use the following approach render scene with special mask background color (e.g. magenta) not used otherwise in scene rendering to mask image A render scene with desired background color (e.g. white) to image B so desired background color will be used for transparent surface blending convert image B to RGBA format for transparency masking set all pixels in image B to transparent where pixel value xyz in mask image A exactly matches used mask color ich danke Ihnen sehr für Ihre Hilfe Thanks a lot for you help Link to comment
Recommended Posts