Friday, August 16, 2013

VFX of The Last of Us: Lakeside

SPOILERS 
This post will reveal game footage and details that will spoil the game if you haven't played it.

Winter
The winter section of the game we referred to as "Lakeside". The level posed some familiar challenges for snow based effects and some new ones. This snow had to feel hold and packed with fresh snow coming in and we also needed to reflect some changing weather patters as the level progressed. We wanted to reflect some old snow with the sun peeking through the clouds and hitting the surface. Giving off some warmth. Moving into an on coming storm and in the end a full fledged blizzard with low visibility. I spent a great deal of time on just the footprints which I detailed in a previous post so I won't elaborate on that here. Check out the video below to see some of the effects in action


Warm Calm
In the beginning of the level I wanted to convey a lot of random wind patterns as the wind moves throughout the trees and wooded area. I created some random gusts of loose snow clouds that get kicked up and flurries that blow out from small bushes. This helped to create a sense of movement while not being too heavy handed. I also created some loose snow effect that fall from branches as you move through the forest. One of the biggest issues for this area was due to the fact that once you shot the deer it would leave blood trails so you could track it. Each blood drop was ticking away at our particle memory in a significant way and at times players could use up all of the memory and the blood would stop spawning. There was no fancy trick for fixing this issue I simply had to scale back the number of effects being spawned and make the blood less frequent and larger. You might be asking yourself "Why is that deer bleeding so much?", well that's why.


Storm Chasing
For the white out blizzard I had some fun with implementation here. The biggest issue was that we needed reduced visibility and using particle for this is always a bad idea because of overdraw issues. Rather than placing a bazillion emitters and only placed a few in key places and instead attached an emitter to the player camera with the emitter oriented in world space. The emitter will update it's position with the camera but will not rotate with it. I setup a state script (ref to our internal scripting engine) that would control the whole camera parented effect. The reason for ding this was because you obviously don't want the emitter on while you are indoors. So I setup regions for the interiors and when the player walks into them I send events to the script and the script lerps values on the effect up and down respectively. this utilized some new tech we got from our dedicated effect programmer Marshall Robin. He exposed to us root data on our particle systems and in script we can set those values as long as we retain a handle to the effect in our script. Pretty cool. The issue was still that some of the larger gusts of cloud particles would still draw indoors. The solution for this wasn't perfect but worked well enough. For the shader I utilized a buffer we use for occluding rain so that rain doesn't draw indoors and under hanging objects that write to that buffer. I modulated the world space position of each pixel by this buffer which is also in world space and this prevented those pixel from drawing inside. It created a harsh edge so I had to do 4 taps to make a super super super cheap blur. Calling it a bur is almost offensive to blurring pixels because my samples are so low but the shader was getting too expensive so I tried to offset this restriction by adding some distortion to the edge as well. Again, it's not perfect but works well enough.

The Roof Is On Fire
This was another area where I employed some heavy scripting for the effects. Once David comes in and knocks over the candles this resulted in a small fire spreading. In script I set this up in stages that way the fire wouldn't progress to the next stage until the player had stabbed David once and so on. I juggled the particle effects, spawning sounds, lights, material blending, and animated curtains as they burned as well. On top of this I also kept track of where the player stabbed David. On easy you can throw a brick at David and while he is stunned stab in from the front. I spawned blood effects on his clothes based on where he was stabbed so if for some reason you turned off the PS3 while in the middle of the fight and picked it up in the second stage he would still have blood where you last stabbed him. I don't think anyone will notice that. All sorts of fun keeping track of these variables and every time you think you have accounted for all of them you've undone something else. Honestly thought I really enjoy this aspect of things. I'm not sure why but it just feels that much more gratifying when you solve it but equally as stressful when you're getting close to ship and people are still finding bugs in your code.






Conclusion
So this level was a roller coaster down to the wire. This camera parented emitter thing, while saving me time in propagation, cost some some nights while I scripted its behavior. This level also taught me to let go. To not attach myself to certain aspects of what I'm trying to achieve at the cost of shipping something half finished or buggy. I also learned not to try to script one thing that could control a lot of things. Smaller script for specific goals is easier to manage and easier for others to parse when you need help.