backback

Figures 4,7 : Silohuettes

_sil1.png _sil2.png _sil3.png

These figures rely on two datasets, a cone and a bunny. cone.nrrd is made at this page, and bunny.nhdr is make here. One change is needed in cone.nrrd, to adjust the sample spacing, and turn off any notion of sample centering:

unu reshape -i cone.nrrd -s 100 100 100 \
 | unu axinfo -a 0 -sp 1.8 \
 | unu axinfo -a 1 -sp 1.8 \
 | unu axinfo -a 2 -sp 1.8 -o cone.nrrd

Making the transfer functions is a little involved. First we need various 1-D and 2-D ramps:

echo "0 1" \
 | unu reshape -s 2 \
 | unu resample -s 512 -k tent -o ramp.nrrd

echo "-1 0 -1 0" \
 | unu reshape -s 2 2 \
 | unu resample -s 512 512 -k tent -o xramp.nrrd

echo "-1 -1 1 1" \
 | unu reshape -s 2 2 \
 | unu resample -s 512 512 -k tent -o yramp.nrrd

The opacity functions are 1-D functions of data value:

echo "-2.5 0.0   -0.6 0.0    -0.55 1.0    1.5 1.0" \
 | unu reshape -s 2 4 \
 | unu imap -i ramp.nrrd -r -m - \
 | unu axinsert -a 0 -l "A" \
 | unu axinfo -a 1 -l "gage(v)" -mm -1.0 1.0 -o cone-val-txf.nrrd

echo "0.0 0.0     0.32 0.0    0.41 1.0     1.0 1.0" \
 | unu reshape -s 2 4 \
 | unu imap -i ramp.nrrd -r -m - \
 | unu axinsert -a 0 -l "A" \
 | unu axinfo -a 1 -l "gage(v)" -mm 0 4095 -o bunny-val-txf.nrrd

Cool-to-warm shading is based on a dot product between the surface normal and light direction (NdotL):

unu imap -i ramp.nrrd -r -m gooch.txt \
 | unu 2op / - 255 \
 | unu flip -a 1 \
 | unu axinfo -a 0 -l RGB \
 | unu axinfo -a 1 -l "NdotL" -mm -0.4 0.90 -o gooch-txf.nrrd

The naive silohuette transfer function is based solely on the dot product between the surface normal and the view vector (NdotV):

unu imap -i ramp.nrrd -r -m sil.txt \
 | unu axinfo -a 0 -l RGB \
 | unu axinfo -a 1 -l "NdotV" -mm -1.0 1.0 -o sil1-txf.nrrd

The curvature-based silohuettes involve both NdotV and the curvature along the view direction, GTdotV. Creating the 2-D lookup table is done with {x,y}ramp.nrrd created before, and results in half of an ellipse (seen in Figure 6(b)):

unu join -i xramp.nrrd yramp.nrrd -a 0 -incr \
 | unu project -a 0 -m l2 \
 | unu 2op gt - 1.001 \
 | unu resample -s = x1 -k gauss:3,3 \
 | unu reshape -s 1 512 512 \
 | unu pad -min 0 0 0 -max 2 M M \
 | unu axinfo -a 0 -l "RGB" \
 | unu axinfo -a 2 -l "NdotV" -mm -1.0 1.0 -o cvsil-txf.nrrd 

unu resample -i cvsil-txf.nrrd -s = x0.5 x0.5 -k tent \
 | unu quantize -b 8 -o cvsil.png
cvsil.png

Varying the extent of the domain along the horiontal (GTdotV) determines the silohuette thickness:

unu axinfo -i cvsil-txf.nrrd -a 1 \
   -l "GTdotV" -mm 0.0 1.0 -o cone-sil2-txf.nrrd
unu axinfo -i cvsil-txf.nrrd -a 1 \
   -l "GTdotV" -mm 0.0 1.25 -o bunny-sil2-txf.nrrd

unu axinfo -i cvsil-txf.nrrd -a 1 \
   -l "GTdotV" -mm 0.0 0.4 -o cone-sil3-txf.nrrd
unu axinfo -i cvsil-txf.nrrd -a 1 \
   -l "GTdotV" -mm 0.0 0.5 -o bunny-sil3-txf.nrrd

rm -f cvsil-txf.nrrd 

Now rendering:

setenv NT 45
setenv STEP 0.005
setenv BG "1.0 1.0 1.0"

alias CONE_MITER miter -i cone.nrrd \
  -k00 cubic:1,0 -k11 cubicd:1,0 -k22 cubicdd:1,0 \
  -rh -fr 3 3 -2 -up 0 0 -1 -dn -2 -di 0 -df 2 -ar \
  -ur -0.775 0.775 -vr -0.55 1.05 \
  -ld 6 -6 -10.5 -ads 1.0 0.0 0.0 -sp 70 -is 300 300 -step $STEP -nt $NT

alias BUNNY_MITER miter -i bunny.nrrd \
 -k00 cubic:1,0 -k11 cubicd:1,0 -k22 cubicdd:1,0 \
 -rh -fr 2.5 -5 3 -up -2 0 10 -dn -2 -di 0 -df 2 -ar \
 -ur -1.0 1.16 -vr -1.2 0.96 \
 -ld 6 -6 -10.5 -ads 1.0 0.0 0.0 -sp 70 -is 512 512 -step $STEP -nt $NT

CONE_MITER -txf cone-val-txf.nrrd gooch-txf.nrrd sil1-txf.nrrd -o - \
 | overrgb -i - -g 1.3 -b $BG -o cone-sil1.png

CONE_MITER -txf cone-val-txf.nrrd gooch-txf.nrrd cone-sil2-txf.nrrd -o - \
 | overrgb -i - -g 1.3 -b $BG -o cone-sil2.png

CONE_MITER -txf cone-val-txf.nrrd gooch-txf.nrrd cone-sil3-txf.nrrd -o - \
 | overrgb -i - -g 1.3 -b $BG -o cone-sil3.png

BUNNY_MITER -txf bunny-val-txf.nrrd gooch-txf.nrrd sil1-txf.nrrd -o - \
 | overrgb -i - -g 1.3 -b $BG -o bunny-sil1.png

BUNNY_MITER -txf bunny-val-txf.nrrd gooch-txf.nrrd cone-sil2-txf.nrrd -o - \
 | overrgb -i - -g 1.3 -b $BG -o bunny-sil2.png

BUNNY_MITER -txf bunny-val-txf.nrrd gooch-txf.nrrd cone-sil3-txf.nrrd -o - \
 | overrgb -i - -g 1.3 -b $BG -o bunny-sil3.png

Some unu hacking is used to create the images used for the figures. This downsamples the cone image and composites it with the bunny image, using unu 2op min:

foreach N ( 1 2 3 )
  unu resample -i cone-sil${N}.png -s = 240 240 -k tent \
   | unu pad -min 0 -272 -15 -max M M 496 \
   | unu 2op min - bunny-sil${N}.png -o sil${N}.png
  unu resample -i sil${N}.png -s = x0.4 x0.4 -o _sil${N}.png
end
unu join -i sil?.png -a 1 \
 | unu resample -s = x0.18 x0.18 -o __sil.png