Skip to content
Skip to content
Skip to content

Experiment

Forty small WebGL sketches, each one under fifty lines and explained line by line.

stars
320
license
CC BY 4.0
Install
npx degit sorenhale/shader-notes
Water beads on dark navy paint, close up

README.mdCC BY 4.0

Forty small WebGL sketches. Each one is under fifty lines and every line has a comment, because I keep this notebook to stay honest about what I actually understand.

A page from it

glsl
// 07: soft circle
precision mediump float;
uniform vec2 u_res;

void main() {
  vec2 p = (gl_FragCoord.xy * 2.0 - u_res) / u_res.y; // centre, keep the aspect
  float d = length(p) - 0.5;                           // distance to a circle
  float a = smoothstep(0.01, -0.01, d);                // one pixel of softness
  gl_FragColor = vec4(vec3(a), 1.0);
}

What is in it

  • Noise, from value noise to fractal sums
  • Signed distance fields and how to combine them
  • Lighting with three numbers
  • A few happy accidents, kept because they taught me something

Every sketch runs in the browser with a slider for each uniform.

Experiment

Forty small WebGL sketches, each one under fifty lines and explained line by line.

stars
320
license
CC BY 4.0
Install
npx degit sorenhale/shader-notes
Water beads on dark navy paint, close up

README.mdCC BY 4.0

Forty small WebGL sketches. Each one is under fifty lines and every line has a comment, because I keep this notebook to stay honest about what I actually understand.

A page from it

glsl
// 07: soft circle
precision mediump float;
uniform vec2 u_res;

void main() {
  vec2 p = (gl_FragCoord.xy * 2.0 - u_res) / u_res.y; // centre, keep the aspect
  float d = length(p) - 0.5;                           // distance to a circle
  float a = smoothstep(0.01, -0.01, d);                // one pixel of softness
  gl_FragColor = vec4(vec3(a), 1.0);
}

What is in it

  • Noise, from value noise to fractal sums
  • Signed distance fields and how to combine them
  • Lighting with three numbers
  • A few happy accidents, kept because they taught me something

Every sketch runs in the browser with a slider for each uniform.

Experiment

Forty small WebGL sketches, each one under fifty lines and explained line by line.

stars
320
license
CC BY 4.0
Install
npx degit sorenhale/shader-notes
Water beads on dark navy paint, close up

README.mdCC BY 4.0

Forty small WebGL sketches. Each one is under fifty lines and every line has a comment, because I keep this notebook to stay honest about what I actually understand.

A page from it

glsl
// 07: soft circle
precision mediump float;
uniform vec2 u_res;

void main() {
  vec2 p = (gl_FragCoord.xy * 2.0 - u_res) / u_res.y; // centre, keep the aspect
  float d = length(p) - 0.5;                           // distance to a circle
  float a = smoothstep(0.01, -0.01, d);                // one pixel of softness
  gl_FragColor = vec4(vec3(a), 1.0);
}

What is in it

  • Noise, from value noise to fractal sums
  • Signed distance fields and how to combine them
  • Lighting with three numbers
  • A few happy accidents, kept because they taught me something

Every sketch runs in the browser with a slider for each uniform.

Start a project

Three quick picks so the first reply is useful. You finish the message on the contact page.

What do you need?

Rough budget

brief.tsdraft, not sent

Brief so far: nothing picked yet

or write to hello@sorenhale.dev

Nothing is sent from this page. Your picks are kept in this browser tab and wait for you on the contact form.

Start a project

Three quick picks so the first reply is useful. You finish the message on the contact page.

What do you need?

Rough budget

brief.tsdraft, not sent

Brief so far: nothing picked yet

or write to hello@sorenhale.dev

Nothing is sent from this page. Your picks are kept in this browser tab and wait for you on the contact form.

Start a project

Three quick picks so the first reply is useful. You finish the message on the contact page.

What do you need?

Rough budget

brief.tsdraft, not sent

Brief so far: nothing picked yet

or write to hello@sorenhale.dev

Nothing is sent from this page. Your picks are kept in this browser tab and wait for you on the contact form.

Footer

Local time, Oslo

Footer

Local time, Oslo

Footer

Local time, Oslo

Create a free website with Framer, the website builder loved by startups, designers and agencies.