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
Animating a Book with nCloth
Posted: May 18, 2007 - 04:08 PM
Category: nCloth
With nCloth it is relatively simple to create a fully dynamic book where one can flip pages naturally. It would be almost impossible to capture the subtle motion of twisting pages this provides if one instead used deformers or other non-dynamic techniques.

There are many layers of self collision among the pages of a book, so high quality settings are required and it is important to structure the book so it is efficient to simulate. It helps if the pages are relatively low resolution for simulation and then later smoothed and extruded before rendering. The pages are first combined into one object before creating the cloth so that only one cloth node, which is much more efficient to compute and also avoids having to set properties for individual pages. Binding is accomplished using cloth constraints and to animate we use the the built in wind to blow pages over, as well as a volume axis field to "riffle" the pages so they catch in the wind.

NCloth in maya 8.5 does not support wind shadowing, so care must be taken not to blow the entire book into the air. Without wind shadowing the wind will blow on each page as if it is not inside the book, thus any gust strong enough to lift a page will also lift the entire book. (this initially took me by surprise!) The wind doesn't need to be this strong in order to simply flip pages, however I still glued part of the back page to the table using a transform constraint in order to keep the book from sliding across the table.

The following tutorial will create a 50 page hard cover bound book.
A. Pages
1. MENU: "Create: Polygon Primitives: Plane"

Width/Height = 1.0, 1.0
Divisions = 8, 8 (generally enough given that we do a smooth later on)

2. MENU "Edit: Duplicate Special"
Geometry type = Instance
Group under "New group"
translateY = 0.01
Number of copies = 50 (determines the number of pages)
image1.jpg
3. Select All planes. MENU "Mesh: Combine"

4. MENU "nCloth: Create nCloth"

nClothShape1 attribute settings:
selfCollisionFlag = "Full Surface" (required for good page collisions)
thickness = 0.005
selfCollideWidthScale = 1.0
mass = 0.5
friction = 0.8
tangentialDrag = 0.05
stretchResistance = 30
compressionResistance = 30
bendResistance = 3
damp = 0.1

nucleus1 attribute settings:
windSpeed = 0.01 (Note:in Maya8.5 this must be lowered when substeps are increased)
windDirectionX = -1
usePlane = ON
planeFriction = 2
subSteps = 20 (high substeps are required to handle the many stacked, colliding pages)
maxCollisionIterations = 30

When you playback now the paper should fall in a stack and be very slightly blown to the left.
If you set solver display to "Collision Thickness" then you should see the pages just in contact with each other.
image2.jpg
B. Binding
1. Select all the cvs along the spine of the book.
image3.jpg
2. MENU "nConstraint: Component to Component"
dynamicConstraintShape1 attribute settings:
connectionMethod = "Within Max Distance"
maxDistance = 0.05
image4.jpg
The pages are now connected along the spine, however they are free to fully rotate about this connection, like with a ring binder. The next step will make it more like a stiff glue binding.

3. Select all the cvs adjacent to the spine and create another component to component constraint.
dynamicConstraintShape2 attribute settings:
connectionMethod = "Within Max Distance"
maxDistance = 0.05
strength = 0.01 (This controls how stiff the binding is)
tangentStrength = 0
image5.jpg
C. Hardcover
Adding a hardcover is not too difficult. We can model the entire cover as a single piece, modelling with more triangles where we need it to be more flexible. If desired one could also paint lower stiffness values along the joint region. The edges along the spine are then bound to the book in the same fashion as with a real book.

1. MENU "Create: Cv Curve Tool"

In the front view create a single curve in the shape of the binding. Use fewer cvs where you wish it to be stiff and more where it should bend.
image6.jpg
2. Duplicate the curve (cntrl+d) then position the curves at the the top and bottom of the book.
image7.jpg
3. Select both curves the do MENU "Surfaces: Loft"
loft options
Degree = linear
Section Spans = 1
Output Geometry = polygons (nCloth requires polys)
Tessellation Method = Control points
image8.jpg
4. MENU "nCloth: Create nCloth"
One needs relatively stiff settings for the cover and as well should adjust for the desired thickness. Set Solver Display to collision thickness to preview.
nClothShape2 attribute settings:
Friction = 2
Mass = 4
Thickness = 0.01
StretchResistance = 100
CompressionResistance = 100
BendResistance = 20
selfCollisionFlag = "Full Surface" ( or one could even turn off self collision for the cover )

5. Lift the book out of collision with the ground.
A this point we can move the book up a bit so that it just touches the ground(when thickness is included). Select the paper mesh and the cover mesh but nothing else and translate up. Enabling thickness display on the cover will help to see how far to
image9.jpg
D. Bind the cover to the book
1. In the front view select cvs on the spine and cover to "glue" together.
image10.jpg
2. MENU: "nConstraint: Component to Component"
image11.jpg
3. Lock the book back cover to keep from sliding
Select some cvs on the bottom cover and create a transform constraint.
image12.jpg
E. Animate the book cover opening
We can do this using a weak constraint so the cover is still relatively free to move. The cover opens as a rotation, so we will rotate the constraint, rather than pull it in a line.
1. Select the two cvs on the end of the front cover.

