Filming shaders

Some of the most interesting shaders are self contained 4 dimensional worlds defined entirely by maths. With a powerful GPU rendering them in real time at 60 frames per second, they can look utterly stunning.

But what to do in case you don't have the most powerful GPU to ...

more ...

Crunching Rays in your Browser

float floor(vec3 ro, vec3 rd, vec3 normal, inout float t)
{
    float d = dot(rd,-normal);
    float n = dot(ro,-normal);
    t = mix(-n/d,t,step(d,0.));
    return d;
}

float sphere(vec3 ro, vec3 rd, float size, out float t0, out float t1, out vec3 normal)
{
    float a ...
more ...

Shader recap

So far I've posted 9 articles here covering different techniques for making OpenGL shaders.

For those of you that have been following and trying things out, I thought this might be a good place for a recap.

I introduced the different built-in functions of GLSL as we needed them ...

more ...

More noise

Now we have a function which can give us a random-ish looking number between 0-1 for every pixel we render with a shader.

By using floor as we did earlier with continuous numbers, we can now have a random number for each different region of the image.

float rand(vec2 ...
more ...

Noise from numbers

Sometimes, a little noise is all you need to go from synthetic to organic.

The world is unpredictable, and that makes it interesting.

The same rules applies to shaders - unpredictable output makes for more interesting and natural-looking results. So how do you make a shader output unpredictable results?

An easy ...

more ...

Continuously discrete

Smooth looking images have every pixel quite similar to the ones all around them, while still being different enough to form a picture that isn't just one solid colour.

When a shader program is used to make an image, it is typically fed with input values (say x and ...

more ...

Going round in squircles

If you were an N9 user, you might have noticed something about the shapes of many of the icons it used.

They weren't quite the usual squares, or even rectangles with rounded corners, but another shape called (I kid you not) a squircle, which if that wikipedia link is ...

more ...

Mixing it up a bit

With just a few shader functions like length, mod and max, I can make simple repeating shapes like squares, circles, and lines. With stretching and skewing of the coordinates, these can be moulded in all kinds of interesting ways.

But still, when I'm trying to create a more complex ...

more ...

The Art of Repepetition

(If you're reading this in the RSS feed and there isn't a wide animation above this line, I suggest you read the article from the web version for the full giftastic experience)

Sometimes, differences everywhere aren't what you need. Constraints, like limited memory, bandwidth or performance, call ...

more ...

Riley

I was busy mixing some shaders with a bit of new server infrastructure, and something potent emerged that demanded a mini post for itself.

But first a warning. If you have eyes and a brain and you click this link, one or both of them may come away hurting. Don ...

more ...

Square shaped shaders

We already saw how the GLSL (that's the OpenGL Shader Language) built-in function "length" can be used to calculate the distance of a point from the centre (0,0) - great for making circles.

GLSL has many other built in functions. Lets use a couple of those to make squarish ...

more ...

Learning to shade

(Note: ThNdl v1.0 had the live shader editor. ThNdl v2.0, which you are reading now, doesn't. Sorry)

So far on ThNdl, I've shown you some simple OpenGL shaders, and teased you with some not-so-simple ones.

If the whole idea of shaders is new to you, you ...

more ...

Logo

In pixels

In code:

c=vec4(pos.xy,0.,0.); b=vec4(pos.x*cos(o.x)-pos.y*sin(o.x), pos.x*sin(o.x)+pos.y*cos(o.x),0.,0.);
float r,s,l,h,i,k,m,n; m=clamp(1.5-abs(b.y),0 ...
more ...