This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// r = probably screen resolution, o = output color, g = ray depth into the scene | |
// FC.xy = which pixel we are on | |
float i,e,f,s,g,k=.01; | |
for(o++;i++<100;){// go upto 100 steps with the ray | |
s=2.; | |
vec3 p = vec3((FC.xy-r/s)/r.y*g, g-s); // defining ray direction | |
p.yz *= rotate2D(-.8); // rotate the camera/ray downwards | |
p.z += t;// fly forward over time | |
e=f=p.y | |
// compute the terrain height and fog density at this xz coordinate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Commented version of https://twitter.com/zozuar/status/1441384708441456651 | |
// Google-translated (with some editing) from @gam0022's version | |
float i, // Ray marching loop counter | |
e, // Volume density (the smaller the value, the higher the density) | |
s, // FBM scale (and loop counter) | |
g, // Ray's distance (also used for tunnel twirl and camera prespective) | |
k = .01; // Handy constant | |
// Ray marching loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is Twigl's "geekest mode" so the code runs inside a "main" function. | |
// FC.xy is fragcoord | |
// r.xy is resolution | |
// t is time (in seconds I think) | |
// o.rgba is output color | |
// This is the original code, before any readability improvements: | |
/* | |
#define X(S,D)I=ivec3(S);D=fract(float(I.x^I.y^I.z)*PI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* Twigl geekest mode 300 es shim for CapJS (no mouse, sound or backbuffer support!) | |
* | |
* To render long videos for twitter: | |
* | |
* - Paste this into http://capjs.3d2k.com/ | |
* - Scroll to the bottom and paste your twigl code | |
* - Set resolution, time, format (webm), etc. | |
* - Capture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
if [[ $# -ne 2 ]]; then | |
echo "Usage: swf-surgery <input-file> <output-file>" | |
exit 1 | |
fi | |
TMP="/tmp/$(basename $0).$$" | |
SWF="$TMP.swf" | |
BAK="$TMP.\$wf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var null::no name()::void | |
maxStack:2 localCount:5 initScopeDepth:10 maxScopeDepth:10 | |
pushundefined ; 1 item on stack | |
coerce_a | |
setlocal1 ; 0 items on stack | |
pushundefined ; 1 item on stack | |
coerce_a | |
setlocal2 ; 0 items on stack | |
pushundefined ; 1 item on stack | |
coerce_a |