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.

advection-reaction-diffusion



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.

repo:
https://github.com/ultrareality/2_Graphics/tree/master/00_kk/simpleRD