Pages

Smoke on the water

Unfortunately, this post won’t contain any code as a lot of it is still under development, but I thought it worth showing what I’m currently working on. I currently have two tools I’m close to completing; Water Simulations and Voxel Rendering. I’ll explain a little more below, but first, here’s a quick example of what they look like.

Water Simulation

The water simulation started because I was curious whether it would be possible to create simulations in Nuke, and after a quick look around I found Sprut, a really nice simulator for some simple 2D water effects by Theodor Groeneboom. However, I wanted to make something with a bit more control. My, as yet, unnamed water simulator (I’m open to suggestions!) takes up to three inputs: “Source”, “Terrain” and “Water”.

Source is read every frame for any additional water being added to the system. It can also be used as a drain by giving negative numbers. This way you can easily animate a water source turning on/off, moving or even a swirling drain.

Terrain acts like a 2D height map, allowing water to flow down to lower areas, or be blocked by walls. For example, I gave the following sequence a noise pattern and let water flow down for a result that looks like expanding rivers.

Water is used to give an initial state for the water, if you wanted to start with a full pool for example. It can also be given a frame from a previous simulation and can continue simulating from it.

Voxel Renderer

The voxel renderer is, albeit, a little obsolete following the impressive work of Hagbarth and vortechs_fx, but a fun project nonetheless. It’s a series of nodes, which can be used to Generate a voxel grid, generate Noise within the grid, Light it and Render it to screen. I’m also planning to apply a lot of the simulation logic used in the water simulator to see if it’s light enough to simulate basic smoke effects within Nuke.

The methods are heavily optimised for GPU rendering through blink script, and currently runs at Full HD in near real time for a 50 x 50 x 50 grid. The rendering method is currently using trilinear interpolation to smooth out the result, but there a number of interesting methods out there that I’m hoping to explore before releasing, so it may be a while before this one gets uploaded anywhere.

I don’t have too much to show on this one, however, I quite enjoyed the look of a lot of the bug-testing renderers I had to make, so please enjoy the breakdown of each ray as it walks through the voxels of a 3x3x3 grid: