Professional Documents
Culture Documents
Main office:
Germany Frankfurt
More studios:
Kiev, Budapest, Sofia, Nottingham, Seoul
English as company language
30+ nationalities
CryEngine 1: PC only (Far Cry )
CryEngine 2: PC only (Crysis )
CryEngine 3: PC, XBox360, PS3
(announced GDC09)
32/64 Bit, WinXP/Vista, DX9/10, Multi CPU/GPU
WYSIWYP
ResourceCompiler
Source asset -> Platform specific
Direct Light: Shadow mapping
Indirect Light (AO): SSAO / RAM / ...
No precomputed lighting
Production time saver, Memory, Consistency, Dynamic content
bershaders
[Mittring07]
Goals after CryEngine 2
PS3 / XBox360
GPU, CPU, memory
Improve streaming
Improve multithreading
Improve lighting
More predictable performance
Tackle the shader combination issue
What is the shader
combination issue?
bershader is one shader with many features
(e.g. 0..4 lights, light types, CM reflection, fog, detail texture,
normalmap, specular texture)
Compiling all possible permutations is a
memory, production and performance problem
Usual solutions:
dynamic branching / separating into multiple passes / reducing
combinations and accepting less functionality and less
performance
Asynchronous shader compiling
Distributed Job System to compile the shader cache
Why Deferred Rendering?
Rendering is a multi-dimensional query:
View x Geometry x Material x Light
Main use:
Deferred shadows, Per pixel fog
Additionally:
Soft Z clipped Particles, Motion Blur, Beach/Ocean, EdgeAA,
Sun Rays, SSAO, Fake lights, 2.5D TerrainAO
SSAO ShadowMask
Deferred Lighting in CryEngine 3
Z (native) Normal Specular Power
Passes:
1) Forward GBuffer generation
2) Deferred light accumulation into texture (Phong)
3) Forward shading with light accumulation texture => No deferred shading
Deferred Lighting*
+ Multiple light primitives are possible
+ even Image Based Lighting (IBL)
+ easy to extend
The following pictures show lighting with two differently coloured lights:
Diffuse RGB
Specular RGB
High Quality
(left)
Diffuse RGB
Specular Strength
Fast Rendering
(right)
Difference often
neglectable (depends
on environment)
Storing normals in the GBuffer
XYZ world space
8 bit: problematic with extreme reflections/specular
10 bit: good, but what about specular power and PS3
=> Problematic
[Lee09] [Lob09]
Alternative: VS Normal in 2 scalars
-1..1 => -1..1
Normal to GBufffer:
G=normalize(N.xy)*sqrt(N.z*0.5+0.5)
GBuffer to Normal:
N.z=length2(G.xy)*2-1
N.xy=normalize(G.xy)*sqrt(1-N.z*N.z)
+ more precision where it matters (bright part)
+ framebuffer blending friendly
+ no z reconstruction issues
- wasted area
- more ALU than WS
=> still, WS normals are faster
Improved SSAO (with normals)
Light rasterization in
2D (Rectangle) or 3D (Convex Object)
2D
+ cheap WS position reconstruction (Interpolator+MAD)
+ Combining multiple lights
- Stencil prepass (if not fullscreen)
- Coarse blocks can be rejected based on z min/max
3D
+ Z buffer
+ tighter bounding object (less pixels to process)
Depth bounds test (only on some HW)
Deferred Light Types 1/3:
Directional light
optional with cloud shadows, multiple shadowmaps
Point/Projector lights
optional with projector texture
Procedural Caustics
(before this was multi-pass, one drawcall for each object under water
including terrain)
black ambient
(to emphasize where GI
affects the image)
color bleeding
bump without light
fully dynamic
real-time
Global Illumination on
* brightened up for better display
Global Illumination
Something missing?
Transparency
=> falling back to well known techniques:
Per pixel global fog and fog volumes (deferred)
Back to front sorted alpha transparent objects
Volume texture clouds, Imposter clouds, Distance clouds
Particle systems avoiding per particle sorting
Anti-aliasing
=> Nasty but possible
EdgeAA,
... we work on it
References
[Mittring07] Finding Next Gen CryEngine2
Siggraph 2007, Martin Mittring
http://ati.amd.com/developer/gdc/2007/mittring-finding_nextgen_cryengine2(siggraph07).pdf
[Engel08] The Light Pre-Pass Renderer
ShaderX7, Wolfgang Engel
http://diaryofagraphicsprogrammer.blogspot.com/2008/03/light-pre-pass-renderer.html
[Lee09a] Prelighting
Mark Lee
http://www.insomniacgames.com/tech/articles/0209/files/prelighting.pdf
[Lee09b] Pre-lighting in Resistance 2
GDC 2009, Mark Lee
http://www.gdconf.com/conference/Tutorial%20Handouts/200_insomniac/gdc09_insomniac_prelighting.pdf
[Geldreich09] Deferred Lighting and Shading
GDC 2009, Rich Geldreich, Matt Pritchard, John Brooks
http://archive.gdconf.com/gdc_2004/pritchard_matt.ppt
[Shish05] Deferred Shading in S.T.A.L.K.E.R.
GPU Gems 2, Oles Shishkovtsov
http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter09.html
[Lob09] S.T.A.L.K.E.R : Clear Sky a showcase for Direct3D 10.0/1
GDC 2009, Igor A. Lobanchikov, Holger Gruen
http://www.gdconf.com/conference/Tutorial%20Handouts/100_Advanced%20Visual%20Effects%20with%20Direct3D/100_Handout%202.pdf