Saturday, 28 August 2010

More Summer Stuff

Went on a short break for a few days during the dull whether, but now I'm back again and the sun is shinning and I'm getting further behind with my summer project. What I didn't get round to blogging last week, I'm blogging now.

So I left the last post with a few things undecided and unknown. The undecided being, how the film is going to look and the unknown being, exactly how am I going to create a storm in the middle of an ocean. This is mostly a Maya orientated post.

I have been wondering how I am going to go about this technically. My first port of call was The amazing ocean shader in Maya and all the other bits and bobs which go with it. Although amazingly realistic and requiring no effort, it unfortunately isn't really a one button click solution. I haven't had much experience with how it works prior to this project. Most of what I'm about to say is what I've found out by myself and is not necessarily accurate. Which of course means that if anyone can correct me or give any extra technical advice, that would be great.

So, the ocean effect. By default it creates a flat plane with the ocean shader attached. The ocean shader not only shades the flat surface, it also deforms it to create the waves. I actually found a preset called stormy ocean or something similar. This also created some other effects along with the ocean effect. The one thing I did do was model a simple boat. It's very simple and only for the tests I'm about to show you.
I made the boat float on the stormy ocean using (and this is Maya technical talk) a 'boat' locator. This caused all kinds of confusion when explaining to my brother. Am I referring to the boat I made or the null object locater which just happens to be named boat? I did a quick render, just with preview settings and this is what I got.

The camera is also floating on the water and ocasionaly penitrates the surface. Not intensional.
The right side of the window shows the original render. The left side shows the result of messing around in After effects. I had said in a previous post about using my character in silhouette. I also thought about the boat being simple or simply shaded. So just to see what it looked like I applied a threshold effect on the video. Together with the rolling fog and everything else in black and white, (it is actually slightly tinted with colour from the original render) I thought it looked good.

So I went back to Maya and was thinking, great. I have an ocean… How do I create a whirlpool for the last sequence? Creating some sort of sucking, twisty effect isn't that difficult. And there are probably may ways to go about it. Whats difficult is getting it to look like the same ocean as used in any of the other shots. I wasn't going to worry about that at the moment , because at the time, I was not aware of how difficult it would be. I was more concerned about just creating a sucking, twisty effect.

I had this crazy idea of using a ring donut (torus primitive shape in Maya). When you create a primitive shape, it comes with a few attributes that can be set. Things like size, thickness, subdivisions etc. The donut also comes with a 'twist' attribute. The twist is effectively turning the donut inside out and back around. So when I animated that attribute on a loop, it created this constant sucking effect. To achieve the twisting effect, I used a twist deformer. This made it look like it was swirling around and around and sucking inwards. So the basic motion is sorted, but how do I make it look like part of the ocean? Well what you don't do is stick an ocean shader to the donut. As when I tried that, I found out that the ocean shader was effectively ignoring the motion on the donut and just deforming the geometry with its waves. The waves were just passing over the donut in a straight line.

I've called this effect and copyrighted it "The cat under the carpet effect". You've all seen it in cartoons where a cat or a mouse (possibly named Jerry) goes under a carpet, and you see the lump move about, while the design of the carpet deforms.
This is basically the same thing except in reverse. The ocean (the carpet) is being dragged along the floor while the donut (the cat or mouse) stays in the same place. No matter how much I make it twist it still looks the same. How do I fix this? Or how did I fix this?

Well, there happens to be an ocean texture as well as an ocean shader. Both nodes have the same attributes, except one is just a texture, and the other is a complete shader. So to put simply and quickly, textures use the UVs on an object. So f the Objects deforming, so are the UVs and if the UVs are deforming, so are the textures applied to it. You can probably guess where this is going now.

Now I did all these tests almost a week ago now so I don't remember the exact processes that I went through, but I'm sure it'll come flooding back to me. I have in the following test used an animated noise texture, instead of an animated ocean texture. The reason being that the ocean texture looks too much like the waves are going in one direction. Whereas the noise texture creates more general ripples.

Now this video shows a few more problems.
1) It looks more like a pond with a uniform whirl pool in the middle.
2) Having the donut fade out with a circular gradient isn't disguising the seam very well, (going from donut to ocean plane).
3) I think I used a bump map in this test, using the animated noise texture. Probably why it looks more like a pond.
4) The shading isn't very good. Mainly because I'm not using the ocean shader anymore and at this point my own shader hasn't been tweaked.

Very quickly, I decided I would use a displacement map instead of a bump map (displacement map deforms geometry - that's how the ocean shader works… I think - whereas a bump map just manipulates the surface normals).
I had to create my own equivalent ocean shader, that doesn't deform geometry (that's handled separately). If your wondering how I created my own ocean shader effect, think back to the realistic glass shading tutorials, 'Sampler Info' node, 'Facing Ratio' with a 'Ramp' etc. This creates a similar effect. Not the glass shader itself (it's not transparent), just some of the utility nodes.

Here are a few other videos showing various tests to create whirl pools.

And lastly, this is the final result of hours, no… a couple of days of tweaking and adjusting.

And with the threshold effect.

So expect the real film to look similar, but with the sky inserted and the boat moving as well. Possibly the occasional flash of lighting.

Oh I also thought I'd throw in these tests too.

An early test of creating a big wave. I don't particularly like them. They don't seem to fit with the rest of the ocean. Another idea is to utilise the 'cat under the carpet effect' ©2010 to my advantage.

So this wave is simple. It's embarrassing. But what if I sculpted a half decent looking wave together with a lattice deformer, or am I just wasting my time? One other interesting thing to note is that because this test is using the original ocean shadar, the displacement doesn't work very well verticlally, but thats because it's meant for flat surfaces. I guess the displacement for the ocean is only projected on the Y axis.

Oh and back to stylisation. Does anyone think the black and white look could work?

Well thats it for today. I've crammed a few days work in to one post and hopefullly it should be plain sailing from here onwards...


  1. Hey Ethan - what an exciting, visual post - great stuff; I'll have a proper look later, but that first Ocean Test is very effective indeed - even in that simple incarnation - the spray, the violence, all communicate very dynamically... And the grainy, b/w aesthetic really works for me!

  2. Hi! This is looking fantastic - I can't wait to see the finished article! Have you thought about the 'Making of' book yet?