Username
Password
Auto-login
Show my name in the online users list
Not a member?
Please register.
Forgot your password?
(2) May 2008
(1) January 2008
(1) November 2007
(2) September 2007
(7) August 2007
(2) July 2007
(1) June 2007
(3) May 2007
(4) April 2007
(8) March 2007
(9) February 2007
(2) January 2007
Creating a Toon Ocean
Posted: Feb 07, 2007 - 05:57 AM
Category: tutorials
toonOcean.ma (scroll to the bottom to download related material)

One of the more difficult things to toon shade is water. A difficulty with the Maya Toon feature is that currently it does not work with the Maya Ocean feature, or for that matter, displacement mapping in general. One can convert the displacement to polygons, but for an ocean one needs the animation and displacement to poly does not support history. One workaround is to create several blendshapes and animate between them, but this is tedious. The following tutorial takes advantage of the ability of the toon shader to create an interactive displacement mapped mesh.

1. MENU "Create: Polygon Primitives: Plane"
Initially set the subdivisions to about 50,50 and scale it up to the size you want your ocean to be, although try to keep the size as low as possible so you don't need too high a subdivision level.

2. MENU "Toon: Assign Outline"
image1.jpg
3. Edit "pfxToonShape1":
Making the following edit creates an offset mesh we can use for our displaced surface:
profileLines = "Offset Mesh"
lineOffset = 0.1 (the offset mesh should appear)

Now turn off all the other lines on the toon node:
borderLines = OFF
createLines = OFF
image2.jpg
4. Hide the plane (select pPlane1, then type Cntrl+h)

5. Edit the toon offset mesh in the attribute editor:
In the outliner select "polySurfaceShape1" under "pfxToon1ProfileMeshes".
Under "Render Stats" in the attribute editor turn off "opposite" and turn on "double sided".
Under "ObjectDisplay: Drawing Overrides" turn off "enable Overrides"

6. Map the line width of pfxToonShape1 with an ocean texture:
Click on the map button on "Line Width Map" in the attribute editor and select the ocean texture.
The connection editor should appear. Connect ocean1.outAlpha to pfxToonShape1.lineWidthMap.

7. Set pfxToonShape1.lineWidth to 50 (type in the edit cell).

The offset mesh should now look displaced somewhat. You can use the lineWidth on the toon node to control the amount of displacement
image3.jpg
8. We need to force a rebuild of the toon offset mesh during playback, otherwise our ocean won't animate during playback (although it does update when playback stops). We can animate the lineOffset attribute on the pfxToonShape node to do this. Create a simple "do nothing" expression by typing:
"= 0"
into the "line offset" edit cell in the attribute editor. If we instead used keyframing we would need to key two frames at the start and end of the animation.

9. Edit the ocean texture in the attribute editor:
To make the waves move type:
"= time * 0.5"
into the time edit cell. The " * 0.5" is just to slow the waves down a little. You should now be able to see motion when you playback.
ocean1.scale = 30
ocean1.numFrequencies = 10
(good for big ocean waves)
waveLengthMax = 10 (larger range between big and small waves)


We now have a mesh with an interactive ocean displacement. We can now toon shade it.

10. Select the ocean surface
( "polySurface1" )

11. MENU "Toon: Assign Fill Shader: Light Angle Two Tone"

(set the color ramp to your preferred ocean colors)

12. MENU "Toon: Assign Outline: Add New Toon Outline"
On pfxToonShape2:
creaseLines = OFF ( lines along triangle boundaries look bad on an ocean, we can only use profile lines )
borderLines = OFF

You should now see lines around waves when the view is near the water.
image4.jpg
13. MENU "Create: Lights: Directional Light"

14. Enable shaded view with "all lights".

In the window "render" menu select "high quality" If you have a good graphics card you should see the two tone wave shading. You can rotate the directional light to find the best direction.
image5.jpg
This is the basic setup. We can now add some refinements.
15. Make the tops of the lines white using a line modifier.
Select pfxToon2
MENU "Toon: Create Modifier"
On the modifier enable "modify Color", set the color to white and the widthScale to 1.0
(no effect)
Set the modifier "shape" to "Cube".
Scale the modifier
such that it covers the entire ocean and move it up so the bottom is near the ocean bottom, yet still covering.
Edit the dropoff ramp such that you get a transition from black to white near the wave tops( a quick drop from 1 to zero near the right side of the ramp).

You will likely wish to increase the resolution of the mesh before rendering ( increase subdivisions on polyPlane1 ). Also the render antialiasing should use contrast sensitive production and for good lines enable paint effects oversample and post filter.

Here is the file after some fine tuning.
toonOcean.ma (scroll to the bottom to download related material)
I have made the lines somethat transparent (lineOpacity) and adjusted the thick thin effects by using lightingBasedWidth and profileWidthModulation. I also enabled screenspaceWidth and set distanceScaling such that the lines get smaller in the distance, but not by as much as they would with strict perspective.
In order to post any comments, you must be logged in!
  Posted by mayamentor  on  08/14  at  12:34 AM

GREETINGS FROM MEXICO CITY !
MR DUNCAN, I MEET YOU AT SIGGRAPH 2007 AND LIKE VERY MUCH YOUR JOB WITH THE TOON OCEAN
I WANT TO LEARNING THIS BUT I CANT SEE THE PICTURES IN THIS TUTORIAL MAYBE IS THE NEW AREA PAGE
CAN YOU PLEASE HELP ME WITH THIS ? OR SEND ME A PDF FILE WITH THE OCEAN TOON TUTORIAL ?
THANK YOU SEE YOU LATER.

  Posted by elvis75k  on  02/08  at  03:00 AM

wow! amazing!! Duncan, theese days you’ve got some time
to give you precious hints.. Thanks a lot.

-elvis

 
Page 1 of 1 pages