rendering techniques in gears of war 2

113
Rendering Techniques in Gears of War 2 Niklas Smedberg Senior Engine Programmer Epic Games, Inc. Daniel Wright Engine Programmer Engine Programmer Epic Games, Inc.

Upload: others

Post on 23-Dec-2021

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Rendering Techniques in Gears of War 2

Rendering Techniques in Gears of War 2

Niklas SmedbergSenior Engine Programmerg gEpic Games, Inc.

Daniel WrightEngine ProgrammerEngine ProgrammerEpic Games, Inc.

Page 2: Rendering Techniques in Gears of War 2

About Epic GamesAbout Epic GamesAbout Epic GamesAbout Epic Games•• 19th year of business19th year of business•• 110 employees in NC and still hiring110 employees in NC and still hiring•• Creators of Unreal Engine 3Creators of Unreal Engine 3Creators of Unreal Engine 3Creators of Unreal Engine 3•• Shipped Gears of War 2Shipped Gears of War 2Shi d U l T t 3Shi d U l T t 3•• Shipped Unreal Tournament 3Shipped Unreal Tournament 3–– Xbox 360, PC and PS3Xbox 360, PC and PS3

•• External studios in Poland, Shanghai, and UtahExternal studios in Poland, Shanghai, and Utah

Page 3: Rendering Techniques in Gears of War 2

About Gears of War 2About Gears of War 2

• 93% Metacritic rating93% Metacritic rating• Over 4 million copies sold

d i d• 117 award wins and nominations

• Shipped in two years by Gears 1 team

Page 4: Rendering Techniques in Gears of War 2

About Niklas SmedbergAbout Niklas Smedberg

• A k a “Smedis”A.k.a.  Smedis• C64 Swedish demo scene

99• Went pro 1997• Moved to the US in 2001• Shipped titles for PS1, PC, Xbox, Xbox 360, PS3• Joined Epic Games 2005Joined Epic Games 2005

Page 5: Rendering Techniques in Gears of War 2

TopicspNiklas Smedberg

• Gore techniquesq• Blood techniques• Character lighting• Screen Space Ambient Occlusion optimizations

Page 6: Rendering Techniques in Gears of War 2

THE FOLLOWING THE FOLLOWING PRESENTATIONPRESENTATION HAS HAS NOTNOT BEEN RATED FORBEEN RATED FOR

ALL AUDIENCESALL AUDIENCES

VIEWER DISCRETION IS ADVISEDVIEWER DISCRETION IS ADVISED

Page 7: Rendering Techniques in Gears of War 2
Page 8: Rendering Techniques in Gears of War 2

Gore GoalsGore Goals• Goals:

– No seams between breakable pieces(Gears of War 1 used rigid 1-bone skinning)

– Dismember skinned meshes (e g ragdolls)Dismember skinned meshes (e.g. ragdolls)– Hand-modeled internals– Minimal impact on undamaged meshes

Page 9: Rendering Techniques in Gears of War 2

Gore MeshGore Mesh• Artists make two versions of the skinned mesh• Undamaged mesh with no overhead• Gore mesh with additional information:

– Completely independent of the undamaged mesh– Full freedom to hand-model cuts and guts

Can use different/additional textures and shaders– Can use different/additional textures and shaders– Pre-cut with all gore pieces separated

Page 10: Rendering Techniques in Gears of War 2

Locust gore meshLocust gore mesh• Picture: Locust gore meshg

Page 11: Rendering Techniques in Gears of War 2

Gore MeshGore Mesh• Skeleton with breakable joint constraintsj

– Broken by script code - not using physics engine (as in Gears 1)– More control of when/how to break the constraints

• Info per gore piece:• Info per gore piece:– Hit points– Type of special effect– Dependency of other gore pieces– Etc

• An extra set of bone weights for all vertices:An extra set of bone weights for all vertices:– Hand-made 4-bone weights– Weighted to properly separate all gore pieces along the cuts

Page 12: Rendering Techniques in Gears of War 2

