"Ladybug" Scene/Renderer

Published 2023-06-12


I took a shot at "demaking" an image made by Inigo Quilez. His original piece draws an animated scene which is modeled and rendered entirely by code which runs on the GPU (note: this link takes you to a webpage which runs heavy GPU code, and it will likely slow down your browser while it's running): https://www.shadertoy.com/view/4tByz3

My version is a lot simpler. It draws a single still image in two passes (first a depth/material-ID pass, then a lighting pass to get the final result), so be patient! Nothing else happens after it finishes drawing the image.

Unlike the original version, which uses Signed Distance Field modeling to describe its shapes, I used a point-cloud generator/rasterizer which uses a z-buffer for sorting (very similar to the triangle-renderers used in almost all current 3D game engines, but it only draws points instead of triangles). Each object on the screen is created by some function which submits a sequence of 3D positions with material values to to the rasterizer.

All lighting operations (diffuse + specular + approximated directional shadows + SSAO) are performed as a post-process, like deferred rendering in modern environments. Since the shapes in the scene are just arbitrary collections of points, they don't have "real" normals - instead, all normals are approximated based on the depth buffer, after all the points have been rasterized.