Image

In every video game series, each new version comes out bigger and better than the last. In “Killzone 2" Guerrilla Games added more realistic in-game effects by using Houdini for fracturing, cloth simulation and terrain generation. In Killzone 3, they have again upped their game, creating more realistic environments which are both larger and more extreme.

Guerrilla Games once again turned to Houdini to generate powerful and highly realistic ocean waves that collide with floating icebergs, abandoned oil rigs and the icy shoreline. Their team approached the project step by step which in the end broke down into several stages - prototyping, realtime / pre-animated, pre-animated Houdini ocean, secondary effects and scope. Upon completion, they had built a great wave generation tool that will continue to be used in future projects.

PROTOTYPING PHASE

The process began with the prototyping of ocean waves aimed to be used in a vertex shader to deform meshes in real-time within the game engine. Their work was inspired by “Simulating Ocean Water” by Jerry Tessendorf and Josef Gerstner. This research on trochoidal waves provided them with important technical approaches to creating realistic waves.

A VEX-based volume operator was created to represent a single wavelength in order to determine just how many wavelengths would be needed to achieve the desired results. They chose to create a surface operator using VEX code in order to make it easier for their Tech Code department to replicate their prototype in the game engine.

To limit the amount of waves needed to get a convincing ocean, they added some additional sine and cosine functions to their single Gerstner wave surface operator in order to break up the pattern and achieve a high degree of realism.

REALTIME/PRE-ANIMATED PHASE

Once the team moved past the prototyping of the ocean waves they began to think about the secondary effects such as bouncing waves, water splashes and foam.

There were concerns that these effects would impose too many real-time calculations on the game engine and that the Tech Code team would not want to waste resources on these kinds of details. Realizing the importance of the secondary effects, the team cleverly developed a new efficient type of geometry object for the game engine that could playback pre-animated vertex deformations including animated vertex colors, normals and UV's.

This adjustment worked and also gave the effects artists a new game engine feature to explore and exploit beyond the ocean work. It also gave the Guerrilla’s Tech Code team the opportunity focus exclusively on optimizing the memory usage, performance and stability of the game rather than replicating all of the artistic decisions going into the effect.

PRE-ANIMATED HOUDINI OCEAN

The artists at Guerrilla Games were happy to discover that Houdini excels with the deformation feature. VEX-based surface operators are very much like a vertex shader as they provide a lot of freedom especially when used in combination with other surface operators and this is where they discovered that their Houdini artists could really add value to the game.

“Animated vertex colors is a territory where Houdini is exclusive as we find ourselves creating static vertex colors as soon as it can't be painted” comments Ben Schrijvers, Senior Visual Effects Artist at Guerrilla Games.

Image

From that point on they no longer had to worry about real-time performance for the oceans. They continued to incorporate wave bounce interaction with the coastline environments and rayed each point to the nearest coastline surface in order to calculate the distance. The distance value was then used as an input for another Gerstner wave. In a real-time setup, they could have stored the distance value in one of the vertex color channels and apply the Gerstner wave in real-time; however the vertex color channels are limited and they wanted to use them for controlling the shader.

To get the minimum amount of polygons for the required resolution, grid spaced geometry was not used. Instead a Scatter node was used to scatter points with the density based on the distance to where the player could walk. Then the Triangulate 2D node was used to connect the points into triangular polygons. The limit for the ocean in the game engine was around 20.000 to 30.000 polygons, so most oceans in the game are around that poly-count.

For generating vertex colors, Houdini also provided the team with more options when compared to a real-time solution. Their Gerstner wave vex operator already provided them with color values which were useful to help find the back and the front of the wave. With this, they could use surface operators to calculate curvature and find the sharp wave-tips.

“We used a feedback loop setup to process the vertex colors by writing geo files to disk and reading them in the next frame,” says Ben. “This iterative process added new foam at wave-tips and decreased the overall foam value every frame to give us wave-tips that left a trail of foam behind them that dissipated after a few meters.”

EVEN MORE SECONDARY EFFECTS

“Once we had the ocean running in the game engine, we still felt that there was something missing that was necessary to integrate it with the rest of the environment,” says Ben. “Since we knew exactly where each ocean wave was at any given time, we could spawn a particle effect for when a wave hit the shore”

In order to do this, the ocean needed to be synced up with a sequence which represented a timeline of events. The sequence supports events ranging from the triggering of character animations, particle effects, full screen color corrections or rumbling the PlayStation® controller.

For the splashes created by waves crashing against the shore, it could have been necessary to manually create hundreds of particle events at specific positions and specific frames matching up with the ocean waves and the shoreline. To simplify this task, the team wrote an exporter for Houdini that created a sequence file directly from Houdini. Houdini’s geometry as well as ocean deformations were passed through Maya as they were being exported to the game file format.

Image

“Finding the right amount of events to stay within the performance limit was relatively easy in Houdini as we could work with higher level controls like density and interval time,” Ben explains. “Through Houdini, we ended up building a very flexible system that would be useful for more than just ocean wave splashes. It can create an event on a particular frame for every point that exists in Houdini on that frame. The event uses the point position as its location and custom attributes are used for orientation, the file link to the actual particle effect and other attributes of the particle event”.

The team had previously developed a system used to export dynamic operator and rigid body simulations into Maya which then further exports into a sequence. Although the system was originally made for collapsing buildings, it was re-purposed to create ice pieces floating on the water for Killzone 3.

They proceeded by creating a setup where the deforming ocean mesh would move individual quad polygons around. Each quad would correspond to a floating piece of ice while being used as an input for a custom dynamic operator that created a spring constraint for each point and then connected them to their corresponding ice piece.

Because the spring constraints where not rigid and the simulation was using the mass of each piece, the team created very fluid looking physics animations. As these animations had to be looping, they setup the simulation to run in three cycles, taking the cycle in the middle. Using this method saved them from having to blend the start of the animation with the end.

SCOPE

The combined size of the four separate ocean geometries covers a whopping area of five square kilometres. Add those together with six oceans for various cut scenes and multiplayer levels meant the number of individual oceans seen in the game was ten.

Once their ocean tool was in place it took less than a day to create a new ocean from scratch which worked well within the confines of a very tight schedule.

The deformation system was also put to good use elsewhere in the game. Killzone 2, introduced an exotic type of fuel called Petrusite that has an electrically charged force field surrounding it. For Killzone 3 the appearance of the fuel was upgraded using Houdini.

“Although it was a natural effect, our Art Director wanted to give the fuel an almost predatory character by making it search the environment,” says Ben.

The artists animated a few curves using noise and made them snap to the environment if they came close to it. The wire solver was then used to add a natural fluid movement. The curves where turned into strips of polygons and the vertex colors were animated using of the velocity of each point on the curve. If the curve was snapping to the environment, it would alter its color as well. The vertex UVs were also animated to compensate for any stretching caused by the simulation.

“We will definitely find more uses for this deformation system and in the future we plan to expand its possibilities in the engine,” comments Ben. “We even continued working with it after the game was finished. As a proof of concept ,we already tried to use the system to create a big smoke cloud. This one can be found in the Retro Pack DLC that can be downloaded from the PlayStation Network ©”.


 
  Learn More Learn More
  Tutorials Gallery Demo Reels Companion Products