Elaborate gore meshElaborate gore mesh• Picture: Uber reaver gore mesh

Page 13: Rendering Techniques in Gears of War 2

Tearing off a limbTearing off a limb• Switch to the gore meshg• Determine which constraint to break• Get the pair of broken bones

C t t t b ff f t i ht• Create a separate vertexbuffer for vertex weights– Unique per gore mesh instance– Replaces all weights in the original vertexbuffer– Used as a separate vertex stream

• For each vertex:– If influenced by a broken bone, copy 2nd set of weightsy , py g– Otherwise, copy 1st set of weights

• Add physics impulse to the torn-off limb– Let physics move the limb away– Let physics move the limb away

Page 14: Rendering Techniques in Gears of War 2

Data-driven GoreData driven Gore• Set up in the Unreal Editorp• Only used for really big enemies (e.g. Brumak)• Used as visual “damage states”

– Not necessarily to break off whole limbs

• Gore pieces stacked on top of each otherBreak “armor pieces” damage flesh etc– Break armor pieces , damage flesh, etc.

• Hit-points, impact radius, dependency links (leaf first), etc

Page 15: Rendering Techniques in Gears of War 2

Data-driven Gore, 1 of 3ata d e Go e, o 3

Page 16: Rendering Techniques in Gears of War 2

Data-driven Gore, 2 of 3ata d e Go e, o 3

Page 17: Rendering Techniques in Gears of War 2

Data-driven Gore, 3 of 3ata d e Go e, 3 o 3

Page 18: Rendering Techniques in Gears of War 2

Scripted GoreScripted Gore• Set up in gameplay code (Unreal Script)p g p y ( p )• Only dismember dead people

– No animation/gameplay consequences

• Different damage types break constraints differently– Complete obliteration (e.g. grenade-tag)– Partial obliteration (e.g. shotguns)Partial obliteration (e.g. shotguns)

• Headshots spawn additional effects (gibs)– Hand-made gib meshes can be specified per Pawn

• Chainsaw breaks specific constraints• Ragdolls break constraints based on hit location

Page 19: Rendering Techniques in Gears of War 2

Next Example: MeatshieldNext Example: Meatshield• Meatshields break constraints in a pre-determined sequencep q

– Based on overall “health” for the entire meatshield– Used as gory visual indicator instead of a boring “health bar”

Page 20: Rendering Techniques in Gears of War 2

Data-driven gore #1Data driven gore #1• Screenshot: Meatshield 1

Page 21: Rendering Techniques in Gears of War 2

Data-driven gore #2Data driven gore #2• Screenshot: Meatshield 2

Page 22: Rendering Techniques in Gears of War 2

Data‐driven gore #3Data driven gore #3• Screenshot: Meatshield 3

Page 23: Rendering Techniques in Gears of War 2

Data-driven gore #4Data driven gore #4• Screenshot: Meatshield 4

Page 24: Rendering Techniques in Gears of War 2

Data-driven gore #5Data driven gore #5• Screenshot: Meatshield 5

Page 25: Rendering Techniques in Gears of War 2

Data-driven gore #6Data driven gore #6• Screenshot: Meatshield 6

Page 26: Rendering Techniques in Gears of War 2

Data-driven gore #7Data driven gore #7• Screenshot: Meatshield 7

Page 27: Rendering Techniques in Gears of War 2

Next Example: ChainsawNext Example: Chainsaw• Chainsaw kill:

– Gameplay code choosing a specific constraint to break

Page 28: Rendering Techniques in Gears of War 2

Scripted goreScripted gore• Movie: Chainsaw

Page 29: Rendering Techniques in Gears of War 2

TopicspNiklas Smedberg

• Gore techniquesq• Blood techniques• Character lighting• Screen Space Ambient Occlusion optimizations

Page 30: Rendering Techniques in Gears of War 2

Blood TechniquesBlood Techniques• Many different techniques used in combination:y q

– Projected blood decals– Screen-space blood splatter

World space particle effects– World-space particle effects– Surface-space shader effects– Fluid simulations– Morphing geometry

