Update- Global Illumination

Here is an update! I have implemented anisotropic voxels (6 directions) and added emissive materials and reflections.
The scene is still static (geometry-voxelization in real time requires a geometry-shader or compute-shader, and they have computers with excellent hardware… :neutral: ) but I have a solution that might just work! The plan is to create a signed distance field, it gives some advantages:

  • Voxelization is just a single function call, in a shader
  • Unlimited detail
  • Normals are computed via a simple function
  • Memory-friendly, no vertices needed
  • Might be slow to trace

Currently reflections move a bit weird and no blurring is used to remove the noise.


Very nice! Is there any way we could persuade you to share the code? B)


It took a while! I don’t understand git…
Code is in “Code.txt”. It uses “#version 300 es” in shader. Enjoy!

X: ignore
Y: ignore
Z: ignore
Rot: Rotates the light
LC: Light color
CR (Coneratio / glossiness on ball): in degrees
Lod: debug thing, ignore
Bounce bools

Holy gammoley that’s sweet.

Really incredible. Very immersive interface too. Is the sphere made up of voxels too?

@MMGames I tried importing it but I get errors about the version number not being supported.


@UberGoober I am not sure about this, but your device might not support that glsl-version. Only newer devices like iPad air supports it.

Yeah I’m on the odd stepchild known as iPad 3. So I’m SOL?

Well, if you convert the shaders back to the original version, and replace texelFetch with a texture2D where the coordinates are exactly at the center of the pixels (cancels out the bilinear filtering), you would acheive the same result!

A bit beyond me, mate, but no bother.

@UberGoober Try this, the emissive objects doesn’t show on screen and you only get the first bounce. I hope it works:


for some reason the scene i got when i ran it was much simpler and more noisey than the video you posted. where can i get the proper latest? this is sweet. i am working on a single shader that renders full scenes with ray marching (like shadertoy.com stuff uses).

@MMGames hey so and hey so: thanks for posting that! Periodically the tides of life sweep me away from Codea for months at a time, so I’m sorry I missed your update there for a good long minute.

It runs without error, unfortunately all I see is a black screen.

Also, oddly, it breaks some of the control buttons on the Codea panel. Reset works, Play/Pause works, but the Exit arrow doesn’t work, the Camera doesn’t work, and the Video button doesn’t work. Because the Exit arrow was broken, I had to terminate the app to get out of the program. Odd!

Thanks again though, I mean it, us old iPads can use all the help we can get. :slight_smile:

@UberGoober Well, the code is not the best! (: I really must clean up the whole project, voxel cone tracing is quite slow. I can upload the newest version without glsl 300 es so you can see it in real time, but the newest update does not allow me to open or edit shaders in projects so I must wait until they fix it. Meanwhile you can search for voxel cone tracing i shadertoy.com, I have implemented a version there too! Newest version looks like this