Difference between revisions of "TouchDesigner learning"

From Antoine Vienne | Wiki
Jump to navigation Jump to search
(Created page with "=Isadora GLSL experiment= === Convert GLSL from Shadertoy === <pre> // Name of the parent node parent().name </pre>")
 
(Making buttons)
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Isadora GLSL experiment=
+
=Time=
=== Convert GLSL from Shadertoy ===
+
=== Absolute seconds ===
 +
<pre>
 +
absTime.seconds
 +
</pre>
 +
 
 +
=== Absolute frames ===
 +
<pre>
 +
absTime.frame
 +
</pre>
 +
 
 +
=== Cycle/loop of frames from timeline ===
 +
<pre>
 +
me.time.frame
 +
</pre>
 +
 
 +
=Making custom interface=
 +
=== Making buttons ===
 +
 
 +
More informations: https://vimeo.com/jhoepffner
 
<pre>
 
<pre>
 
// Name of the parent node
 
// Name of the parent node
Line 6: Line 24:
 
parent().name
 
parent().name
  
 +
</pre>
 +
 +
=Rendering=
 +
=== Get resolution from another node ===
 +
<pre>
 +
// Get width and height from render1 node
 +
 +
op('render1').width
 +
 +
op('render1').height
 +
 +
</pre>
 +
 +
 +
=GLSL=
 +
=== Get Shadertoy shaders working===
 +
<pre>
 +
More informations: https://nvoid.gitbooks.io/introduction-to-touchdesigner/content/GLSL/12-6-Importing-Shadertoy.html
 +
 +
// Replace in code "void mainImage( bla bla )" by "void main()"
 +
 +
// Replace in code "fragCoord" by "gl_FragCoord"
 +
// Carefully add ".xy" when missing ".x" or ".y" after "gl_FragCoord" in "void main()" part
 +
 +
// Then add at top of code:
 +
 +
layout(location = 0) out vec4 fragColor;
 +
 +
uniform vec3 iResolution;
 +
uniform float iTime;
 +
uniform float iFrame;
 +
uniform vec4 iMouse;
 +
 +
// In glsl node:
 +
// Declare iResolution, iFrame and iTime
 +
// For iTime:
 +
absTime.seconds
 +
// For iFrame:
 +
absTime.frame
 +
 +
// In glsl code, declare iChannels (iChannel0, iChannel1...)
 +
// For most of the cases, iChannel0 calls a texture, so:
 +
// Replace iChannel0 by sTD2DInputs[0]
 +
// If iChannel0 calls a cubemap:
 +
// Replace iChannel0 by sTDCubeInputs[0]
 +
// If iChannel0 calls a sound, convert sound to CHOP by a null, then:
 +
// Replace iChannel0 by sTD2DInputs[1]
 
</pre>
 
</pre>

Latest revision as of 17:26, 4 February 2021

Time

Absolute seconds

absTime.seconds

Absolute frames

absTime.frame

Cycle/loop of frames from timeline

me.time.frame

Making custom interface

Making buttons

More informations: https://vimeo.com/jhoepffner

// Name of the parent node

parent().name

Rendering

Get resolution from another node

// Get width and height from render1 node

op('render1').width

op('render1').height


GLSL

Get Shadertoy shaders working

More informations: https://nvoid.gitbooks.io/introduction-to-touchdesigner/content/GLSL/12-6-Importing-Shadertoy.html

// Replace in code "void mainImage( bla bla )" by "void main()"

// Replace in code "fragCoord" by "gl_FragCoord"
// Carefully add ".xy" when missing ".x" or ".y" after "gl_FragCoord" in "void main()" part

// Then add at top of code:

layout(location = 0) out vec4 fragColor;

uniform vec3 iResolution;
uniform float iTime;
uniform float iFrame;
uniform vec4 iMouse;

// In glsl node:
// Declare iResolution, iFrame and iTime
// For iTime:
absTime.seconds
// For iFrame:
absTime.frame

// In glsl code, declare iChannels (iChannel0, iChannel1...)
// For most of the cases, iChannel0 calls a texture, so:
// Replace iChannel0 by sTD2DInputs[0]
// If iChannel0 calls a cubemap:
// Replace iChannel0 by sTDCubeInputs[0]
// If iChannel0 calls a sound, convert sound to CHOP by a null, then:
// Replace iChannel0 by sTD2DInputs[1]