Wednesday, August 22, 2018

Touch Designer - Setting Bypass and Cooking

How to bypass:
op('OPNAME').bypass = True
op('OPNAME').bypass = False

Cooking flag:
op('OPNAME').allowCooking = True
op('OPNAME').allowCooking = False

Other flags can be found under "Common flags" section here:
http://www.derivative.ca/wiki088/index. ... COMP_Class

Monday, August 20, 2018

Touch Designer Tips - importing Shadertoy GLSL shaders

replace iChannel0 with     sTD2DInputs[0]
replace fragCoord with     gl_FragCoord.xy

Add 2 Vector variables:
iResolution [1280, 720]
iTime [absTime.seconds]

uniform vec2 iResolution;
uniform float iTime;

============================================
Dual Buffer

replace iChannel0 with   sTD2DInputs[0]
replace void mainImage(out vec4 fragColor,etc) with     void main()

layout (location = 0) out vec4 fragColor;
uniform vec3 iResolution;
uniform float iFrame;
uniform vec3 iMouse;




https://www.youtube.com/watch?v=2JDR5l5UjRU

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.