[Radiance-general] Alpha channel/object matte

Kirk Thibault kthibault at biomechanicsinc.com
Thu Nov 18 18:20:58 CET 2004


Thanks for the info.   I guess that means I need to know what format 
the "Z" file is and how the information is arranged.  I generated one 
using the -z option of rpict and then just tried to look at it ("less") 
and i was given the message - "This file may be  a binary file - view 
anyway?".  I said yes and got gobbledyguck.

I also tried the strategy of rendering a background only image (this 
renders just the HDR image wrapped around my scene) and then a 
"objects" render that includes the background and the objects.  If you 
use pcomb to take the difference between the two images, you should 
more or less be left with the objects only and presumably you could 
then do another pcomb to make the image 2 bit.  I tried something like:

pcomb -s -1 background_image object_image > diff_image <<<(takes the 
difference between the two images)

then

pcomb -e 'ro=if(ri(1)=0,0,1);go=if(gi(1)=0,0,1;b0=if(bi(1)=0,0,1)' > 
matte_image

the idea being that if the pixel value in the "diff" image was 0 this 
would be a pixel which was the same in the background image and the 
object image (i.e., part of the background) versus anything else, which 
would be an object.  This has limitations, but in general I was trying 
to say "if the pixel in the diff image is black, it is part of the 
background, keep it black, otherwise if it is not black, make it white.

Needless to say, I got a command line error saying that a ')' was 
expected.  I'm guessing that this means i used the "if" function 
incorrectly within the context of pcomb, or in general.  The obvious 
shortcoming of this crude method is that if the diff image contains a 
black pixel value in the object area, it will remain black and thus not 
be part of the object matte.  Definitely not robust.  The Z file info 
sounds like the way to go in this respect so I look forward to an 
explanation of how to tap into it.

Can you tell I'm learning Radiance and Unix  simultaneously?  :)

Thanks folks!

kirk


On Nov 18, 2004, at 6:33 AM, Peter Apian-Bennewitz wrote:

> Kirk Thibault wrote:
>
>> Hi Folks,
>>
>> Is there a straightforward way to generate alpha channel or object 
>> matte 8 bit grayscale images in radiance for compositing purposes?
>>
> Hi Kirk,
>
> At least not automatically by rpict itself. rayshade (and likely 
> others raytracers too) generate an optional alpha channel, and I 
> nagged Greg to add an optional fourth channel to the image format in ( 
> - hang on, a quick seach in my mail folders..) June 1993. That never 
> made it, since a change of format would have produced various nasty 
> side effects. The main reason for my wish was to paste the image into 
> existing (tpically outside) scenery easily. With fisheye HDRs being 
> on-vogue now, surrounding the model with an HDR source-primitive is a 
> better way to solve that merging problem.
>
> So, you'll have to generate a z-file (-z option), use the z-value to 
> differentiate between an object hit (alpha opaque) and infinity (alpha 
> transparent) and convert that to whatever image format you need. 
> Suitable pcomb/pfilt/pvalue scripts are left as an exercise to the 
> reader ...
>
> -Peter
>
> -- 
> pab-opto, Freiburg, Germany, http://www.pab-opto.de
> [see web page to check digital email signature]
>
>
>
> _______________________________________________
> Radiance-general mailing list
> Radiance-general at radiance-online.org
> http://www.radiance-online.org/mailman/listinfo/radiance-general




More information about the Radiance-general mailing list