Mtor
Slim Ribbox Scripting 4


return to main index

Related Links
   Slim Ribbox Scripting 1
   Slim Ribbox Scripting 2
   Slim Ribbox Scripting 3
   Slim Ribbox Scripting 5
   Slim Ribbox Scripting 6


Introduction

This example of geometry substitution involves the use of Blobby's. Figure 2 shows the effect of placing a blobby ellipsoid at each vertex of the model kindly made available to me by Kelly Eisert.

[
set tok [split $OBJPATH |]
set tnode [lindex $tok end-1]
set scale [mattr $tnode.size $F]

set n [clientcmd "polyEvaluate -v $tnode"]
set n [lindex $n 0]
set out ""
# Setup the initial definition of the blobby
append out "Blobby $n \[\n"

# Make each an ellipsoid and provide its arry index
# The array indices monotonously increment by 16
for {set i 0} {$i < $n} {incr i} {
    append out "1001 [expr $i * 16]\n"
    }
# Specify the blending code "0" and the 
# number of blobs to blend
append out "0 $n "

# Followed by a list of the indices from the first
# to the last blob
for {set i 0} {$i < $n} {incr i} {
    append out " $i"
    }
append out "\]\n"

# Now specify the transformations of each blob
append out "\[\n"

# Lock the random number generator
expr srand(1)

for {set i 0} {$i < $n} {incr i} {
    set str $tnode
    append str ".vtx\[$i\]"
    set pnt [clientcmd "pointPosition -local $str"]
    set size [expr $scale + rand() * 0.4]
    set blobdata "$size 0 0 0 0 $size 0 0 0 0 \
$size 0 $pnt 1\n"
    append out $blobdata
    }
append out "\]\n"
append out "\[\"\"\]"

append out "Opacity 0 0 0\n"
return $out
]







figure 1 - original model




figure 2 - polygon mesh replaced by Blobby's









© 2002-6 Malcolm Kesson. All rights reserved.