Page 31: Rendering Techniques in Gears of War 2

Blood TechniquesBlood Techniques• Movie: Riftworm heart chamber, chainsawing through , g g

arteries

Page 32: Rendering Techniques in Gears of War 2

Decal FeaturesDecal Features• Decal system much improved over Gears 1y p• Much easier to spawn decals on anything• Supports any artist-created material (shader), lighting, blend

mode normal maps animated render to texture etcmode, normal maps, animated, render-to-texture, etc• Three decal pools:

– Blood decals, explosion decals, bullet decals– Blood splatter unaffected by the number of bullet hit-marks

• Heuristic to replace oldest decal (when necessary):– Oldest not visible decal (LastRenderTime)Oldest not visible decal (LastRenderTime)– Oldest visible decal (Lifetime)

• Proximity check to avoid multiple decals on top of each other

Page 33: Rendering Techniques in Gears of War 2

Decal OptimizationsDecal Optimizations• AABB tree to find triangles within the decal frustumg

– These triangles are not clipped• Decals have their own index buffers

– Re-use whole triangles from the base mesh vertexbuffersRe use whole triangles from the base mesh vertexbuffers• Frustum-clipping handled by GPU:

– clip(), early-out branch, scissor testD l i ibilit t t• Decal visibility tests:– Re-use base mesh visibility test– Decal-specific frustum and distance check

• Decals on fractured meshes:– Re-use the fragment-visibility check– Upon fracture, re-calculate affected decals onlyUpo actu e, e ca cu ate a ected deca s o y

Page 34: Rendering Techniques in Gears of War 2

Decal OptimizationsDecal Optimizations• One drawcall per decal, but:

– This allows for scissoring– Each decal is fully featured

• Statically lit decals re-use lightmaps from underlying surfacey g p y g• Dynamically lit decals use additive multi-pass lighting• Decals on dynamic objects:

– Projections are in local space– Projections are in local space– Re-use matrix to follow the mesh

• Decals on static objects:Placed in the various static drawlists (“fire and forget”)– Placed in the various static drawlists ( fire and forget”)

• Static decals (manually placed in editor):– Pre-clipped geometry (no clipping on GPU)

Page 35: Rendering Techniques in Gears of War 2

Example: Blood SmearsExample: Blood Smears• Project decals on ground and on cover walls when you’re hurtj g y• Project a new decal every 0.5s while moving• Using fading “paintbrush” effect along movement direction

O ll f d + “ i tb h” f d– Overall fade + “paintbrush” fade– Shader parameter curves exposed to artists

• Mix with standard blood decals to break up pattern

Page 36: Rendering Techniques in Gears of War 2

Blood Smears, 1 of 4,

Page 37: Rendering Techniques in Gears of War 2

Blood Smears, 2 of 4,

Page 38: Rendering Techniques in Gears of War 2

Blood Smears, 3 of 4,

Page 39: Rendering Techniques in Gears of War 2

Blood Smears, 4 of 4,

Page 40: Rendering Techniques in Gears of War 2

Screen-space Blood EffectsScreen space Blood Effects• Screen-space blood splatter:p p

– Spawned by level design (Kismet), animation (AnimNotify nodes) or script code

– 3D particle effects that use camera-facing particles3D particle effects that use camera facing particles– Game code re-positions these camera-effects each frame– Allows for more dynamic “screen-space” effects

F ll f t d 3D ti l ff t• Full-featured 3D particle effects• Artist-made materials (shaders)• Like any material, can take shader parameters from gameplay script code• Meshes, sprites, movie textures, normal-mapping, etcMeshes, sprites, movie textures, normal mapping, etc

Page 41: Rendering Techniques in Gears of War 2

World-space Blood EffectsWorld space Blood Effects• World-space 3D particle effectsp p• Use world-space coordinates for fake lighting on sprites

and gibs– Can make up-facing pixels brighter etcCan make up facing pixels brighter, etc– Normal-mapped sprites helps

