3D fractal with GLSL


I wrote a glsl quaternion julia fractal program based on the cg shader by Keenan Crane (http://graphics.cs.uiuc.edu/svn/kcrane/web/project_qjulia.html). I ported the code to glsl and modified it a bit.

You need the shader model 3.0. If you decrease epsilon or max step size too much, the program can crash, because the instruction size can exceed 64k. I will solve it using multipass texturing. But for now, it’s for test purposes, only.

You can use the program as written below:

The hot keys work only, if the fractal image is focused with the mouse.

left mouse click: rotation of the fractal

ctrl+left mouse click: zoom

alt+left mouse click: movement of the fractal

Shift+left mouse click: rotation of the light relative to the eye’s position

Shift+Ctrl+left mouse click: move the light from or to the rotation center

Shift+Alt+left mouse click: movement of the light source

l/L: cx

i/I: cy

j/J: cz

k/K: cw

“space”: toggle animation on/off

+/-: iterations

e/E: Epsilon

s: shadow

m/M: maximum step size

The colors can be changed by Fractal->color settings.

A video will be produced shortly.

Here is the link: Julia 3D and here the code: http://www.lichtundliebe.info/projects/3DFractal.zip.



Whoa! NICE! :-o

I get some errors with implicit conversions between "const int" to "float". Might want to check your GLSL code to make sure it's compliant. Other than that, awesome :wink:

Too bad I can't test it on a decent video card, until my laptop gets fixed…


I found such a conversion error. Yes, every glsl compiler works different and some are very strict. Please tell me, if there are more errors and where.