Mitchel Clayton

mitchel.clayton[AT]gmail.com

MEL: Matrix

These are the results of starting to explore MEL scripting and creating 3D visualizations using various MEL procedures.

Final Renders

Process

Below is a collection of AO renders from various iterations in values of my MEL script.

The material used in the renders was from mottomo.jk from substance share and can be found here.

 

https://share.allegorithmic.com/libraries/847

Scripts

My script creates multiple spirals of poly cubes stacked on top of each other and then selects random faces on each cube to then be extruded in the second procedure.

 

$num is equal to the number of spirals created

$selectPercent is the percent of faces per cube that are selected at the end of the proc

$subD is the number of subdivisions int he created polyCubes

Spiral Creation Script

Basic Shape that is formed upon running

Shape Stacked on it self and reflected

Multiple Extrusions from a random selection of faces.

/ spiral cone
global proc latticeCreate(int $num, float $selectPercent,int $subD,float $width, float $height, float $depth, int $numCubes){
  
string $grouping[];
string $parts[];
  
string $all;
  
    for($i = 0; $i < $num; $i++)
    {
        for($n = 0; $n < $numCubes; $n++)
        {
            float $x = sin($n)*$n/4;
            float $z = cos($n)*$n/4;
            float $y = $n/10;
        
            $parts = `polyCube -w $width -h $height -d $depth -ax 0 1 0  -sx $subD -sy $subD -sz $subD -cuv 4 -n "cube#"`;
            move $x $y $z;
            $grouping[$n] = $parts[0];
    
        }
    
        group -n "Lattice#" $grouping;
        rotate ($i*180) 0 0;
        move 0 ($i*10) 0;
    }
    
    //selects a % of the faces of all cubes
    string $faces[] = {};
    
    for($each in `ls "cube*"`)
    {
        int $nFaces[] = `polyEvaluate -f $each`;
        int $sFaces = $nFaces[0] * $selectPercent;
        
        for($i=0;$i<$sFaces;$i++)
        {    
            string $rFace = $each + ".f[" + int(`rand 0 $nFaces[0]`) + "]";
            
            while(stringArrayContains($rFace, $faces) == 1)
            {
                $rFace = $each + ".f[" + int(`rand 0 $nFaces[0]`) + "]";
            }
            
            $faces[size($faces)] = $rFace;
        }
    }
    select -r $faces;
}
  
global proc extrude2(float $scaleLength1,float $scaleLength2, float $scaleLength3){
    string $allFaces [] =`ls -sl -fl`; 
    float $taper = 1;
    int $subD2 = 0;
    float $r1 = 0.1;
    float $r2 = 0.9;
    
    for ($perFace in $allFaces) 
    { 
        float $randBase1 = rand($r1,$r2); 
        float $randBase2 = rand($r1,$r2); 
        float $randBase3 = rand($r1,$r2);  
        float $randScale1 = rand($r1,$scaleLength1);  
        float $randScale2 = rand($r1,$scaleLength2);
        float $randScale3 = rand($r1,$scaleLength3); 
          
        select $perFace;
        polyExtrudeFacet -kft true -ws 0 -cch 1 -ls $randBase1 $randBase1 $randBase1 ;  // creates base for 1st tower
        polyExtrudeFacet -kft true -ws 0 -cch 1 -d $subD2 -ltz $randScale1  -lsx $taper -lsy $taper -lsz $taper ; // extrudes the bases of 1st tower 
        polyExtrudeFacet -kft true -ws 0 -cch 1 -ls $randBase2 $randBase2 $randBase2; // creates the base for 2nd tower
        polyExtrudeFacet -kft true -ws 0 -cch 1 -ltz $randScale2; // extrudes 2nd base
        polyExtrudeFacet -kft true -ws 0 -cch 1 -ls $randBase3 $randBase3 $randBase3; // creates base for 3rd tower
        polyExtrudeFacet -kft true -ws 0 -cch 1 -ltz $randScale3; // extrudes 3rd tower
    }
select -cl;
}
  
global proc deleteAll(){
        delete `ls "Lattice*"`;
}

Conclusion

This project started off as a challenge as I hadn't have much experience with programming prior to this class. The hardest part of the project was getting acquainted with programming again and figuring out what was possible with MEL scripting finding out what commands are possible and experimenting with various flags took quite awhile to get adjusted to. Working with MEL has been enjoyable and has given me many new ideas for future uses of MEL Scripting and has allowed me to create some very interesting visual compositions.