• 4x6 “movie frames” in a sub-UV texture to get realistic motionmotion– 2048x1024 color map + 1024x512 normal map– Re-used for most liquid-type effects

Mi h d i hi b 3 D f li• Mix meshes and sprites to achieve a better 3-D feeling• Mix additive and translucent blending to work well in both

dark and bright areasg

Page 42: Rendering Techniques in Gears of War 2

Surface‐space Blood EffectsSurface space Blood Effects

Page 43: Rendering Techniques in Gears of War 2

Example: Surface-spaceExample: Surface space• Inside the Riftworm, characters use a blood shader• One scalar shader parameter (0-1) to indicate amount of blood• Texture masks for bloody regions and pattern• Scroll textures downwards in texture-space

– Gradient pattern & normalmap– (Roughly correlates to down in world-space)

• Masks and shader parameter multiplyU d l f t b t t t bl d l d bl di d l– Used as lerp factor between a constant blood color and un-bloodied color

• Blood color have negative Blue and Green components– Produces slight discoloration in the transition areas

• ALL_SoldierShaders.SinglePlayer.Bloody.SoldierShader_Bloody

Page 44: Rendering Techniques in Gears of War 2

Fluid SimulationFluid Simulation• Using our Unreal Engine 3 fluid simulation featureg g

– Allows the player to wade through large pools of blood

• Ability to raise / lower the entire fluidControlled b a triggered cinematic– Controlled by a triggered cinematic

• Simulated on separate thread• Height-field tessellated on GPUHeight field tessellated on GPU

– No vertex buffer to update, all vertices are created on-the-fly on GPU– The height-field is used as a dynamic vertex texture– (Not all platforms)(Not all platforms)

Page 45: Rendering Techniques in Gears of War 2

Example: Riftworm Heart ChamberExample: Riftworm Heart Chamber

• Many different techniques in combination:y q– Gore mesh– Screen-space blood splatter

World space blood particle effects– World-space blood particle effects– Surface-space shader effect on the main character– Blood fluid simulation

• Note: Cutting through an artery is not done with gore mesh– Skeleton animationSkeleton animation– Throbbing is morphing geometry

Page 46: Rendering Techniques in Gears of War 2

Blood TechniquesBlood Techniques• Movie: Riftworm heart chamber, chainsawing through , g g

arteries

Page 47: Rendering Techniques in Gears of War 2

Morphing Blood GeometryMorphing Blood Geometry• Morphing:p g

– Animate individual vertices, not a skeleton– Blend between “morph targets” (or “blend shapes”)

U l• Usage examples:– Throbbing guts inside the Riftworm– Some cinematics use morph targets– Meatshield, to prevent it from intersecting the holder

• Final example: Exit from the Riftworm• Final example: Exit from the Riftworm– Notice blood pouring out (morphed geometry)

Page 48: Rendering Techniques in Gears of War 2

Blood TechniquesBlood Techniques• Movie: Riftworm exit cinematic

Page 49: Rendering Techniques in Gears of War 2

In ConclusionIn Conclusion

• Achieving the right look for blood and gore:Achieving the right look for blood and gore:– Mix many different techniques– Use highly featured and flexible toolsg y

Page 50: Rendering Techniques in Gears of War 2

About Daniel WrightAbout Daniel Wright

• Joined Epic Games in 2006Joined Epic Games in 2006• Huge graphics nerdO i i d hi f b 360 S3 d C• Optimized graphics for Xbox 360, PS3 and PC

Page 51: Rendering Techniques in Gears of War 2

TopicspDaniel Wright

• Gore techniquesq• Blood techniques• Character lighting• Screen Space Ambient Occlusion optimizations

Page 52: Rendering Techniques in Gears of War 2

TopicspDaniel Wright

• Gore techniquesq• Blood techniques• Character lighting

– Game lighting– Shadows– Cinematic lightingCinematic lighting

• Screen Space Ambient Occlusion optimizations

Page 53: Rendering Techniques in Gears of War 2

Game Character Lighting GoalsGame Character Lighting Goals

