30 January 2016

particle advection

I got particle advection working with advection-reaction-diffusion and vorticity confinement. The particle system is based on Memo’s MSAFluid example. 100,000 particles being pushed around an advection-reaction-diffusion velocity field.

Moved to Blogger

After putting up with it for 2 weeks, I couldn't stand the extra compression tumblr adds to everything. It handles this type of content particularly poorly. They also don't support the <video> tag. I'm now hosting html5 videos on dropbox and embedding them here. I have a bash script to do the encoding for me.

Here are the guts which take a png sequence and convert it to a YUV file which is used to make a webm which is used to make an mp4 for the Safari people.

png2yuv -I p -f 60 -b 1 -n $numFrames -j $input > $outputYuv
vpxenc  --good --cpu-used=0 --auto-alt-ref=1 --lag-in-frames=16 --end-usage=vbr --passes=2 --threads=2 --target-bitrate=3000 -o $outputWebm $outputYuv
ffmpeg -i $outputWebm -r $_frameRate -codec:v libx264 -preset slow -b:v 2500k -threads 0 -codec:a libfdk_aac -b:a 128k $outputMp4

vorticity confinement

Here’s the previous advection-reaction-diffusion simulation with additional vorticity confinement and buoyancy terms. This gives me more control over the vortices and overall flow of the field. In the video I alternate the strength and direction of the buoyancy with mouse input. Coupled with reaction-diffusion, the grid fills up quickly, so I’m already thinking of intuitive ways to manage this without resetting everything. The implementation described here was a big help.

29 January 2016

I was working on visualizing the velocity field for simple advection when this Euclidean waterpark emerged.


Naive coupling of reaction-diffusion with Stam’s advection. The Gray-Scott reaction and simple 4 axis laplacian used for diffusion are not unconditionally stable as described by Kim, which I would like to make my next technical hurdle. I’m mostly excited about Ted’s anisotropic reaction-diffusion which has a lot of potential to be used expressively. 

I might take a step back at this point and start thinking more about the bigger picture in terms of application, artistic control, sound synthesis, and pushing the system visually.

25 January 2016

simple advection

This is a CUDA implementation of Jos Stam’s Stable Fluids. It is perhaps the simplest application of the Navier-Stokes equations and is focused on speed and stability over accuracy. Stam’s solution of back-tracing “particles” for the advection step is elegant and was fun to learn. I’m still trying to wrap my head around the projection term which forces the simulation to be energy conserving. Diffusion here is unconditionally stable using the Guass-Seidel relaxation he suggested in the games-oriented version of his paper.

cuda r-d

This was the first video I made while experimenting with CUDA. Here I was hoping to match to a simple reaction-diffusion program using FieldViewer. FieldViewer is a c++ application written by my advisor Ted Kim for his pattern formation class.

Since it was my first step into programming on the GPU that wasn’t using shaders, I wanted to verify the simulation results by comparing them to ones coming from the CPU in FieldViewer. I was able to match the diffusion term exactly, but adding reaction introduced a relative error that grew to 1e-4 after 10,000 frames. This is still an open question.



Every blog I’ve ever made has been abandoned. Generic, specific, referential, original, collaborative, private, it didn’t matter. I expect the same fate for this one, but this time I’ll welcome the end as it will, hopefully, be being in conjunction with my completion of the Media Arts & Technology program. This blog will be informal documentation of whatever I’m doing creatively up until that point, although the main focus is intended to be on my thesis. I hope to post about other projects I’m working on here as well, including research being done in the Allosphere.  The first few posts will be covering work done previously on my thesis, and I hope to eventually average at least one update a week.

A thesis in MAT can be more of a project and less of a publication, an option which I’ll be taking advantage of. I’m a little late deciding on something, but a topic is finally emerging involving dynamic systems, GPU/parallel processing, realtime rendering, and expressiveness. Ultimately I want to create an instrument in the musical sense that one plays intuitively. The output will be computer generated imagery and sound, although I’ve only focused on implementing visual systems and getting my feet wet with CUDA so far.

I’m giving myself a maximum of 16 more months to graduate which would mean I’ll get a Masters in a total of 3 years. Before coming here I had a head full of visual effects workflows and 3d software UIs which had to be abandoned to focus on programming languages, so I’m okay with that number. I’m okay with most numbers, though.