28 March 2013

From: Tomb Raider Blog

Now that the game is out and about, we’re eager to show fans some of the impressive technology under Tomb Raider’s hood. A handful of Crystal Dynamics’ staffers are out at GDC this week, presenting on Tomb Raider’s system design, tools, camera, and more. I’ve culled down their presentations into a slightly more digestible format to give you some insider information into making the game!

Up to the plate is Jason Lacroix, our Senior Rendering Engineer/resident rock climber, speaking to how Tomb Raider takes advantage of DX11.

As you guys are likely aware, the PC edition of Tomb Raider was a collaborative effort spearheaded by Nixxes, a longtime partner with our studio first established in 1999. Nixxes spent a good deal of time optimizing the PC edition of Tomb Raider, particularly when it came to tessellation technology, but the most interesting optimization was the hair simulation and rendering in TressFX.



The team knew that when it came to the DX11 version of the game, they wanted to do something that would stand out. Both Nixxes and Crystal wanted to make Lara’s hair as realistic as possible, and took this opportunity to see how far they could push it. As fans often note, Lara’s hair is a massive part of her identity, and an upgraded hairstyle became a way to embellish and add life to her character.

Prior to TressFX, many great contributions to the world of hair rendering had already been made, such as ATI (now AMD)’s work on Ruby Hair in 2004, Alice’s hair in Madness Returns, as well as Square Enix’s impressive tech in Agni’s Philosophy.

So what makes great hair? According to Jason it is a multi-tiered approach. First, starting with a great asset is important, then running it though a great simulation to sell the illusion, in addition to anisotropic lighting to give it a realistic highlight pattern. Also, anti-aliasing to avoid jaggies, and self-shadowing to sell the illusion of multiple layers of hair. Last, there is translucency.
Anti-Aliasing: A technique to get rid of hard-edged pixels.

Jaggies: A nickname for aliasing. Jaggies are bad.
Our goals aligned with those of our partner AMD, who had a demo in place which provided a great foundation for our efforts. In our first pass most of the AMD source code was copied into our engine. From there the team iterated through various stages of simulation and rendering, evolving the code until we got the desired results. Ultimately, the final code doesn’t stray too far from the original implementation, other than the shading and shadowing, which was done from scratch on our end.

4737
When it came to implementation, we were lucky enough to be able to take advantage of work already done by VisualWorks, the internal movie team at Square Enix who rendered our Turning Point trailer, among many other impressive accomplishments. They already had hair assets for us to use. All that had to be added was additional hair to the asset to achieve the proper amount of coverage. The VW content had 4,737 hairs used to drive rendering. You can see from the image above that this didn’t provide quite enough density.

Our modified hair asset has 7,014 strands of hair, providing enough coverage. Hair strands were also duplicated with a small amount of offset to add more coverage. Meaning, the final count after duplication was 21,042 hair strands, each made up of 16 vertices.
Vertices: In-game geometry is made up of vertices  Each represents a point in 3D space. 
Maya allowed for further customization of said hair, per unique strand. We were able to decide if the tip was movable (such as at the end of a ponytail or bangs) and even the thickness of individual strands.

7014
Lara’s hair had to be sorted into four different groups to export properly: the bangs, the cap, the fringe by the shoulders, and the ponytail. Each group goes though the full rendering process of simulation, shadow map rendering, shading, and anti-aliasing.

In regards to simulation, we had to determine what Lara’s hair looked like when running. Jumping. Rolling. What about in the wind? The team found early inspiration from Australian hurdler Michelle Jenneke, who showed us how hair moves under all of the aforementioned condition. Thanks to the nature of sports videos, the team had multiple angles, close ups, and side views of her hair’s natural movement. We also recorded some hair from the ladies at the studio.

Global and local shape constraints helped to keep the hair manageable – it was our very own version of gel or mousse. The global constraints helped to preserve the hair style and initial shape, so that it would reset to the initial position after strong agitation. The local constraints were used to manage the bending and twisting forces that affect hair. Capsules on Lara would aid with collision detection with the hair as well.

Capsules: Capsules were used for collision detection with Lara’s hair to keep it from intersecting with her body.
Simulation was unique to each of the four groups of Lara’s hair. Each determined the parameters and controlled how the hair reacted in differing states, such as wet versus dry hair. A total of seven simulation profiles were used in this capacity, including those to tell if Lara was upside down (such as in a snare trap) or “mid wet” – meaning her ponytail and fringe were under water, but not bangs and cap.

Lighting Lara’s hair proved to be a challenge more than once, as this is a Tomb Raider game and we’ve got lots of locations where you are in dark, dank underground caves. This led the hair to go to a really matte black color and lose its dimensionality. In order to prevent this, the team created a virtual beauty directional light that comes in towards Lara’s head from 200 centimeters above the camera in such spaces. In doing this, the results are subtle, but the detail is important to keeping her hair realistic looking.

In regards to shadows, standard shadow sampling made also had the hair looking flat, and a system had to be implemented to address it. An approximated deep shadow lookup would calculate the shadows based on the depth of the current hair strand being shaded. The further down the hair, the more shadows, meaning, the top hair have very little and look much more realistic.

As you can see, upgrading Lara’s hair wasn’t a quick fix, but one well worth it. Hope you’ve enjoyed this in-depth look at TressFX!
Categories:

2 comments:

  1. A VERY interesting look into the amount of effort which went into TressFX. I don't run the game without it.

    At 1920x1080 on a 3-D TV the result is just stunning, even with framerate hit, which is marginal compared to the 3-D rate drop.

    ReplyDelete
  2. A very interesting look at the amount of effort which went into creating TressFX. I don't run the game without it now.

    At 1920 x 1080 on a 3-D TV, the effect is a delight, even with the framerate hit from TressFX. Anyway, the drop in framerate is only a fraction of the drop for changing from 2-D to 3-D.

    ReplyDelete