• Integrate closely with environmentg y• Minimal artist effort, should ‘just work’• Upper bound on shading cost

Page 54: Rendering Techniques in Gears of War 2

Backgroundg• Hundreds of static local light sources in Gears of War 2 levels

Page 55: Rendering Techniques in Gears of War 2

Backgroundg• Hundreds of static local light sources in Gears of War 2 levels

Page 56: Rendering Techniques in Gears of War 2

Backgroundg– Some of these are dominant light sources

Page 57: Rendering Techniques in Gears of War 2

Backgroundg– The rest are fill (bounce) lights

Page 58: Rendering Techniques in Gears of War 2

BackgroundBackground

• Hundreds of static local light sources in Gears of War 2 glevels

• Too many to light the character dynamically with all of th !them!

Page 59: Rendering Techniques in Gears of War 2

Introducing the Light EnvironmentIntroducing the Light Environment

• A Light Environment consists of:g– The incident lighting for the object it is responsible for lighting– Update and apply logic

Page 60: Rendering Techniques in Gears of War 2

Incident Lighting RepresentationIncident Lighting Representation• Used a Spherical Harmonic basis• 9 coefficients• 9 coefficients

Incident lighting stored in a spherical harmonic basis for two lights

Page 61: Rendering Techniques in Gears of War 2

Creating the Light EnvironmentCreating the Light Environment

• Dynamically composite relevant lights into the spherical y y p g pharmonic basis unique for each character

• Light visibility determined with ray traces• Separate static and dynamic environments

Page 62: Rendering Techniques in Gears of War 2

Creating the Light EnvironmentCreating the Light Environment

• Static lights go into the static environmentg g• For the static environment:

– Update cost is spread across multiple frames– Update rate is determined by visibility, distance to the viewer,

and object importance

Page 63: Rendering Techniques in Gears of War 2

Creating the Light EnvironmentCreating the Light Environment

Every frame

Every static update

Incident lighting from dynamic lights calculated

FinalIncident lighting from static lights calculated

Static environment 

Final Representation

interpolated

Page 64: Rendering Techniques in Gears of War 2

Applying the Light EnvironmentApplying the Light Environment• Directional light for dominant direction

Virtual dominant light

Page 65: Rendering Techniques in Gears of War 2

Applying the Light EnvironmentApplying the Light Environment

• Dual-Hemisphere light for remaining environmentp g g• Medium quality

Dual-Hemisphere indirect term

Direct term Combined

Page 66: Rendering Techniques in Gears of War 2

Applying the Light EnvironmentApplying the Light Environment

• Directly evaluate remaining SH environment per-pixely g p p• Gives highest quality

Spherical HarmonicIndirect term

CombinedDirect term

Page 67: Rendering Techniques in Gears of War 2

Applying the Light EnvironmentApplying the Light Environment

Dominant lightFill light

Page 68: Rendering Techniques in Gears of War 2

Applying the Light EnvironmentApplying the Light Environment

• Additional dynamic lights can be appliedy g pp– Useful for quickly changing gameplay lights like muzzle flashes– Artist’s discretion

Page 69: Rendering Techniques in Gears of War 2

Character ShadowingCharacter Shadowing

• Shadow direction– Determined by dominant light direction– Fill lights are excluded

Page 70: Rendering Techniques in Gears of War 2

Character ShadowingCharacter Shadowing

Dominant light Dominant light and shadow

Dominant light, shadow, and unshadowed secondary light

and shadow

Page 71: Rendering Techniques in Gears of War 2

Cinematic Character LightingCinematic Character Lighting• Mix of light environments and multiple shadowed dynamic lights

– Whatever looks best for each cinematic

Page 72: Rendering Techniques in Gears of War 2

In ConclusionIn Conclusion

• Combine relevant lights into one efficient representationg p

Page 73: Rendering Techniques in Gears of War 2

TopicspDaniel Wright

• Gore techniquesq• Blood techniques• Character lighting• Screen Space Ambient Occlusion optimizations

