learn GLSL from zero
ToolsCreate with shadersShader MakerFree online shader builderToolkitShader works ready for your siteSketcher LabPaint your landing’s hero with shaders3D StudioThe Three.js editor in your browser
GamesPlay with shadersOnomatoShaderType a word, blow it upThe WatcherAn eye that follows youAetherLiquid glass with an eye insideBloomcoreA word grows a garden of lightPyrokineThrow fire at the wallVoltaicThe pyramid throws lightningSurfSurf a shader ocean

Lesson 2 of 10 · Strange attractors on the GPU

The equations

The three derivatives that guide it: the ODE.

The point moves because a function tells it how. There are three derivatives — dx, dy, dz — one for each axis. Together they form the ODE of the Aizawa attractor.

Every term is a force pulling the point. Change one number and the creature changes.

dx, dy, dzThe velocity of the point on each axis as a function of its position. There is no randomness: it is deterministic.
TryMove Stretch and Inflate: they edit d and a in the equation. The form reconfigures instantly.

The code

vec3 attractor(vec3 p){
  // Aizawa · mueve los números y mira
  float a=0.95, b=0.70, c=0.60, d=3.50, e=0.25, f=0.10;
  float dx = (p.z - b)*p.x - d*p.y;
  float dy = d*p.x + (p.z - b)*p.y;
  float dz = c + a*p.z - p.z*p.z*p.z/3.0
           - (p.x*p.x + p.y*p.y)*(1.0 + e*p.z) + f*p.z*p.x*p.x*p.x;
  return vec3(dx, dy, dz);
}
close