Shader Toy Collection - 704 (Composition by cybero)

Author: cybero
License: Creative Commons Attribution-NonCommercial-ShareAlike
Date: 2011.10.05
Compatibility: 10.5, 10.6, 10.7
Categories:
Required plugins:
Audio Tools

One of a collection of 29 fragment shaders ported over from the collection of 41 hosted at Shader Toy [http://www.iquilezles.org/apps/shadertoy/]. GLSL shader '704' by Paulo Falcao (2010).

Amazingly enough. considering the fact that some of the 41 posted at Shader Toy and indeed some the 29 shaders posted here didn't execute correctly in Firefox 7.0, almost all were directly ported into QC without any problem at all.

The contributing GLSL fragment shader authors are Adrian Boeing, Auld, Danguafer/Silexars, Lars Huttar, L.Mallet, Mic, Psycho/Loonies, Paulo Falcao, Simon Green/NVidia, TGGC/BluFlame, Tigrou, Viktor Korsun, W.Yutani, XT95/FRequency, xTr1m/BluFlame and iq/rgba.

Thanks to them all for these GLSL goodies. They work neatly in Quartz Composer. Some of the remaining shaders posted at Shader Toy I failed to port, whilst others ported, but performed very slowly indeed. Currently they are not included in this collection, although they do produce quite outstanding results and are well worthwhile exploring further.

The music file included in the archive below is an original Garageband mixdown of mine.

The music file in the video post is 13 by Teeth Mountain - Copyright: Attribution-Noncommercial-Share Alike 3.0 United States: http://creativecommons.org/licenses/by-nc-sa/3.0/us/ Composer: Teeth Mountain

cybero's picture
Shader Toy Collection - 29 Shaders

All the 29 shaders in one handy zip file that also contains the accompanying music file and any externally referenced texture files within one handy project folder.

PreviewAttachmentSize
shadertoycollection.zip1.55 MB

gtoledo3's picture
Re: Shader Toy Collection - 29 Shaders

Some of those need some fixes from shader toy (I remember one that has an illegal cast), and some of them also really only work right with square resolution, even though they've exposed otherwise. You might want to really check that aspect out thoroughly - I ported most of them a few days ago, and some of them had some subtle stuff going on... I'll look through and see if I can catch the few things I noticed :-)

There sure are some impressive things in there aren't there?

gtoledo3's picture
Re: Shader Toy Collection - 38ish Shaders

Here are the ones I "ported", 38 in total. There are two multitouch derivs, and one reworking of the menger sponge that's midstream :-)

I think one or two may be from an old version of shader toy (?). I'm not convinced I didn't do anything stupid either, and all of the hashmark stuff for it working with webGL could be taken out.

I don't know if I hooked up the glsl grid to rendering dest for all of them, or maybe I was noticing the aspect ration issue with some, and petered out! :-)

(edit - I re-uploaded from a couple of minutes ago. I tweaked some dead images out of some and added some clears to some.)

PreviewAttachmentSize
shadertoy_gt.zip855.27 KB

cybero's picture
Re: Shader Toy Collection - 29 Shaders

Very impressive works indeed.

Regards how stable these shaders I've posted are, they start and stop neatly and haven't toppled for me, although a couple of them are too slow for my liking. Some of the really impressive 3D shader works don't load properly at all due to unsupported extensions, yet load AOK in QC.

I'm looking forward to seeing what the new OpneGL ES editor is like in the new xCode 4.2, BTW.

Some of the more demanding fragment shaders I had to set pixel resolutions as low as 320 by 180 to obtain a fairly steady performance level.

I'll have to take another close look over the codes regarding square resolution requirements.

gtoledo3's picture
Re: Shader Toy Collection - 29 Shaders

cybero wrote:
Very impressive works indeed.

Regards how stable these shaders I've posted are, they start and stop neatly and haven't toppled for me, although a couple of them are too slow for my liking. Some of the really impressive 3D shader works don't load properly at all due to unsupported extensions, yet load AOK in QC.

I'm looking forward to seeing what the new OpneGL ES editor is like in the new xCode 4.2, BTW.

Some of the more demanding fragment shaders I had to set pixel resolutions as low as 320 by 180 to obtain a fairly steady performance level.

I'll have to take another close look over the codes regarding square resolution requirements.

