Greetings Luddites…

Thank you for coming..

Here is the code from Eliza Ludd:

#version 150

// All of the uniform variables are declared in the side control panel
uniform float time;
uniform vec2 resolution;

uniform sampler2D texture0;
uniform sampler2D prevFrame;

// this is part of the pipeline, it doenst really concern us.
in VertexData
vec4 v_position;
vec3 v_normal;
vec2 v_texcoord;
} inData;

out vec4 nodeStatus; // this is what the output of the node will be

void main(void)
vec2 nodeID = inData.v_texcoord;
// this ^^^^ is all the information we have about our fog node.
//JUST the ID which correlates to a pixel position on screen
// so the node given the ID (0,0) is in the bottom left screen and
// the node with the ID (1,1) is represented by the pixel in the top right

vec4 prevNodeStatus = texture(prevFrame, nodeID); // if this line isnt working, you have
//a different version of kodelife change the function texture to be texture2D

vec2 i = nodeID*8.0- vec2(20.0); // these are magic numbers that scale it to fit the screen

float intensity = .2;

float t = time;

//these next two lines are where the magic happens! feel free to noodle around with the numbers
i += vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(t + i.x));
float fog = 2.0+ (8/length(vec2(i.x / (sin(i.x+t)/intensity),i.y / (cos(i.y+t)/intensity))));

//normalizes the (intensity)colors so theyre between 0 and 1
fog = 1.0-sqrt(fog);
fog = fog*fog*fog*fog;

// if the fog is too bright, copy what it was the previous moment(frame)
if (fog > 0.3){
fog = prevNodeStatus.x * 0.99;

vec4 final = vec4(vec3(fog), 1.0); // casting to a vec4
//ignore the last number it doesnt matter in this context

nodeStatus = final;

You can also see the raw code here

How this works is that you paste this entirely into Kodelife.

You should see this:


If you’d like a different starter code to mess with:

NOW its time to remix the fog code!

Here you can find the glsl sticker sheet


Next Steps for if you want to use GLSL for live coding visuals and not just Fog Nodes!!!

These are some specific suggestions from me if you want to continue learning but don’t know how to start.

1. Learn the maths from The Book of Shaders
** If you haven’t looked at this already, look through it! Its wonderfully paced and has a lot of versatile useful information. []

2. Get into 3D!
** This tutorial here: is super thorough and really useful!

** I wrote a really basic ray marcher that will work in kodelife: 

4. Get involved Online
*** is the hub for livecode community. You can join lurk channel (its like slack) and join the visual channel


Thanks a lot to all the folks at Hackers and Designers Summer Academy 2019 to make this workshop: Eliza Ludd, the Fog and the Shade come to life.