The Little Grasshopper

» I have a newer blog on GitHub; click here to jump.

Homage to Structure Synth

L-System Art
Some fun with Python, L-Systems, and RenderMan. This is a follow-up to a post I wrote exactly one year ago, Mesh Generation with Python.

August 2nd, 2011 at 10:21 am

WebGL Extension Viewer

Convenient little page that lists the WebGL extensions your browser supports, along with hyperlinks to the specification documents for each extension.

May 15th, 2011 at 10:07 pm

Deep Opacity Maps

GPU Fluid
Just a quick video to show off the latest iteration of my real-time fluid simulation, which now builds a deep opacity map for shadowing.

February 16th, 2011 at 2:55 pm

Noise-Based Particles, Part II

GPU Particles

I updated my old noise-based particle demo so that it now builds a large 3D texture to represent velocities, performing advection on the GPU instead of the CPU. This allowed me to increase my particle count by two orders of magnitude and maintain interactivity. In this post, I cover the basics of GL_TRANSFORM_FEEDBACK (known as stream-out in DirectX land), which is used to perform advection with a vertex shader.

January 29th, 2011 at 9:35 pm

3D Eulerian Grid

Liquid Nitrogen

I finally extended my OpenGL-based Eulerian fluid simulation to 3D and managed to get it to run at interactive rates on my GeForce GTS 450. As with almost all my blog entries, I’ve provided source code for you to play with, but only at your own risk. :)

January 23rd, 2011 at 6:06 pm

Single-Pass Raycasting

GPU raycasting over a volume requires ray start and stop points. Commonly these intervals are computed by drawing a cube (with perspective) into two surfaces: one with front faces, the other with back faces. The final pass is the actual raycast. In this post, I show how to avoid the overhead of the offscreen surfaces by performing a simple ray-cube intersection.

January 16th, 2011 at 2:59 am

Noise-Based Particles, Part I

Robert Bridson, that esteemed guru of fluid simulation, wrote an interesting 2007 SIGGRAPH paper about using Perlin noise to create turbulent effects in a velocity field. In this post, I play with this approach to create a simple smoke simulation with particles, and I discuss some of the rendering issues with OpenGL. For now, I’m moving the particles with the CPU rather than the GPU.

January 2nd, 2011 at 2:55 am

Tron, Volumetric Lines, and Meshless Tubes

Volumetric lines are handy for a variety of effects, including lightsabers, lightning, and particle traces. In this article, I show how a geometry shader can emit a chamfered cuboid for each line segment. The fragment shader can then perform a variety of effects within the screen-space region defined by the cuboid, including Gaussian splats and raytraced tubes.

December 31st, 2010 at 4:28 am

Volumetric Splatting

Volumetric splatting can be implemented efficiently with instancing. In this article, I show how to use splatting to extrude a streamline into a vector field. This technique would allow an artist to design a space-filling velocity field (e.g., for a particle system), simply by specifying an animation path through space. My article also covers some basics of modern-day volume rendering on the GPU.

November 28th, 2010 at 8:22 pm

Simple Fluid Simulation

Smoke

In this post, I discuss a simple implementation of two-dimensional smoke using GLSL fragment shaders. I provide C source that builds with Visual Studio 2010 and gcc.

November 21st, 2010 at 5:12 am

Path Instancing

Instancing and skinning are like peas and carrots, but skinning isn’t the only way to deform a mesh on the GPU. If you’ve got a predefined curve in 3-space, it’s easy to write a vertex shader that performs path-based deformation. I’ll cover the basics of the technique in this article.

November 7th, 2010 at 12:06 am

Silhouette Extraction

In this article, I’ll show how you can generate silhouettes using GLSL geometry shaders. I also discuss some of the rendering issues involved. I provide complete demo code that runs under Linux and Windows.

October 24th, 2010 at 1:10 am

Thick Glass with Floating-Point Textures

Glass Buddha

This post covers a simple way to measure thickness and apply a Fresnel term using a floating-point render target. Sample OpenGL code is provided that runs on Snow Leopard and Windows.

October 7th, 2010 at 1:12 pm

Quad Tessellation with OpenGL 4.0

This is the second of a two-part article on tessellation shaders with OpenGL 4.0+. This entry walks through simple Bézier patch subdivision by showing how to render Ed Catmull’s Gumbo model from the raw patch data.

September 6th, 2010 at 4:38 am

Triangle Tessellation with OpenGL 4.0

Sphere Tessellation

This is the first of a two-part article on tessellation shaders with OpenGL 4.0+. This entry gives an overview of tessellation and walks through an example of simple triangle subdivision.

September 6th, 2010 at 4:37 am

Patch Surfaces and Vertex Welding

This post is a follow-up to my previous post on mesh generation with Python. This time I’ll show how to evaluate Bézier spline patches. I’ll also show how to use Python to perform a vertex welding optimization.

August 21st, 2010 at 4:29 am

Mesh Generation with Python

Python is beautiful language for generating 3D mesh data. In this entry, I use the pyeuclid module combined with OpenCTM. I explore various ways to generate mathematical shapes, including polyhedra subdivision, parametric surfaces, and rule-based generation.

August 2nd, 2010 at 2:23 am

“iPhone 3D” In Stock At Amazon!

Word cloud of 'iPhone 3D Programming'Amazon has replaced the “Pre-order” button for my book with “Add to Cart”. To celebrate, I created a word cloud of the entire book using wordle.net and a python script.

May 19th, 2010 at 2:42 pm

PEZ: A Teeny Tiny GLUT Alternative

Pez Mesh
Pez consists of 1 source file and 1 header file. Like GLUT, it lets you quickly build simple OpenGL apps that will run on any platform. Unlike GLUT, Pez never makes any OpenGL calls on your behalf. Your job is to provide Pez with a render method, an initialize method, and a mouse handler. That’s it!

May 16th, 2010 at 4:40 pm

X to OpenCTM Converter

I wrote a quick-and-dirty X to OpenCTM model converter.

May 9th, 2010 at 6:43 pm

Antialiased Cel Shading

Cel Shader

Cel shading is a fun way to learn about shaders. This post walks through the development of a simple OpenGL 3.0+ demo for cel shading that antialiases the boundaries between color bands — without using multisampling!

May 2nd, 2010 at 9:34 pm

The OpenGL Shader Wrangler

GLSW is a tiny set of safe ANSI C functions that makes it easy to group shader strings into simple effect files. GLSW automatically prepends #line for proper error reporting.

April 29th, 2010 at 12:26 pm

Lua as an Effect File Format

Lua + OpenGLI discuss Lua as a way of organizing GLSL shader strings, with plenty of code samples.

April 20th, 2010 at 4:30 am