You are on page 1of 38

Resistance: Fall of

Resistance: Fall of
Man
Man
Insomniac Games
Insomniac Games

Development
Development

Started on PC with a small prototype team


Started on PC with a small prototype team
concurrent with PS2 development
concurrent with PS2 development

Good for prototyping shaders little change


Good for prototyping shaders little change

Good for prototyping lighting, tools and build


Good for prototyping lighting, tools and build
process
process

Bad for code development, systems were not written


Bad for code development, systems were not written
with the Cell in mind
with the Cell in mind

ater on, small group handled porting code base


ater on, small group handled porting code base
to PS! while others continued wor"ing on PC
to PS! while others continued wor"ing on PC

Development
Development

#any concepts shared from PS2


#any concepts shared from PS2

$sset types named the same to "eep artists happy $sset types named the same to "eep artists happy

Structure of the engine is similar Structure of the engine is similar

Similar tool chain Similar tool chain

%o runtime code shared from PS2


%o runtime code shared from PS2

PS! &esistance and PS2 &atchet had little in common PS! &esistance and PS2 &atchet had little in common

ots of $S# on PS2 so not much to use on PS! ots of $S# on PS2 so not much to use on PS!

#ost PS2 systems were considered too simple for PS! #ost PS2 systems were considered too simple for PS!

Programmer Tools
Programmer Tools

Perforce
Perforce

Pro'G
Pro'G

S% 'BS
S% 'BS

(isual Studio
(isual Studio

In house asset control system


In house asset control system

In house build server


In house build server

In house world tool


In house world tool

Art Tools
Art Tools

#aya
#aya

#ental &ay
#ental &ay

#icrowave
#icrowave

Photoshop
Photoshop

) Brush
) Brush

Speed*ree
Speed*ree

Asset Types
Asset Types

+ept the same asset names to "eep the process


+ept the same asset names to "eep the process
familiar
familiar

,-.rags
,-.rags

*ies
*ies

#obys
#obys

Shrubs
Shrubs

.oliage
.oliage

S"ies
S"ies

Shaders
Shaders

U-Frags
U-Frags

#ost basic - fastest to render


#ost basic - fastest to render

Completely static geometry


Completely static geometry

