Earlier this year at GDC, Epic Games showcased the new Unreal Engine 4 via a real-time demo video called ‘Infiltrator’. Part of UE4’s advanced tech is its improved effects tools using GPU particle sims, collisions and dynamic particle lights. fxguide spoke to Epic Games senior FX artist Tim Elek about UE4’s capabilities and how they were put to use in ‘Infiltrator’.
Above: watch the ‘Infiltrator’ demo.
fxg: Can you talk about some of the new features in UE4 that are specifically designed for effects work?
Tim Elek: UE4 has many new effects features which complement the Cascade workflow. Unreal Cascade is the Unreal Engine’s built-in visual effects editor. GPU particle simulation makes it possible to simulate millions of particles in a scene with minimal evaluation cost. UE4 still makes use of Cascade’s CPU simulations, which can be leveraged to control the behavior of GPU systems. These new GPU particles provide the backbone for several new features in UE4.
Vector field grids enable artists to create dynamic, organic movement within a GPU particle system. Vector fields can be manipulated within Cascade to add additional motion to any GPU simulation. Low fixed-cost mesh emission is now a single draw call per emitter, depending upon the material, instead of a draw call per mesh. In UE4 effects artists can emit large amounts of meshes into the scene at standard CPU simulation costs with no additional draw call overhead.
Currently enabled for GPU simulations, depth buffer collision is an efficient means of doing high-detail collision, with large amounts of particles at a low evaluation cost. The system makes use of depth buffer information, as well as surface normal information to simulate particle motion. Depth buffer particles also obey masked surface properties, so any grates, holes, or other surfaces created with masked gaps in them will allow sprites using depth collision to fall through those gaps. In UE4 effects with lit translucency accept lighting and shadow information. Lit effects can also cast shadows onto themselves and into the environment.
There are several new material expressions in UE4 that are custom to particle systems. These expressions give artists a more refined level of control over a sprite; for instance, you can sample the particle velocity, return a velocity value, and modify material parameters in real time based on the velocity of a sprite. You can also soften the overall look of a sprite based on the velocity at which the sprite is moving.
With deferred shading you can place dynamic particle lights into the world using Cascade. We use traditional Cascade modules to control the color, size, brightness over life and count of particle lights. With particle lights we can also bundle lighting effects directly into a particle system, so the effect can be visualized right inside the editor, in real time, without having to simulate or run the game.
Deferred decals are also a valuable tool in an artist’s arsenal. For example, deferred decals enable us to place water drips, droplets and puddles all over the interior of the underground section in Infiltrator.
Above: see Epic Games’ senior FX artist Tim Elek and senior technical writer Zak Parrish discuss effects with Unreal Engine 4 in this Inside Unreal video.
fxg: How do the particle lights in UE4 work?
Elek: Particle lights are very straightforward to implement. For each spawned particle a light will be spawned using the particle’s location, size and color module properties. The light inherits these properties, and has its own module that allows for more refined control over the light. This includes spawn rate, color, brightness, size and exponent controls. Particle lights also support inverse-square falloff for higher quality falloff. All of the properties, with the exception of falloff, can be modified with traditional Cascade workflows using curves over time, or vector, scalar values. So, it’s easy to shift the color of your light over time to modify intensity and saturation. The radius of a particle light can also be easily previewed in Cascade, and also in the editor viewports.
fxg: Where were they used in Infiltrator – any surprising places?
Elek: We used particle lights in a variety of cases. Scene integration time is quick because their lighting and behavior can be controlled through Cascade in one fell swoop. For instance, you can set the radius and color of a light over its lifetime in Cascade, and then place 10 of these actors in the world. Each time one of these actors is called, it will emit light in the same fashion. There’s no going into each individual actor and hand-animating those values, because Cascade does the heavy lifting all in one location. If you need a custom variant you can set an instance parameter and change the effect at the actor level, or quickly duplicate an effect. It’s easy to add another level of detail by setting time dilation at the actor level so that lights evaluate at varying rates.
For the vista shots in Infiltrator we attached particle lights to robot meshes emitted with Cascade. The robots were given base velocity and position settings, so as they move through the world they illuminate structures in the distance, and with the robot mesh attachment they look good enough for foreground and middle ground usage. The initial values are set with random ranges, so your eye never picks up repetition in the effect.
We also attached a particle light to helmet of each soldier. You might notice a subtle light on the mask of the Infiltrator, so when he lowers his mask the eyes light up the sockets of the goggles. There are also particle lights attached to tracers, muzzle flashes, impacts, foot step splashes, scanning effects, welding sparks and flares. We even use a particle light on the Infiltrator’s weapon to illuminate his hand as he activates the grenade launcher at the end of the sequence.
Above: Epic’s Tim Elek and Zak Parrish talk about implementing advanced VFX such as realistic water effects, lit translucency, GPU particle simulation and collision and more in the Unreal Engine 4 Infiltrator.
fxg: Can you talk about managing interactive lighting and sprites, say, with particles?
Elek: For anyone experienced with Cascade, or any sprite-based, real-time particle tool, adding lights to effects will be an intuitive process. Epic’s engineers work closely with us effects artists to ensure the tools and implementation are refined in a way that gives us as much control as possible.
The easiest way to think of a particle light is to think of it as a parent-child relationship. The light is inheriting transforms and other properties from the light as defined by the Cascade modules. There is one level of disconnection from the material and the light, which provides an even higher level of control. If desired I could easily emit purple sprites with yellow lights attached by modifying the color of a sprite through a material parameter, and then setting the color of the light to yellow in Cascade.
fxg: There’s a great shot of a drop of water in the Infiltrator demo. Can you discuss how it was achieved?
Elek: The water droplet is actually far less complex than it may seem at first glance. The rivulet of water forming and rolling around the pipe is a static mesh with a custom refraction material, which is animated in Matinee so that it rises from the seam in the pipe, and then rolls around the profile of the pipe.
The actual droplet breaking off is achieved using a morph target animation which I created in Maya. I referred to a series of slow motion photos to generate the profile, and hand animated the droplet in Maya, and then imported and controlled the animation playback in Matinee. The droplet which breaks off and falls is a separate mesh I reveal at the moment the morph target droplet animation snaps quickly upward.
Temporal antialiasing helps soften all of the edges of the mesh, and helps blend the transition as we animate the drop falling through the air. There are a few other detail meshes along the edges of the seam to help sell the droplet formation, and these meshes make use of a panning material to help sell the flow around the pipe. Lastly, decals of small droplets are layered in to help illustrate how wet the environment is.
fxg: Can you describe how the muzzle flashes were achieved using the Unreal Cascade particle editor for Infiltrator?
Elek: Muzzle flashes are a mix of meshes and sprite particles. We typically look at reference footage and then try and put a spin on it based on the goals of our project. For Infiltrator we wanted real world ballistics and recognizable automatic and semi-automatic gunfire. The muzzle flashes needed to stand out from the environment, so we added oversaturated blue or purple elements to contrast with the predominant orange and yellow in the palette.
Because mesh emission has a low fixed render cost we’re not afraid to emit them in large quantities. For instance all of the shell casings coming from all of the weapons in Infiltrator are meshes emitted into the world. For the ending sequence with the large robot we even use individual mesh position to emit a tendril of smoke coming from each expended shell as it falls into the world.
Particle lights and refraction round out the presentation, as the world around the weapon is affected with splashes of light and color onto the characters and environment. Refraction pushes pixels around to sell the concussive force of the muzzle flash.
fxg: How were things like ammo casing and shells tied to the muzzle flash?
Elek: For Infiltrator we bundled the shells into the muzzle flash so that it was easy to emit shell casings each time the weapon fired. For auto and semi-auto weapons where a muzzle flash is firing off at a constant rate we typically use a looping effect. For example, you pull the trigger and the effect starts playing; let go of the trigger and the effect stops playing. This makes it easier to control all aspects of emission in one location, rather than paying additional memory and evaluation costs for an additional emitter actor in the scene, and having to control two emitters instead of one.
fxg: How are impact effects managed with the GPU particle simulation and collision system?
Elek: There are several types of impact effects in the Infiltrator demo. Large impacts that show off lots of detail include flying dust, sparks, chunks of concrete, metal and rubble. There are also small and medium-scale impacts which typically are seen in the underground section of the facility. Many of these impacts make use of particle lights, depth buffer collision, particle collision as well as our event system.
For instance, in one of the impacts I emit a group of CPU sprites with a collision attribute. When these sprites collide with a surface, a collision event is passed to the system. When this event fires off, it tells another emitter in the same particle system to burst fire with thousands of small GPU sparks – each of which uses the depth buffer and surface normal to collide against the world – as well as a particle light, smoke and a large spark flare. This allows us to add a high level of detail and secondary motion to our effects. In addition, these are types of interaction which cannot be achieved with static emission properties alone.