[Radiance-general] Alpha channel/object matte
Giulio Antonutto
Giulio.Antonutto at arup.com
Fri Nov 19 18:39:12 CET 2004
I am bowing to the Supreme...
;-))
-----Original Message-----
From: Greg Ward [mailto:gward at lmi.net]
Sent: 19 November 2004 17:18
To: Radiance general discussion
Subject: Re: [Radiance-general] Alpha channel/object matte
Hi Kirk,
Here's my own example of image-based lighting and the commands I used.
I have two processors to work with, which is why I run two renderings
at the same time:
#!/bin/csh -fex
#
# Render our image-based lighting example
#
# Oct 2004 Greg Ward
# Set parameters
set res=(-x 2272 -y 1704)
set vw=(-vf plate.vf -pa 0)
set amb=(-ab 1 -aa 0 -ad 256 -as 0)
# Render synthetic objects
oconv environ.rad railing.rad chess3d.rad \
| rpict -ps 1 -pj 0 $vw $res $amb \
> chess3d.hdr &
# Determine foreground objects
oconv chess3d.rad > stencil.oct
vwrays -ff $vw $res \
| rtrace -fff -oL $res stencil.oct \
| pvalue -r -df -b \
| pcomb -e 'lo=if(gi(1)-1e5,0,1)' - \
> stencil.pic
rm stencil.oct
# Render base for shadows
oconv environ.rad railing.rad \
| rpict -ps 1 -pj 0 $vw $res $amb \
> unshadowed.hdr
# Wait for first render
wait
# Composite final image with shadow map and blurred foreground
pcomb -e 'ro=f(ri);go=f(gi);bo=f(bi)' \
-e 'f(inp)=inp(1)*(gi(3) + (1-gi(3))*inp(2)/inp(4))' \
'\!pfilt -1 -r 1.35 chess3d.hdr' \
-o SunrisePlate.hdr \
'\!pfilt -1 -r 1.35 stencil.pic' \
'\!pfilt -1 -r 1.35 unshadowed.hdr' \
> composite.hdr
---------------------
Resulting image (tone-mapped JPEG and gzip'ped input and picture files):
http://www.anyhere.com/gward/pickup/chess3d_balcony.jpg
http://www.anyhere.com/gward/pickup/chess2.tar.gz
Pillo's method works as well, but has problems sometimes for
transparent surfaces. The -oL output of rtrace is the only truly
reliable method I've found. You also need the -ps 1 -pj 0 rendering
options shown to avoid disagreement between boundary pixels in the
final composite. My example includes blurring of the IBL objects to
simulate depth of field, which you probably don't want in general.
(The pfilt -1 -r 1.35 commands in the final pcomb can be replaced by
the straight files.)
-Greg
_______________________________________________
Radiance-general mailing list
Radiance-general at radiance-online.org
http://www.radiance-online.org/mailman/listinfo/radiance-general
___________________________________________________________________
Electronic mail messages entering and leaving Arup business
systems are scanned for acceptability of content and viruses.
More information about the Radiance-general
mailing list