(ertices stored in world space as locally compressed


(ertices stored in world space as locally compressed
fragments to "eep the precision as high as possible
fragments to "eep the precision as high as possible
real positions computed in the verte/ programs
real positions computed in the verte/ programs

%on-instanceable
%on-instanceable

ightmapped or verte/ ba"ed


ightmapped or verte/ ba"ed

#emory efficient
#emory efficient

P(S occlusion
P(S occlusion

Ties
Ties

Conceptually the same as ,-.rag but instanced -


Conceptually the same as ,-.rag but instanced -
vertices defined in local space
vertices defined in local space

Completely static geometry


Completely static geometry

Can be nested within each other in the tools, invisible


Can be nested within each other in the tools, invisible
to runtime
to runtime

ightmapped or verte/ ba"ed


ightmapped or verte/ ba"ed

#ade up the ma0ority of a typical scene


#ade up the ma0ority of a typical scene

Stored as two &S1 streams, a master and a per instance


Stored as two &S1 streams, a master and a per instance
stream with the lighting info
stream with the lighting info

P(S occlusion
P(S occlusion

Mobys
Mobys

'ynamic geometry, most e/pensive


'ynamic geometry, most e/pensive

Can have physics, animations, etc2


Can have physics, animations, etc2

#ay be rigid 34 bone5 or s"inned 36 bones5


#ay be rigid 34 bone5 or s"inned 36 bones5

Static lighting from pre-computed spatial


Static lighting from pre-computed spatial
lighting volumes
lighting volumes

'ynamic lighting from runtime lights


'ynamic lighting from runtime lights

Crude static 7'


Crude static 7'

Shrubs
Shrubs

(ery fast to render, used to fill scene


(ery fast to render, used to fill scene

evels would have 48"-28" instances


evels would have 48"-28" instances

(ery basic geometry


(ery basic geometry

Simple lighting
Simple lighting

'idn9t cast shadows but could receive them


'idn9t cast shadows but could receive them

Basic wind li"e animation


Basic wind li"e animation

.ade out in distance


.ade out in distance

P(S occlusion
P(S occlusion

Foliage
Foliage

,sed for leaves on trees


,sed for leaves on trees

Camera facing billboards


Camera facing billboards

,sed Speed*ree for data generation but wrote


,sed Speed*ree for data generation but wrote
our own custom renderer for runtime
our own custom renderer for runtime

Could cast and receive shadows


Could cast and receive shadows

Basic wind li"e animation similar to shrubs


Basic wind li"e animation similar to shrubs

P(S occlusion
P(S occlusion

Sies
Sies

#ultiple fre:uencies of cloud layers composited


#ultiple fre:uencies of cloud layers composited
together
together

$rtist driven animation parameters to procedurally


$rtist driven animation parameters to procedurally
control cloud turbulence, drift, formation rates, etc2
control cloud turbulence, drift, formation rates, etc2

Simplified geometry could be rendered before or after


Simplified geometry could be rendered before or after
cloud layers
cloud layers

Bloom geometry layers


Bloom geometry layers

'rawn after opa:ue geometry


'rawn after opa:ue geometry

P(S occlusion
P(S occlusion

Sha!ers
Sha!ers

Base color map, $lpha;Bloom, %ormal, Gloss, Incandescence, Paralla/, and Base color map, $lpha;Bloom, %ormal, Gloss, Incandescence, Paralla/, and
'etail 'etail

.ine grain control e/posed to artists te/ture format, filtering modes, etc2 .ine grain control e/posed to artists te/ture format, filtering modes, etc2

(erte/ programs abstracted the asset type (erte/ programs abstracted the asset type

$ll assets shared fragment programs - consistent lighting $ll assets shared fragment programs - consistent lighting

&untime has specific shader programs to optimally handle the various &untime has specific shader programs to optimally handle the various
combinations of shader features combinations of shader features

,sed simple pre-processor <defines to add ; e/clude program features ,sed simple pre-processor <defines to add ; e/clude program features

&educed te/ture formats when channels are missing, for e/ample '1*= can &educed te/ture formats when channels are missing, for e/ample '1*= can
be '1*4 when there is no alpha be '1*4 when there is no alpha

%ormal maps are stored compressed as 2 channels in a '1*= map %ormal maps are stored compressed as 2 channels in a '1*= map

'& Cubemaps created from probes placed in maya '& Cubemaps created from probes placed in maya

Sha!ers
Sha!ers

*he alpha type is part of the shader *he alpha type is part of the shader

7pa:ue 3updates >5 7pa:ue 3updates >5

Blended 3does not update >5 Blended 3does not update >5

$dditive 3does not update >5 $dditive 3does not update >5

Cutout 3uses alpha test5 Cutout 3uses alpha test5

'estination alpha used for bloom 'estination alpha used for bloom

Shader 7' removed e/pensive features Shader 7' removed e/pensive features

Shaders use the hardware features of the te/ture samplers Shaders use the hardware features of the te/ture samplers

Swi>>le to get the inputs in to the place where the fragment program Swi>>le to get the inputs in to the place where the fragment program
e/pects them e/pects them

,se the sign e/tend and force >ero;one feature ,se the sign e/tend and force >ero;one feature

"uil! Process
"uil! Process

?ach asset type has a stand alone builder


?ach asset type has a stand alone builder

PC Command line tool, integrated with our asset control PC Command line tool, integrated with our asset control
system system

Single platform, assets are built directly in hardware format Single platform, assets are built directly in hardware format

PS! viewer that shows individual built assets


PS! viewer that shows individual built assets

Good for debugging assets Good for debugging assets

Good for rough stats on a single asset Good for rough stats on a single asset

(iewers show all physics and collision info (iewers show all physics and collision info

(iewers allow artists to light and animate out of the conte/t (iewers allow artists to light and animate out of the conte/t
of a level of a level

"uil! Process
"uil! Process

?ngine 'ata evel Pac"er


?ngine 'ata evel Pac"er

$ level is a group of assets of different types pac"ed


$ level is a group of assets of different types pac"ed
together by the pac"ing tool
together by the pac"ing tool

*he level pac" tool is what lays optimally in the final


*he level pac" tool is what lays optimally in the final
format, resolves duplicates, partitions memory, etc2
format, resolves duplicates, partitions memory, etc2

7n load, very little copying is done, we 0ust need to


7n load, very little copying is done, we 0ust need to
patch up pointers
patch up pointers

&S1 data is pac"ed into two chun"s, one that ends


&S1 data is pac"ed into two chun"s, one that ends
up in main memory and one in local memory
up in main memory and one in local memory

"uil! Process
"uil! Process

Problems
Problems

%o bac"wards;forwards compatibility of data


%o bac"wards;forwards compatibility of data
formats
formats

Slow asset builds


Slow asset builds

ive data
ive data

Static #ighting
Static #ighting

?nvironments use simplified @2 style light maps -


?nvironments use simplified @2 style light maps -
directional luminance in the lightmaps and a shared
directional luminance in the lightmaps and a shared
chrominance per verte/
chrominance per verte/

?nvironments could also use verte/ lighting, in which


?nvironments could also use verte/ lighting, in which
case there was no lightmaps and the luminance and
case there was no lightmaps and the luminance and
chrominance are stored per verte/
chrominance are stored per verte/

*he lightmaps, ,(s and verte/ components for lighting


*he lightmaps, ,(s and verte/ components for lighting
are stored per instance
are stored per instance

$ll lighting computed through #ental &ay


$ll lighting computed through #ental &ay

Interactive lightmap resolution and format twea"ing


Interactive lightmap resolution and format twea"ing

Static #ighting
Static #ighting

#obys and moveable ob0ects use a static environment


#obys and moveable ob0ects use a static environment
lighting database that is pre-computed from artist
lighting database that is pre-computed from artist
placed lighting volumes
placed lighting volumes

uminance is stored per sample along A-a/es with a


uminance is stored per sample along A-a/es with a
shared chrominance
shared chrominance

'ata is stored as a grid and interpolated


'ata is stored as a grid and interpolated

Code could :uery a single point or a cube and locally


Code could :uery a single point or a cube and locally
interpolate etc2
interpolate etc2

,niform grids do not catch shadow edges very


,niform grids do not catch shadow edges very
accurately without consuming lots of memory
accurately without consuming lots of memory

Dynamic #ighting
Dynamic #ighting

'ynamic lights are rendered as a separate pass per light


'ynamic lights are rendered as a separate pass per light

7nly the individual geometry fragments affected by the


7nly the individual geometry fragments affected by the
lights are rendered in the light passes
lights are rendered in the light passes

$ll lighting is per pi/el, typical light types supported


$ll lighting is per pi/el, typical light types supported
3Point, spot, etc25
3Point, spot, etc25

ighting model is the same for all assets so they all light
ighting model is the same for all assets so they all light
the same
the same

Shadow maps are pre-rendered at the start of the frame,


Shadow maps are pre-rendered at the start of the frame,
there is an Bmb limit for shadow maps
there is an Bmb limit for shadow maps

Shadow maps are 4A-bit linear depth and range


Shadow maps are 4A-bit linear depth and range
controlled for best accuracy
controlled for best accuracy

Static occlusion
Static occlusion

Static occlusion is a P(S system


Static occlusion is a P(S system

'atabase is computed offline using the PS! to render


'atabase is computed offline using the PS! to render
the scene using :ueries and the PC to :uanti>e;pac"
the scene using :ueries and the PC to :uanti>e;pac"
the results usually an overnight process
the results usually an overnight process

$t runtime given a camera position you get a bit array


$t runtime given a camera position you get a bit array
of the visible nodes and the ma/ visible distance
of the visible nodes and the ma/ visible distance

?ach asset fragment belongs to a node and a simple


?ach asset fragment belongs to a node and a simple
runtime logic op determines if the node is visible
runtime logic op determines if the node is visible

*here is a limited number of nodes, each represented


*here is a limited number of nodes, each represented
by a single bit
by a single bit

Frame "uffer Setup
Frame "uffer Setup

'isplay Buffers
'isplay Buffers

2 / 42B8/C28 !2-bit &GB$ 2 / 42B8/C28 !2-bit &GB$

Both display buffers share a single tile to reduce wasted Both display buffers share a single tile to reduce wasted
memory memory

De did not support 48B8, couldn9t afford the memory De did not support 48B8, couldn9t afford the memory

&ender Buffer
&ender Buffer

42B8/C28, !2bit, 2/#S$$ 42B8/C28, !2bit, 2/#S$$

!2-bit depth buffer !2-bit depth buffer

Color and depth in their own tiles with compression enabled Color and depth in their own tiles with compression enabled

$lways render 42B8/C28 down sample for %*SC and P$ $lways render 42B8/C28 down sample for %*SC and P$

Frame "uffer Setup
Frame "uffer Setup

$lternate &ender Buffer


$lternate &ender Buffer

42B8/C86, !2bit, 2/#S$$


42B8/C86, !2bit, 2/#S$$

C86 is the magic height as it obeys all the restrictions


C86 is the magic height as it obeys all the restrictions
of depth and color tiles
of depth and color tiles

Center on the C28 front buffer, giving B pi/els of


Center on the C28 front buffer, giving B pi/els of
blac" top and bottom
blac" top and bottom

%o wasted memory due to alignment2 7ver 4#b


%o wasted memory due to alignment2 7ver 4#b
saved from using 42B8/C28 and 2E faster
saved from using 42B8/C28 and 2E faster

Idea was too late to be useful on &esistance


Idea was too late to be useful on &esistance

Frame Ren!er $r!er
Frame Ren!er $r!er

Statically lit opa:ue geometry Statically lit opa:ue geometry

S"y S"y

Statically lit alpha geometry Statically lit alpha geometry

'ynamically lighting passes on opa:ue geometry 'ynamically lighting passes on opa:ue geometry

'ynamically lighting passes on alpha geometry 'ynamically lighting passes on alpha geometry

?ffects, Dater, Ground fog ?ffects, Dater, Ground fog

&esolve multisampling to display buffer, apply color correction &esolve multisampling to display buffer, apply color correction
3contrast, brightness and saturation5 3contrast, brightness and saturation5

$pply post effects on the off screen display buffer $pply post effects on the off screen display buffer

'raw @,' directly to display 'raw @,' directly to display

'raw the system 7S' 'raw the system 7S'

.lip the display buffers .lip the display buffers



%i!eo Memory "u!get
%i!eo Memory "u!get

(ram is almost e/clusively pi/el data, some verts


(ram is almost e/clusively pi/el data, some verts
may be in vram for memory balancing
may be in vram for memory balancing

24#b .rame buffers


24#b .rame buffers

=42+ .ragment programs


=42+ .ragment programs

B#b Scratch memory 3non-tiled5


B#b Scratch memory 3non-tiled5

=8-C8#b ightmaps
=8-C8#b ightmaps

44=-4!=#b *e/tures
44=-4!=#b *e/tures

Scratch memory is used for shadow buffers,


Scratch memory is used for shadow buffers,
effects, and post effect wor"ing buffers etc2
effects, and post effect wor"ing buffers etc2

Main Memory
Main Memory

%o C&* allocations
%o C&* allocations

$llocate our own memory segment


$llocate our own memory segment

$llocate all free memory as 4mb pages


$llocate all free memory as 4mb pages

Individually commit pages to the segment


Individually commit pages to the segment

#ap everything in the segment to the &S1


#ap everything in the segment to the &S1

De do leave a couple of #b slop for the C&*


De do leave a couple of #b slop for the C&*
because its used by other C&* functions 3printf5
because its used by other C&* functions 3printf5
and networ"ing code
and networ"ing code

Memory Allocators
Memory Allocators

ow level allocator is an Fallocate at end9 type allocator


ow level allocator is an Fallocate at end9 type allocator
with no ability to free memory
with no ability to free memory

*he allocator has chec"points which we can use to


*he allocator has chec"points which we can use to
rollbac" main and video memory
rollbac" main and video memory

&eliable clean up without concern about destructors


&eliable clean up without concern about destructors
being called
being called

*here are chec"points inserted at the various points


*here are chec"points inserted at the various points
during load so we can :uic"ly reload when a player dies
during load so we can :uic"ly reload when a player dies
or restarts the level
or restarts the level

Systems that needed true dynamic memory dealt with it


Systems that needed true dynamic memory dealt with it
with an optimal allocator specific to that system
with an optimal allocator specific to that system

Main Memory "u!get
Main Memory "u!get

?lfGSystem Setup
?lfGSystem Setup

Code and 'ata


Code and 'ata
4C#b
4C#b

2mb of embedded SP, elf data 2mb of embedded SP, elf data

2Gmb of P&1 modules 2Gmb of P&1 modules

BSS
BSS
B#b
B#b

C&* @eap
C&* @eap
4#b
4#b

SP, *hread group swap space


SP, *hread group swap space
2#b
2#b

Main Memory "u!get
Main Memory "u!get

Core engine
Core engine

Push buffers
Push buffers
A-48#b
A-48#b

Scratch memory
Scratch memory
H#b
H#b

Global *e/tures and @,'


Global *e/tures and @,'
B#b
B#b

#isc
#isc
2#b
2#b

SP, '#$ buffers, verte/ programs, &* light setup SP, '#$ buffers, verte/ programs, &* light setup
buffers, .I7S init, Sound init etc buffers, .I7S init, Sound init etc

Main Memory "u!get
Main Memory "u!get

evel 'ata evel 'ata

?ffects ?ffects 44#b 44#b

Geometry Geometry =8#b =8#b

Collision Collision H#b H#b

$nim $nim !8#b !8#b

?nviroment Instance ?nviroment Instance 2#b 2#b

7cclusion;P(S 7cclusion;P(S 6#b 6#b

Sound Sound !8#b !8#b

'ialog 'ialog 42#b 42#b

Physics Physics H#b H#b

%avG$I %avG$I 6#b 6#b

#oby Instance #oby Instance A#b A#b

Gameplay;Scripts Gameplay;Scripts 48#b 48#b



SPU &onfiguration
SPU &onfiguration

2 &aw mode SP,s


2 &aw mode SP,s

7ne SP, running broad collision 7ne SP, running broad collision

7ne SP, running narrow collision 7ne SP, running narrow collision

*hese run all the time *hese run all the time

! IJob #anagerK SP,s


! IJob #anagerK SP,s

In a thread group running SP,&S In a thread group running SP,&S

IJob #anagerK policy module IJob #anagerK policy module

$ll 0obs go on these $ll 0obs go on these

4 ,nused
4 ,nused

*his is for the 7S to steal for $C! ?ncode etc *his is for the 7S to steal for $C! ?ncode etc

*his should be used with its own 0ob manager instance in the *his should be used with its own 0ob manager instance in the
future for 0obs that don9t mind getting interrupted by the 7S future for 0obs that don9t mind getting interrupted by the 7S

SPU &onfiguration
SPU &onfiguration

Initially we had IJob #anagerK using 6 SP,s


Initially we had IJob #anagerK using 6 SP,s

Dhen we finally got a 7S that was stealing an SP, it


Dhen we finally got a 7S that was stealing an SP, it
was more e/pensive to have IJob #anagerK on 6 SP,s
was more e/pensive to have IJob #anagerK on 6 SP,s
than on !
than on !

Dith $C! ?ncode active


Dith $C! ?ncode active

*otal SP, *ime for IJob #anagerK of 6 *otal SP, *ime for IJob #anagerK of 6 6286B ms 6286B ms

*otal SP, *ime for IJob #anagerK of ! *otal SP, *ime for IJob #anagerK of ! !2H26 ms !2H26 ms

#ultiple instances of SP,&S;IJob #anagerK came too


#ultiple instances of SP,&S;IJob #anagerK came too
late for us to use
late for us to use

SPU Systems
SPU Systems

$nimation $nimation

$udio 3%e/tSynth and &45 $udio 3%e/tSynth and &45

Buc"eter sort Buc"eter sort

Collision 3separate broad and narrow5 Collision 3separate broad and narrow5

'ynamic 'B 'ynamic 'B

'ynamic 0oint 'ynamic 0oint

.1 update .1 update

Geom Cull Clip 3for shadows and decals5 Geom Cull Clip 3for shadows and decals5

Glass Glass

#oby constants #oby constants

Physics collision Physics collision

Physics simulation Physics simulation

Particle 3weather f/5 Particle 3weather f/5

&ender mats &ender mats

Static 'B Static 'B

Dater 3..*5 Dater 3..*5



SPUs
SPUs

$ll our systems started off as &$D mode $ll our systems started off as &$D mode

*he only long term 3not finished this frame5 asynchronous *he only long term 3not finished this frame5 asynchronous
processing is the collision on the raw SP,s processing is the collision on the raw SP,s

De use IJob #anagerK but not all systems use it in the typical way De use IJob #anagerK but not all systems use it in the typical way
of fire and forget2 #ost of our system re:uire the SP, to be of fire and forget2 #ost of our system re:uire the SP, to be
running a particular system at the same time as the PP,2 running a particular system at the same time as the PP,2

*o ensure the SP, is doing what we want at the correct time we *o ensure the SP, is doing what we want at the correct time we
send IJob #anagerK the 0ob and use our own thin send IJob #anagerK the 0ob and use our own thin
synchroni>ation and 0ob buffering schemes using the loc"ed-line synchroni>ation and 0ob buffering schemes using the loc"ed-line
for communication for communication

48-28E total SP, utili>ation 48-28E total SP, utili>ation



&ollision $vervie'
&ollision $vervie'

'edicated 2 raw SP,s one for broad and narrow phases 'edicated 2 raw SP,s one for broad and narrow phases

De support immediate and deferred :ueries De support immediate and deferred :ueries

PP, can directly issue broad or narrow :ueries PP, can directly issue broad or narrow :ueries

Broad and narrow overlap, so narrow is processing as soon as Broad and narrow overlap, so narrow is processing as soon as
the first broad phase result is available the first broad phase result is available

*here are two "inds of deferred collision operations, standard *here are two "inds of deferred collision operations, standard
priority which has to done this frame and low priority which has priority which has to done this frame and low priority which has
until the end of the ne/t frame until the end of the ne/t frame

Immediate re:uests from the PP, are higher priority than any Immediate re:uests from the PP, are higher priority than any
deferred collision deferred collision

Getting game code to optimally use the deferred collision was an Getting game code to optimally use the deferred collision was an
issue issue

Animation $vervie'
Animation $vervie'

$ppro/ 688 Joint limit, 4= blended clips $ppro/ 688 Joint limit, 4= blended clips

.ull body animations or partials with per 0oint weights .ull body animations or partials with per 0oint weights

Stac" driven system similar to IC? Stac" driven system similar to IC?

%o blend shapes or set driven "ey support at present %o blend shapes or set driven "ey support at present

Dhile the SP, is computing the animation for a given moby the Dhile the SP, is computing the animation for a given moby the
PP, is updating the ne/t moby and computing its anim stac" PP, is updating the ne/t moby and computing its anim stac"

$nimation time is typically completely hidden, only time we stall $nimation time is typically completely hidden, only time we stall
is when waiting for the last anim to complete is when waiting for the last anim to complete

$nimation data is compressed in memory and temporarily $nimation data is compressed in memory and temporarily
decompressed before use by SP, decompressed before use by SP,

Animation $vervie'
Animation $vervie'

ow level animation system is driven by a high level Fmove9 ow level animation system is driven by a high level Fmove9
system which builds the anim stac" system which builds the anim stac"

?nd result of the animation is a set of local space matrices ?nd result of the animation is a set of local space matrices

Subset of s"eletal 0oints called Fdynamic 0oints9 which can be Subset of s"eletal 0oints called Fdynamic 0oints9 which can be
modified on post animated data physics, I+, rag doll, gameplay modified on post animated data physics, I+, rag doll, gameplay
procedural movement, etc2 operate on these procedural movement, etc2 operate on these

$ny modifications are multiplied bac" down the hierarchy only $ny modifications are multiplied bac" down the hierarchy only
for those leaves of the tree by an SP, 0ob for those leaves of the tree by an SP, 0ob

.inally all resultant local space matrices are sent to another SP, .inally all resultant local space matrices are sent to another SP,
0ob which builds the world space matrices and pushbuffer which 0ob which builds the world space matrices and pushbuffer which
uploads them to &S1 uploads them to &S1

$ll s"inning is done on the &S1 $ll s"inning is done on the &S1

The (n!
The (n!
LuestionsM
LuestionsM

You might also like