2. MENU "nConstraint: Transform"

constraint settings:
strength = 0.2

3. Translate the constraint in X so it is at the "hinge" point for the cover.
image13.jpg
4. Keyframe the rotateZ of the constraint
frame 1 = 0
frame 30 = 200
Note that if you rightmouse on the timeslider it will go to the frame without advancing, which makes it easier to set a key when you have a slow dynamic entity.
image14.jpg
The book should now open when you playback, although the simulation will be slow enough that you will need to cache in order to preview the animation. At this point it may help to assign suitable shaders to the pages and cover. A local point light or texture may also make it easier to see individual pages than with directional lights.






F. Blow the pages over
A volume axis field will be used to lift the pages to catch the wind.
1. Select the book pages.

2. MENU "Fields: Volume Axis"

volumeAxisField settings:
magnitude = 2
awayFromCenter = 0
alongAxis = 10
turbulence = 0.8 (optional)
image15.jpg
3. Animate the position of the volume axis field to gradually lower down onto the open edge of the book.
As the field overlaps a page the edge of the page is lifted up such that it catches the wind and flips over. One can keyframe the Y position of the field such that it reaches the bottom of the book by around frame 190 or so.
image16.jpg
G. Cache the simulation
Select both the paper and cover objects and do MENU: "nCache: Create New Cache"
This will let you scrub the animation and better preview the rest of the tutorial, which deals with rendering aspects.






H. Smooth and thicken the pages and cover for rendering.

While it is obvious that the book cover should have thickness for rendering, it is also important that the pages have thickness. The highlights along edges are important and the book will not have the proper shading when closed unless the pages have thickness. Note also that the thinness of the pages makes rendering more difficult, and one in general needs higher sampling tolerances, including motion blur. One artifact visible in the avi here is that shadow map depth bias was too large, causing a noticable artifact where pages just separate enough to be over this threshold. Raytraced shadows may work better. As well one may be better off rendering using Mental Ray.

First lets smooth the paper.

1. Select all the faces on the paper cloth mesh except for the corner edges.
(In the topview drag over all faces then shift drag over the corner faces)
We do this so that smooth does not round the corners.
image17.jpg
2. MENU "Mesh: Smooth"
Keep Geometry Borders = OFF
Smooth UVs = OFF

Now we can give it some thickness.

3. MENU "Edit Mesh: Extrude"
Set the polyExtrudeFace attributes:
Divisions = 1
LocalTranslateZ = 0.004 (this is the thickness for our paper)
Keep Faces Together = ON
image18.jpg
4. Thicken the cover in the same fashion as the paper.
I'm not sure quite why but extruding directly off of the output nCloth mesh will not update correctly. The normal is not updated from the start position. If one does a smooth first then the resulting history seems to update things correctly. However we don't need to smooth the cover, so instead of a smooth we could do "Normals: Soften Edge" followed by the extrude. The added polySoftEdge will makes the extrude direction update correctly as the cloth animates. If one wishes to thicken the surface about the center one can first do a transform component before the extrude. See the tutorial Rendering Thick Cloth for more info.


Here is the final file with some added texturing and shading:
In order to post any comments, you must be logged in!
  Posted by reier  on  08/14  at  12:20 PM

Hi Duncan,
I tried your technique on a book I created in 2008. It needs to be at a large scale and that may be the cause of some inconsistent results with the nCloth. Every time I open the scene it simulates fine, but when I rewind and playback again the volume axis doesn’t take effect when it should. Sometimes it simply has no effect, other times its delayed by 100 frames or so.

Any ideas?
Thanks!
-James

Just found the solution in another forum (posted by Duncan). Looks like the nCloth node must be visible in the viewport in order for nCloth to simulate properly. In my case I had “nCloths” turned off under the Show menu.

  Posted by Dreamie  on  05/21  at  01:57 AM

Thanks a lot!
I’m trying to do the same only with about 10 pages. I have only one problem tho, somehow the dynamic constrains remains in place when I move the geometry unlike your example. And I did follow it step by step. Could it be a maya 8.5 issue?

saheee74:
I doubt you can get the same result with morphing. Even if you do, it’d be a tedious setup and manual animation compared to a simple setup like this..

*edit* I resolved my issue, I had to delete all my prefs files and let maya create the default ones, re-create the ncloth with the constrains. Now it’s all working fine.

  Posted by kit devine  on  10/09  at  04:21 AM

Hi Duncan

Would it be possible to add in wind shadowing by placing a light where the wind is and using the resulting shadow map as a wind shadow map? not physically correct but possibly a good way of fudging it perhaps?

ciao
kit

  Posted by patrickkrebs  on  08/24  at  07:30 AM

When I try to texture the book the UVs change every frame how do I fix this.

  Posted by anjaneyulu  on  08/15  at  08:22 PM

hello sir
u r legend in animation

 
Page 1 of 2 pages  1 2 >