Thoughts of a graphics programmer and spare time photographer

Main menu

Tag Archives: refraction

In this seminar, Dr. Greg Gbur presents the current state of research on cloaking devices, the differences between science fiction and what seem to actually be possible, and different applications beyond invisibility, like protection from thermal radiation or earthquakes.

smallpt is a bare minimum path tracer written under 100 lines of C++, featuring diffuse, and specular reflection, and refraction. Using the detailed explanation slides by David Cline, I experimented porting it to GLSL on Shadertoy.

This proved to be an interesting experiment that brought a few lessons.

GLSL support in WebGL is still nowhere near robust: valid code will or will not work depending on the platform, the browser, and whether the OpenGL layer is native or not. The statements “break” and “continue” in particular seem often to break everything.

You can see the shader and tweak it here. By default it uses 6 samples per pixel, and 3 bounces, which allows it to run smoothly on average hardware. I found 40 samples per pixel and 5 bounces to give nice results while maintaining interactive framerate.

Path tracing, 40 samples per pixel, 5 bounces

Update: since GLSL Sandbox has a feature, reading from the previous frame buffer, that Shadertoy is missing at the moment, I thought it’d be interesting try it to have the image converging over time. A little hacking later, a minute or so worth of rendering got me this kind of result: Given the effort, I am really pleased by the result.

Last weekend the demogroup Mercury released at Tokyo Demo Fest the final version of their invitation to the upcoming Revision party: a 64kB demo called Epsilon. While the complexity of the scenes is very limited, the rendering, seemingly a raymarching shader, features a couple of very noteworthy real-time effects including ambient occlusion, reflexion (up to two iterations it seems) and refraction, caustics, and an hexagonal bokeh depth of field.