Well, none of them are modern gl things - they all run in QC's shader for example, so all of it's pretty hammered out as far as stability. Some of this stuff runs a lot better than it did a few~couple years ago, when I tried to run some of the demoscene versions on my intel gpu (running it now on nVidia 9600).

I don't blame the ones that are slow for being slow (yeah, I'd like them to be faster!), but they're doing some really amazing things...borderline offline quality stuff, so it's almost a given. That said, there are some great examples of cool looks that are insanely cheap - like that interactive torus shader thing. The relief tunnel looks just great to me. Things like valleyball just amaze me. I've followed iq's work for a long time as well, and he's definitely a big influence and does amazing work. It's really great that he put this stuff out there, as well as the other contributors.

Look at something like "shapes". That's really phenomenal, just as a lesson.

I think maybe the aspect ratio thing pops up in couple of the ones that draw circular things that animate in a pattern (like metablob for instance). When I was setting it up for multitouch, I noticed I really did have to have it be square for the blobs to draw aspect ration correct, and for stuff to track right, without adding extra math. That then made me realize that other ones had a little stuff going on too... I haven't gone through every one. For some others it messes with apparent FOV I think;feeding it the correct pixel w/h isn't enough for the shader to adjust aspect ratio correctly in all cases basically.

I guess as far as XCode 4.2 shader editor goes, I'm not really excited to see it, or waiting, because it's a subset of gl that's been around for so long... I'm more interested in experimenting with some modern OpenGL pipeline stuff available in Lion, but honestly, I can't stand using Lion or Xcode 4 on, so I just use SL day in day out. I don't want to get on an anti-Lion jag here though.

cybero's picture
Re: Shader Toy Collection - 29 Shaders

So far as getting more serious about OpenGL programming, I'm wondering just how to jump regards a future kit acquisition. Lion is capable of full 2.1 and 95% OpenGL 3.0 but only goes to GLSL 1.2. [Yes I know Core Features are supported up to 3.2 GLSL 1.5, BTW :-)]

I'm aware that my current GPU needs to keep apace to obtain support for the more recent specifications. Backwards compatability and iterative improvements to the build components. Implicit lack of hardware support for extensions forces the choice towards GPU that can also support 4.x OpenGL for a bit of future proofing.

Just wondering about getting some extra traction on the VM front by running VM Windows 7 on a new Mac with the best GPU support for OpenCL and OpenGL that I can manage to obtain.

Don't actually see what fits that bill at present in the Apple range.

Anyone had experience of successfully exploiting all that one's GPU supports in Windows 7 VM or should I jump for the absurdly cheaper option of having a separate bit of kit to do such Windows 7 + GLEW enabled development upon?

Difficult choices and I'm also wavering at present about building a Linux installation.

Not interested in a Hackintosh, just want to keep up to date with stuff.

It's great in one sense that Lion supports this iterstion of kit I'm typing this post on. However, it seems to me that Apple might need to do a major shift to keep up in some key graphics development and origination areas.

I'm sure there's plenty of mileage to be had from the current soft|hard builds Apple vends. It would be really nice to be exploiting all that the current raft of GPUs allows though.

photonal's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

Wow these are great collections! Thanks for sharing them - though will take a while to examine each one ;-)

cybero's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

There are some others and also more of the same from gtoledo on this thread. The DNAForce is sweet indeed :-) .

gtoledo3's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

Are there any that escaped porting (edit, note below)?: One thing that's semi on-topic - I really regret that I missed out on the fractal lab beta when it was going on (another webgl glsl shader compiler/viewer). Subblue's work is nice, and I would have liked to see what he did.

(edit)I realized that I didn't port clod, because psonice did it ages ago, and I didn't port mandelbulb, because I already have a couple versions.

