Recent Posts

WebGL Ray Tracing

The past couple of weekends I’ve been trying out some WebGL powered rendering that can be embedded into my website. Above is a little something I coded up, made by ray marching implicit surfaces using distance fields (after being inspired but some of the content over at shader toy). I recommend viewing it in a Chrome browser, but any browser that supports WebGL should do. Currently, it doesn’t work on Edge or IE browsers which tend to have a hard time with WebGL support, as evident with the shadertoy site that has the same trouble.

I’ve done a few things with ray tracing/marching techniques previously but it really is a joy to work with when you get it down, allowing you to focus on the rendering without needing explicit models, textures or lots of boiler plate code to create great looking scenes.

The above implementation is only a little over 100 lines of code in a pixel shader. Other then that, WebGL requires a tiny bit of initialisation code and there’s a pass-through vertex shader, and that’s it. So far, WebGL seems great and I’m tempted to make a basic little game with it to embed at some point.

For anyone wanting to do something similar I’d recommend the Atom text editor with plugins for GLSL syntax highlighting and a nifty little plugin called Browser-Plus that allows you to use an integrated web browser that will auto-refresh when you save code changes. Using a split screen setup it was a great way to immediately see changes as I coded them without having to mash F5 over and over.

  1. The MSc Departmental Prize Leave a reply
  2. Update and MSc Results Leave a reply
  3. Bit’s Blitz – Puzzle Game Leave a reply
  4. My BSc in Computer Science – Results Summary 1 Reply
  5. Halloween Pumpkin’s – GLSL Programming Leave a reply
  6. Dungeon Master – An Iconic RPG 1 Reply
  7. OpenGL Cross-platform PC/PSP Game Coursework Leave a reply
  8. Exchange Reports Project Overview Leave a reply
  9. The “dumbing down”of the games industry 8 Replies