Our Properties: Gamasutra GameCareerGuide IndieGames Indie Royale GDC IGF Game Developer Magazine GAO
My Message close
Contents
The Secrets Of Cloth Simulation In Alan Wake
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
February 9, 2012
 
Analyst questions validity of unusual January NPD results [1]
 
DICE 2012: Blizzard's Pearce on World Of Warcraft's launch hangover
 
DICE 2012: Insomniac's Price on Quality Of Life, ditching the 'Loser' badge
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
February 9, 2012
 
Airtight Games
Art Director
 
Telltale Games
Core Technology - Senior Systems Engineer
 
High 5 Games
Technical Artist
 
XEOPlay Inc
Game Developer (Mobile)
 
Kabam
Lead Software Engineer - Flash
 
Kabam
Lead Software Engineer-Ruby
spacer
Latest Features
spacer View All spacer
 
February 9, 2012
 
arrow Principles of an Indie Game Bottom Feeder [14]
 
arrow Postmortem: CyberConnect 2's Solatorobo: Red the Hunter [1]
 
arrow Jerked Around by the Magic Circle - Clearing the Air Ten Years Later [37]
 
arrow Building the World of Reckoning [4]
 
arrow SPONSORED FEATURE: TwitchTV - How to Build Community Around Your Game in 2012 [13]
 
arrow Happy Action, Happy Developer: Tim Schafer on Reimagining Double Fine [9]
 
arrow Building an iOS Hit: Phase 1 [11]
 
arrow Postmortem: Appy Entertainment's SpellCraft School of Magic [5]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
February 9, 2012
 
What the current RPG can learn from Diablo 1
 
Double Fine's Kickstarter Windfall: Will Patronage Supplant Traditional Game Publishing? [5]
 
The Principles of Game Monetization
 
Did DoubleFine Just break the publishing model for good? [7]
 
The Devil Is in the Details of Action RPGs - Part One: The Logistics of Loot [4]
spacer
About
spacer Editor-In-Chief/News Director:
Kris Graft
Features Director:
Christian Nutt
Senior Contributing Editor:
Brandon Sheffield
News Editors:
Frank Cifaldi, Tom Curtis, Mike Rose, Eric Caoili, Kris Graft
Editors-At-Large:
Leigh Alexander, Chris Morris
Advertising:
Jennifer Sulik
Recruitment:
Gina Gross
 
Feature Submissions
 
Comment Guidelines
Sponsor
Features
  The Secrets Of Cloth Simulation In Alan Wake
by Henrik Enqvist [Programming, Visual Art]
11 comments Share on Twitter Share on Facebook RSS
 
 
April 29, 2010 Article Start Page 1 of 4 Next
 

[Remedy animation programmer Henrik Enqvist takes a look at how the team created a believable tweed cloth simulation on the title character's jacket in the Microsoft-published Xbox 360 exclusive horror-thriller Alan Wake.]

The main character in our action thriller is Alan Wake, a writer who gets trapped in a nightmarish scenario where he is forced to fight dark forces while trying to solve the mystery of his missing wife. He is not a well-trained action hero, but rather an everyday guy.


To establish his character our art director wanted him to wear an old tweed jacket with arm patches. As the game takes place in a real-world setting, the tools for giving characters personality are limited, compared to a fantasy game or a space shooter. Therefore the clothes that our characters wear become far more important.

Alan Wake's jacket had to be as believable as possible to maintain the illusion of a thriller atmosphere to the player. The jacket needs to move in the wind and add a nice secondary motion to the character as he rushes through the forest. As a programmer, you immediately start to think about a cloth simulation.

A lot of games before us had already shipped with cloth simulation, but often those methods gave the impression of either silk or rubber -- something that we didn't want. Just recently, some very good third party solutions for cloth simulation have shipped, but at the point when we needed to have a stable solution such tools didn't exist, or didn't serve our needs.

This article will take a look at the challenges we encountered and present the solutions for rolling our own cloth simulation. Even if you are familiar with the methods described here, the way we put things together should make for some interesting reading.

The Jacket Rig

The jacket was modeled together with the rest of the character as a regular skinned mesh. The bones driving the jacket mesh are a separate layer on top of the normal skeleton. The sleeves of the jacket use the normal upper and lower arm setup. Both upper and lower arms are split into one main bone and one twist bone. The upper jacket is driven by look-at constraints and a Verlet simulation drives the lower jacket.


Figure 1. The jacket rig on top of the regular game skeleton.

The Upper Jacket

The jacket bones are parented top-down so that when the upper bones move the lower bones will follow. We were tempted to parent the lower bones straight to the thorax, but that would have caused us to lose motion -- especially the vertical motion in the jacket when the character raises his shoulders.

In the upper jacket, we mimic the motion of real shoulder pads by driving the shoulder bones with look-at constraints towards spots on the upper arms. This way the shoulder pad will follow the upper arm and when the arm is raised the shoulder pad will lift the rest of the bones -- just as a real jacket.

The following bones in the chain are a layer between the upper jacket and the simulated lower jacket. These bones are driven by look-at constraints straight down so that they compensate for the rotation that the shoulders cause. We also added position constraints between the left and the right bone to compensate for the stretching that occurs when the shoulder pads move.


Figure 2. The bones move when character raises his arm.

It might have been a good enough solution to implement the constraints in the animation exporter and bake the results into the animation data, but we still opted for driving the bones in real-time inside the game engine.

This way we could save a few bytes in the animation data and we were also able to easily share animations between characters regardless whether they were wearing jackets or not. Also the shoulder movement generated by in-game IK (e.g. when aiming) became correctly applied when solving the constraints in real-time.

The Lower Jacket

After the upper jacket is solved we take a look at simulating the lower part of the jacket. Most cloth simulations in games have a one-to-one mapping between the vertices in a cloth simulation and the vertices in the rendered mesh.

In our case we wanted to preserve the fidelity of the jacket mesh and not have it held back by any coder-dictated constraints. For example, the silhouette of the pockets and the front part of the jacket would have been lost if we would have settled for a having the same mesh for simulation as for rendering.

Normal maps could have been utilized to give shape to the jacket but we felt that this wasn't enough. Instead we wanted our artists to freely shape the jacket anyway they wanted and then allow them to use the normal maps to add wrinkles or other detail instead of making up for lost geometry.

Our solution to this was to have a low-resolution cloth mesh used for simulating the jacket and then map that to the bones in the skeleton that was used for driving the skinned mesh.



Figure 3. The silhouette of our jacket vs. one that shares vertices with simulation.

 
Article Start Page 1 of 4 Next
 
Comments

raigan burns
profile image
Awesome article, thanks for sharing!

I'm a bit confused about the World Space vs. Local Space Motion section; it's not clear what exactly it means to "add a small world motion separately". If the particles are simulated locally, they'll only react to the animation of the bones relative to the root, and not to the movement of root through the world, but how is such world movement "added" to the particles? Do you just do e.g particle_velocity -= 0.3*root_velocity, so that if the body moves to the left the cloth moves locally to the right? If so, was there any difference between this and the inverse: simulate the particles in worldspace and "cancel out" the particles' movement relative to the root by doing e.g particle_velocity += 0.7*root_velocity?

Anyway, thanks for the interesting read :)