I think the shader toy message by iq should be included on this thread, in respect of the contributions of the authors (even though they've been credited in the notes of the shader code):

  • Please remember it probably makes sense to credit the authors if you reuse these shaders in your blog, software, demo, or portafolio. Also, the authors definitely want you to let them know if you plan to use their shaders in your applications or products.*

gtoledo3's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

If you start looking into some of the shaders that construct elaborate scenes/shapes, this is a great resource for adding shapes to construct stuff with (note that this happens at the beginning of many frag shaders that do raytracing and/or construct scenes - you setup the shapes you're going to use, then invoke them later in the code.)

http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm

Here, IƱigo Quilez shows distance functions for a variety of shapes.

This is an index to his writings:

http://www.iquilezles.org/www/index.htm

He doesn't really spoon feed and does assume the reader has a certain amount of investment of time in working with shaders and OpenGL, which is fine by me, I'm just happy for some of his lessons.

Adrian Boeing's site is also a good resource for further reading:

http://adrianboeing.blogspot.com/search/label/demoscene

photonal's picture
Export data stream from the Fragment Shader?

Love valleyball and Metatunnel!

Anyone know if it is possible (and how?) to export a data stream from the fragment shader for use in the rest of a QC comp? i.e. create an Output from the GLSL shader?

voxdeserti's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

These are pretty beautiful! Do I understrand correctly: GLSL fragment shaders coding is like modelling 3d objects then projecting it on 2d glsl grid? Or this is an illusion of 3d? Is it possible to draw such scenes by means of CI filter language?

gtoledo3's picture
Re: Export data stream from the Fragment Shader?

Yeah, you stack stuff up in front of it. It's a layer...

You can place it in a render in image, get the pixel data, and do stuff with that. There's no "data stream" other than pixel information.

gtoledo3's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

Sorta, but not really on the 3D object point.

In a fragment program, you can make every pixel x/y a given color. So, this is using math to control the patterns those pixels get colored. It's flat, but it's probably not technically right to call it an illusion of 3D anymore than a scene setup with 3D objects is an illusion of 3D. One has to "do stuff" to make a 3D modeled scene render stereoscopically, and the frag shaders could render stereoscopically with work as well - it's possible. If rules in the fragment shader are happening over 3 axises, then it seems (to me) to be as real of a "3D" scene as a modeled thing, but you're manually setting up tons of stuff... it's just different! :-) I'm sure other users have some constructive thoughts on this too...

voxdeserti's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

When I did some experiments with CI filters (generating images with sin-cos and other math) it sometimes also looked like a 3d scene. My interest now is: how to control such '3d' scenes by '3d' controller such as kinect? Just imagine how interesting it could be to walk through 3d interface by moving in real space!! Or something like that...

photonal's picture
Re: Export data stream from the Fragment Shader?

If I place it into a 'Render in Image' then I get a corrupted image with a lot of flickering - any idea what's going on with that? Any parameters I should be watching out for?

cybero's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

Put a Clear patch at level one in the RII.

photonal's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

Thanks for that tip!!! Been meaning to ask about that for ages, as I've had that issue for quite a while now. What a relief :)

cybero's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

No Clear patch does make for some great glitching and no mistake :-).

psonice's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

Simple sin/cos/etc experiments might make something that looks a little 3d now and then, but you generally won't be able to explore it in 3d, because it's not a true 3d space you're creating.

Most of the shaders in that pack ARE actually rendering true 3d, so you can in fact move around, rotate them, move the lights and so on. But it's totally different from the 3d you do in QC - there's no meshes, you can't load an object, and so on.

It's pretty much raytracing going on - usually using SDFs (spherical distance fields). The 3d objects/worlds are generated using formulas, the camera is positioned in 3d space using more formulas, and the animation is yet more formulas. It's pure maths, basically.

If you want to start playing around with them, the camera setup and animation is usually inside the vertex shader. The scene is rendered with a simple loop - somewhere you'll find a for() loop that move the current position in space along a ray.

At each point in the ray, it will do a distance function, usually along the lines of "distance = f(position, rayDirection);" that gets the distance from the nearest surface.

If you want to learn more, check on pouet.net - find the threads 'raymarching for beginners' and 'raymarching toolbox'. Also read the original white paper on spherical distance fields.

Also, I've not looked at the shaders in this pack - but most of them are from tiny demos (usually 1k or 4k, including openGL setup code and music!) Because of that they're usually very optimised for size, making them extremely hard to understand. If that's the case, take a look at this one: http://kineme.net/composition/psonice/Opticalillusionselftanglingwires (and scroll down for a better version with reflections). It's probably horrible undocumented code, but at least it's not horrible undocumented code that's been optimised to hell and then compressed :D

gtoledo3's picture
Re: Shader Toy Collection - 704 (Composition by cybero)

...and to tag onto psonice's statement above, for the ones that aren't raytracing based (things that are like classic "twist" and "pinch" type 2D deforms), this article explains much of the logic:

http://www.iquilezles.org/www/articles/deform/deform.htm

iq is so darn awesome!