Page 74: Rendering Techniques in Gears of War 2

TopicspDaniel Wright

• Gore techniquesq• Blood techniques• Character lighting• Screen Space Ambient Occlusion optimizations

– ReviewMotivation– Motivation

– Down sampling– Temporal filtering– Computation masking

Page 75: Rendering Techniques in Gears of War 2

Screen Space Ambient Occlusion R iReview

• Sample neighbor depths• Compare depth differences

Viewer

Occlusion

NeighborSamples

Current PixelCurrent Pixel

Page 76: Rendering Techniques in Gears of War 2

Screen Space Ambient Occlusion R iReview

• Noisy outputy p

Occlusion

Page 77: Rendering Techniques in Gears of War 2

Screen Space Ambient Occlusion R iReview

• Spatial filter passesRemo es high freq enc noise– Removes high frequency noise

Ed dOcclusion

Edges preserved

Filter

Page 78: Rendering Techniques in Gears of War 2

Screen Space Ambient Occlusion R iReview

• PC games have shipped with SSAO as a high end g pp gfeature

• Gears 2 first console game (that we’re aware of)– Many more coming soon!

• Lots of available information on making it look good• Only talking about optimizing here• Only talking about optimizing here

Page 79: Rendering Techniques in Gears of War 2

BaselineBaseline• 720p, 16 occlusion samples, full res, 20 filter samples

Ambient Occlusion only

Page 80: Rendering Techniques in Gears of War 2

BaselineBaseline• 720p, 16 occlusion samples, full res, 20 filter samples

Lit

Page 81: Rendering Techniques in Gears of War 2

BaselineBaseline• 720p, 16 occlusion samples, full res, 20 filter samples

Lit and Ambient Occlusion

Page 82: Rendering Techniques in Gears of War 2

Screen Space Ambient Occlusion O ti i tiOptimizations

• Motivation– Shortage of GPU resources– Targeting console hardware

T d ff lit f f• Trade off quality for performance

Page 83: Rendering Techniques in Gears of War 2

Occlusion PassOcclusion Pass• Reduce neighbor samples

– Multi-frequency occlusion is lostMulti-frequency occlusion is lost

8 occlusion samples, 12 filter samples

Page 84: Rendering Techniques in Gears of War 2

Occlusion PassOcclusion Pass• Reduce neighbor samples

– Multi-frequency occlusion is lostMulti-frequency occlusion is lost

16 occlusion samples, 20 filter samples 8 occlusion samples, 12 filter samples

Page 85: Rendering Techniques in Gears of War 2

Occlusion PassOcclusion Pass

• Texture cache thrashingg– Due to random per-pixel offsets

• Clamp offset radius in screen space

Page 86: Rendering Techniques in Gears of War 2

Down samplingDown sampling• Downsized render target

– AO is mostly low frequencyAO is mostly low frequency

Down sampled by a factor of two

Page 87: Rendering Techniques in Gears of War 2

Down samplingDown sampling• Downsized render target

– AO is mostly low frequencyAO is mostly low frequency

Full resolution Down sampled by a factor of two

Page 88: Rendering Techniques in Gears of War 2

Down samplingDown sampling• Downsized render target

– Use furthest of source depthsUse furthest of source depths• Effectively shrinks silhouettes of nearby objects

Using one source depth Using furthest of source depths

Page 89: Rendering Techniques in Gears of War 2

Down samplingDown sampling

• Downsized render targetDownsized render target– Store depth in same render target as occlusion

• Occlusion and filtering passes can reuseDown

sample

• Later passes can get occlusion and depth with one texture lookup

• Using RG16F

Occlusion

Using RG16F

– Ended up using a down sample factor of two– Reduces Xbox 360 resolve cost by a factor of four

Filter

Page 90: Rendering Techniques in Gears of War 2

ResultsResults

Page 91: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter

• Motivation– Large spatial filters needed to hide low occlusion samples– Detail is lost with large filters

Lots of variance between frames– Lots of variance between frames

Page 92: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter

• Filter the occlusion factor over time– Reverse Reprojection Caching

• Use as a filter instead of an optimization Down sample

Occlusion

Filter

Temporal Filter

Page 93: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter

• Reverse Reprojection CachingReverse Reprojection Caching

If last frame’s value isIf last frame s value is invalid, throw it away

Lookup this frame and last frame’s occlusion

Update the history with new occlusion

Otherwise New = lerp(Current, Old, Rate)

last frame s occlusion values

Page 94: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter

• Reverse Reprojection CachingReverse Reprojection Caching

If last frame’s value isIf last frame s value is invalid, throw it away

Update the history with new occlusion

Lookup this frame and last frame’s occlusion

Otherwise New = lerp(Current, Old, Rate)

last frame s occlusion values

Page 95: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter

• Reverse Reprojection CachingReverse Reprojection Caching

If last frame’s value isIf last frame s value is invalid, throw it away

Update the history with new occlusion

Lookup this frame and last frame’s occlusion

Otherwise New = lerp(Current, Old, Rate)

last frame s occlusion values

Page 96: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter

• Reverse Reprojection CachingReverse Reprojection Caching

If last frame’s value isIf last frame s value is invalid, throw it away

Update the history with new occlusion

Lookup this frame and last frame’s occlusion

Otherwise New = lerp(Current, Old, Rate)

last frame s occlusion values

Page 97: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter

• Dynamic objects

Source Position

Animation

Last Frame

Animation

This Frame

World space position

World space position

Screen space position

p

Screen space position

p

Page 98: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter

• Static objects

Source Position

Animation

World space position

Screen space 

Last Frame

Screen space 

This Frame

position position

Page 99: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter

• Update history of all pixels as if they were staticp y p y• Overwrite with correct value for dynamic objects

– Depth testing Down sample

Occlusion

Filter

Temporal Filter Static

Temporal Filter Dynamic

Page 100: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter

• Newly Unoccluded pixels

Halo regionsNew Pixels

hCharacter movementdirection

Page 101: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter

• Additional convergence control

New pixels from camera rotation for one frame

Accelerating Convergence over multiple frames

Constant Convergence RatePixels with an existing history

Page 102: Rendering Techniques in Gears of War 2

Without Temporal FilterWithout Temporal Filter

Page 103: Rendering Techniques in Gears of War 2

With Temporal FilterWith Temporal Filter

Page 104: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter• Doesn’t help with static camera/objects

Page 105: Rendering Techniques in Gears of War 2

Temporal FilterTemporal Filter• Almost all flickering gone with moving camera• Can get away with less occlusion samples, less filter samples

Camera movingCamera moving

Page 106: Rendering Techniques in Gears of War 2

Temporal Filter GotchasTemporal Filter Gotchas

• Accurate last frame positionp• Bilinear filtering• Double buffer• World space precision

Page 107: Rendering Techniques in Gears of War 2

Temporal Filter LimitationsTemporal Filter Limitations• Skeletal meshes• Not detecting cache misses for every sampleg y p

Streaks where moving objects meet

Page 108: Rendering Techniques in Gears of War 2

Computation MaskingComputation Masking

• Pixels with minimal occlusion

Page 109: Rendering Techniques in Gears of War 2

Computation MaskingComputation Masking

• First person weapon

Page 110: Rendering Techniques in Gears of War 2

Computation MaskingComputation Masking

• Distant pixels

Page 111: Rendering Techniques in Gears of War 2

Computation MaskingComputation Masking

• Cull these pixels with Hi-Stencilp– Requires use of down sampled depth/stencil buffer– Special fast case for distance

Computation maskComputation mask

Page 112: Rendering Techniques in Gears of War 2

In ConclusionIn Conclusion

• Use Reverse Reprojection Caching as a temporal filterp j g p• Use Computation Masking to avoid doing work where it won’t 

be noticed

Page 113: Rendering Techniques in Gears of War 2

Questions?Questions?

[email protected] i l i h @ i• [email protected]