Friday, July 27, 2012

Gumming up the works

Since the last post, I've been working on finalizing the FLIP simulation for the gummy bears and shading it. The simulation just needed some additional tweaking and came together quite nicely. One of the issues that I was fighting throughout the simulation process was the timing. I wanted to pace the evolution of the gummies in a very specific way, and my previous simulation times were very long (350-500 frames). This final version is appropriately long, and the giant gummy bear forms together in a smooth way, while still looking organic.



The next step, shading the bear, was an interesting challenge. The shader for the individual gummies uses sub-surface scattering and refraction; the subsurface color is tinted with the surface color, because each bear is only one color. When the fluid bears come together, all of the colors mix together. If the same shader was applied to the fluid, then as soon as the FLIP particles are not near the surface, their color is lost. I needed a way to influence the surface color using the FLIP particles in the middle of the bear.

My first idea was so use SSS point clouds, using the FLIP particles as the point cloud. The problem with this is that, since the point cloud is expecting pre-calculated illuminance values for the surface points, by plugging in the FLIP particles as the point cloud to be read at render time, you bypass the ray-marching that occurs during normal SSS calculations. Another aspect which doesn't work the same way as the real gummy bears is the fast that the color we see from the gummy bears is being refracted through the gelatinous fluid that is the gummy bears.

One of the other interns Ethan suggested a surprisingly simple solution. By using metaballs instead of the particle fluid surface, you can represent the metaballs as a surface or as a volume, and in this case, we want both. The basic premise is to create a fluid surface that is a purely refractive material, and then create a colored volume inside the bears. By reducing the density of the volume shader, the refracted rays accumulate the different colors of the volume as they are refracted through the fluid. This approach  worked wonderfully well, creating a look of a multicolored, semi-translucent material that is relatively quick to render.


This is only one component of the final composited image. I will also be putting out a SSS pass, to use as a mask for this refracted color, as well as a colored refraction pass, where the refractions are colored by the point color. The next step for this project is to get some passes rendered out and start working out the composite, then I can start refining shaders, especially for the environment, and lighting. After that it's on to rendering.

No comments:

Post a Comment