RTSwarm - Vector Fields on the GPU Demo

Picture 5 Lately I’ve been spending some time learning GLSL shaders. I’ve managed to coerce fragment shaders to act as sort of pseudo geometry shaders. I do this by loading an array of vertexes into a float pixel buffer and use it as both a texture and a destination FBO for the frag shader. The result is pretty good. With async readback via PBO, I can push around 16k particles on my 128MB X1600 with little to no CPU load. I like it.

In the latest iteration of my demo, I’ve stuck a “home force” for all the particles on a grid. Then I tri-strip them to create a sort of particle surface. The result is a jelly-like surface that can be deformed by applying forces to the vector field. My friend Shan says I should make a screensaver out of it. I’m thinking I might just do that, if I can stop playing with it for long enough. Anyhow, if you have an OpenGL 2.0 capable mac, please try out my demo and give me your impressions.

Download RTSwarm Demo

Here’s some screenshots of the real-time deformation if you don’t:

Picture 7

Notice the area of the image that got displaced warps and page-curls over the rest of the image.

Picture 8

As the particles burst from the red shoebox, they move like electrons in a magnetic field. Notice how the red clouds over the black shirt.

Picture 6

Same thing here, with a “suck” force on the mouse, it leaves a disturbed contrail through the field.

Picture 5

“Blow” forces cause the field to distort away from the mouse, warping the image as the particles flee.

0 Responses to “RTSwarm - Vector Fields on the GPU Demo”


  1. No Comments

Leave a Reply