Billboards and particle rendering

Geeks3D recently posted a couple of posts on billboards rendering using vertex shader or geometry shader, and particle rendering performance when using point sprites or geometry shader.

A GLSL version of smallpt

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.

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

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.

Path tracing, 40 samples per pixel, 5 bounces

Path tracing, unknown number of samples per pixel, 7 bounces

Yet another GLSL live editor

I mentioned already the current trend of writing live coding tools. During the Tokyo Demo Fest, which was taking place last weekend in Akihabara, Hole performed a live coding with his own tool, thus VJ-ing while the DJ was on stage. Interestingly, this led to collaborative coding when someone joined him. This could be a very interesting direction to explore.

The tool, LiveCoder, looks pretty clean on big screen and may be worth trying out.

Live coding and apples

There is a recent trend of coding with an overlay editor on top of the live result, changing as the code gets written and modified. I suspect it originates on one hand from the work of the folks at Sexy Visuals and some of the videos Iñigo Quilez has been publishing demonstrating some concepts, including a basic raytracer in less than half an hour. And on the other hand, on Shader Toy (made by the same usual suspect), a web page using WebGL to allow fast GLSL shader prototyping in a browser.

It was only a question of time before someone would merge both concepts. Thus Ricardo Cabello (often known as Mr Doob) sparked off a lot of effervescence when he published his GLSL Sandbox. People would try many things, give feedback and advices, someone would quickly come up with a gallery… But after various toy experiments by various people, IQ would come back and make waves with his procedural apple. He also published another live coding video, showing how it was made.