Bart Stewart
profile image
When I read the title of this feature, my first thought was that it was (finally!) another chapter in the saga of quirky developer Schadenfreude Interactive (http://www.gamasutra.com/search/?search_text=Schadenfreudian+Slips).

Although that proved not to be the case (perhaps SI have been acquired? ;), this was still good reading. It’s fun to see the occasional feature piece that really gets into the nuts and bolts of solving a game development problem.

But I do miss hearing about the travails of our friends at Schadenfreude....

Francois Levesque
profile image
This is the most useful article I've ever seen on gamasutra.

Brett Williams
profile image
Excellent article, great solution.

Noah Falstein
profile image
I'm just bemused by the fact that even 10 years ago - certainly 20 - the idea of an article about realistic simulation of a tweed jacket with elbow patches in a game would have seemed like either science fiction or a bad joke. Long Live Alan Wake! (Lord knows he'll need a lot of support to survive, not to mention a durable jacket!)

Henrik Enqvist
profile image
Yes Raigan, what we do is “particle_velocity -= 0.3*root_velocity“. Anyway, there shouldn’t be much difference if you simulate the cloth in World Space and cancel out the root motion. Performance will most likely be the same. The Local Space solution fitted us better because of the way our skeletons are handled by the game engine. Working in Local Space was more intuitive and easier to debug as well. Also, in Local Space you reduce the risk of getting floating point inaccuracies. Think about the case were the character is 10km away from the world origin. If you do a 10km x 10km multiplication then you will have values around 1.0E+8 in your calculations. There is a small risk of losing some millimeter accuracy here if working in World Space and not in Local Space. Anyway, we didn’t try the World Space version so I can’t say for sure.

Glad you like the article.

Andrew Heywood
profile image
> This is the most useful article I've ever seen on gamasutra.

5 years ago, almost every article was this useful*. You know, when the strapline for the site was "The Art and Science of Making Games".

*warning: subjective ;)

raigan burns
profile image
Awesome, thanks Henrik :)

Cecilia Deng
profile image
Thanks for posting, great read :)

ignace saenen
profile image
Thanks for sharing this! Great read!

Fabio Polimeni
profile image
Hi Henrik,
I found you article really interesting, but, I'm still wondering what did you do to remove ghost forces introduced by hard constraints, a part from increasing the number of solver iterations or a hard stretching factor. This issue is still annoying me :D

Thanks,
Fabio


none
 
Comment:
 




UBM Techweb
Game Network
Game Developers Conference | GDC Europe | GDC Online | GDC China | Gamasutra | Game Developer Magazine | Game Advertising Online
Game Career Guide | Independent Games Festival | Indie Royale | IndieGames

Other UBM TechWeb Networks
Business Technology | Business Technology Events | Telecommunications & Communications Providers

Privacy Policy | Terms of Service | Contact Us | Copyright © UBM TechWeb, All Rights Reserved.