Tuesday, May 15, 2018

Houdini - VEX samples

//CREATE LINE WITH MULTIPLE POINTS
int pointCount = chi("Point_Count");
int points[];

resize(points, pointCount);

for   (int i=0; i < pointCount; i++)
{
    vector curPos = set(0,i,0);
    int curPointId = addpoint(geoself(), curPos);
    points[i] = curPointId;
    }

for(int i=0; i<pointCount-1; i++;
{
    addprim(geoself(), "polyline", points[i], points[i+1]);
    }

//addprim(geoself(), "polyline", points);

===========================================================================
//RECREATING LINE NODE
float length = ch("Length");
int pointCount = chi("Points");
vector dir = chv("Division");
vector offset = chv("Offset");

dir = normalize(dir);
int points[];
resize(points, pointCount);

float stepVal = length/(float)(pointCount-1);

for(int i=0; i<pointCount; i++)
{
    vector pointPos = (dir) * (stepVal*i) + offset;
    int cutID = addpoint(geoself(), pointPos);
    points[i] = curID;
    }

addprim(geoself(), "polyline", points);
===========================================================================

Wednesday, May 2, 2018

AE - PointAt

1) Create 3 nulls: Null_PointAt, Null_Base, Null_Target
2) Set the following transform expressions on Null_PointAt:

Position:
thisComp.layer("Null_Base").transform.position

Scale:
point1 = thisComp.layer("Null_Base").transform.position;
point2 = thisComp.layer("Null_Target").transform.position;
scl=length(point1, point2);
[scl, scl]

Rotation:
fromPoint = thisComp.layer("Null_Base").transform.position;
atPoint = thisComp.layer("Null_Target").transform.position;
Pointer3=lookAt(fromPoint, atPoint);
if(atPoint[1]<fromPoint[1]) [Pointer3[1]]-180; else [-Pointer3[1]];

Tuesday, November 28, 2017

Adding commas into Text layers

//Create a new Slider Expression effect. I named it 'Score'

var num = effect("Score")("Slider");
num = Comma(num);
[num]

 function Comma(number)
    {
    number = '' + Math.round(number);
    if (number.length > 3)
       {
       var mod = number.length % 3;
       var output = (mod > 0 ? (number.substring(0,mod)) : '');
       for (i=0 ; i < Math.floor(number.length / 3); i++)
           {
           if ((mod == 0) && (i == 0))
                output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
           else
                output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
           }
       return (output);
       }
    else return number;
    }

Thursday, November 16, 2017

Limiting Decimal Places In Text Layers

Adding .toFixed(4) after the variable limits the decimal places to 4.  ie 26.7835
Adding .toFixed(2) would limit the decimal places to 2.  ie 26.78
.toFixed(3) would limit the decimal places to 3.  ie 26.784  (note it rounds value)


ex:  avgEQ = (thisComp.layer("1").transform.scale[1] + thisComp.layer("2").transform.scale[1])/2;
       avgEQ.toFixed(4)

Aligning Lens Flare To Target

In order to align the streak of the lens flare to a target, first create 2 nulls (LightTarget, LightSource)

Light Factory Location =
lSource = thisComp.layer("LightSource").transform.position;
lTarget = thisComp.layer("LightTarget").transform.position;
Anchor = transform.anchorPoint;
lSource-lTarget+Anchor

Light Factory's layer position =
thisComp.layer("LightTarget").transform.position

Make sure the solid layer that the lens flare is applied to is large enough for the comp.

Friday, February 6, 2015

Speed offset expression for AE

Being able to control the speed of another layer based on speed control.

Position =
Start = 0;
y = 540;
x = thisComp.layer("Null 1").transform.position[0];
Speed = effect("Speed")("Slider");
x1 = ((x-Start)*Speed)+Start;
[x1, y]

Sunday, October 12, 2014

Nickelodeon: Days Of Future Past

Updated for Unreal Engine 4.  Some of the old, some of the new.  Everything is separated out into different fbx files, so it's easily be improved and updated.  Next thing I want to learn and incorporate is Substance Designer and Substance Painter.  Those will really take it to the next level!