Making Ocean #1  
Ocean Wave Displacement Shader / March, 2012

This is the technique that we used for World of Warcraft Cataclysm Cinematic with my co-worker Matt Cordner. I also presented this in Malcolm Kesson‘s 2010 Siggraph Asia course Introduction to Using Renderman as a production example.

I talked about following topics.

1. Ocean Wave Displacement Shader
2. Generating polygon geometry from displacement shader using RSL-plugin
3. Spray Particle simulation through farm and rendering with Ri-filter
4. Under-Water Bubble using render-time multi-point Ri-filter

This is the displacement shader attached to a simple nurbs plane. It looks pretty complicated, but the idea is simple.

When we started to work on the shot, we did try some simulation software package, but it was little hard to control and hard to get the exact amount of detail we wanted to achieve.

So, we changed the direction to little more traditional way, which is Renderman displacement shader on a simple geometry. It was faster and cheaper but highly art-directable, and it worked out pretty well.

When I got this shot, my first focus was how to make peak shape of ocean wave. I knew that I’m going to use multiple noise patterns with different size and speed, but I wasn’t sure how to achieve the peak shape, so I tried couple of different methods.

And, here is the first method that I tried, which sort of worked. The idea was actually from the Houdini geometry operator “peak”. In most case, displacement shader moves the point “P” along surface normal. So, if you use noise() function as a displacement shader in usual way, you get the red line in this picture.

Usually, in displacement shader, we call calculatenormal() after we move P to make correct normal direction for surface shading.

But, after we calculate new normal and move the P again along the new normal, we can get this nice peak shape, which looks kind of similar to wave.

It looked ok, and I think people liked it, but at that time we hired new FX artist Matt Codner, and he was assigned to another ocean shot and did his own R&D, and I saw what he was doing and found he was making something better. So, I tried his displacement shader for my shot. It worked pretty well but the geometries we were using were little different, so I had to modify the shader for my shot, so I started to look at his shader code.

So here’s what I learned from his shader.


If we look at real wave, we can find every point moves not only up and down but also back and force, so they actually move along a circle, which can easily be implemented using sin() and cos() in Renderman shader.

Watch the yellow points on the surface. They first move only up and down by sin(), but if we move them back and force using cos() function, they start to draw circles, and we get the nice peaks.

The next step is to add multiple waves with different size and speed in different angle. I used 1000 for the actual shot.

There are some useful data that we can grap from the shader, which can be used for color texture or particle simulation.

For example, “d” is the distance between the original P and the modified P, where we can detect the higher part and lower part even when the original geometry is not a flat plan.

a1 and a2 are the area of micro-polygons. we can see a2 is smaller then a1, which means the sharp part has smaller size of micro-polygons, and we can use those value to extract the peak part for various purposes. I used it as a foam texture in comp and also spray particle emitter.

Here are some of the utility AOV channels from those data.

Continue in Making Ocean #2 …

Powered by Wordpress, Theme by Hosuk