SlideShare ist ein Scribd-Unternehmen logo
1 von 39
 Filtering Approaches for Real-Time Anti-Aliasing  http://www.iryoku.com/aacourse/
Filtering Approaches for Real-Time Anti-Aliasing Anti-Aliasing Methods in CryENGINE 3 Tiago SousaR&D Principal Graphics Engineer Crytek tiago@crytek.com
CryENGINE 3 AA Requirements Orthogonal and general solutions No per-platform AA solution Play nice with HDR/Deferred techniques Sub-pixel accuracy is important for us Schimering was the biggest offender on Crysis 1 and 2 levels Crysis had imensively aliased assets: alpha tested/tiny sub-pixel details HDR makes it even worse, big range of lighting contrast/color variation Low memory footprint Cost less than 2 ms on low end GPUs Every ms counts for consoles
MSAA Troubles for this HW Generation Memory requirements  2x, 4x, etc Multiplatform + Non conventional rendering [Sousa 2011] 0 support on PS3 for FP16 (for alpha blending passes) 10 MB EDRAM on x360 + Tilling + Resolves cost overhead Alpha testing AA, requires ATOC Tone mapping should be performed per sub-sample Else noticeable wrong results on high contrast regions Too expensive for older platforms
The Quest for AA Alternatives
Temporal Anti-Aliasing (aka Motion Blur) Directional blur along screen space velocity vector [Green 2003] Delta from prev/cur screen space position, per-pixel or per vertex Image space motion blur  Main benefict: Less noticeable aliasing during movement Pt Pt-1
Temporal AA
A-Buffer SSAA [Haeberli90] Add sub-pixel jitter to camera frustum Brute force: Render scene multiple times N sub samples  N scene renders Robust and best quality Also more uses besides SSAA (TSSAA/DOF/Soft-Shadows) Base concept used for our techniques Problem: Cannot afford render scene multiple times (yet) Great for reference/marketing quality shots though
No AA
16x SSAA
Distribute A-Buffer SSAA Overframes Running at 60 fps ? Add sub-pixel jitter to camera frustum every frame Store previous/current frame and linear blend them Light-speed 2x SSAA: ~0.5 ms on current consoles 2 frames  2x SSAA, 4 frames  4x SSAA, etc But... not many reach 60 fps on consoles Lower fps results in extremelly noticeable image ghosting
Linear blending => ghosting at low fps
Minimizing Artifacts Improving blending: Reprojection Velocity vector fetches from previous frame sub-sample target Exactly same as in TAA (but single tap) Deformable geometry slightly more expensive to handle Output pixel velocity into a render target Could not affort for vegetation Problem: Disocluded regions ghosting
Using reprojection
Minimizing Artifacts (2) Disable blending if ||V|| > 0? Very rare the case when player not moving And we still want AA during camera movement Weighting using color/edge tagging ? Sub-pixel/hi frequency detail results in noticeable schimering Reprojection range clamping Pixel weight proportional to reprojection limit Eg:  fBlendW =  saturate( 1 - (fVLen / fVMaxLen) ) Coarse Depth stored in sub-sample buffer alpha channel Mask out if fVLen > fMaxVThreshold and fCurrD > fPrevD
Clamped reprojection (used in Crysis2)
Minimizing Artifacts (3) Store ||V|| in sub-sample buffer alpha channel Weight: abs(fPrevLenV – fCurrLenV) / fVMaxLen
Clamped reprojection + Velocity weighting
Example Code float fDepth = GetLinearDepth(sDepth, tcBase.xy ); float3 vPosWS = WorldViewPos.xyz + IN.vCam.xyz * fDepth; float4 vPrevPos = mul(mViewProjPrev, float4(vPosWS, 1.0 )); 	  vPrevPos /= vPrevPos.w; float2 vVelocity = vPrevPos.xy - tcBase.xy; half4 cObjVelocityParams = tex2D(sObjVelocity, tcBase.xy) ; half2 vObjVelocity = DecodeMotionVector( cObjVelocityParams ); 		vVelocity = cObjVelocityParams.w? vObjVelocity : vVelocity; float fVLenSq = dot(vVelocity.xy, vVelocity.xy) + 1e-6f; 		vVelocity /= fVLenSq; half4 cCurr = tex2D(sCurrFrame, tcBase.xy) half4 cPrev = tex2D(sPrevFrame, tcBase.xy + vVelocity * min(fVLenSq, fVMaxLen) ); half fBlendW = (0.5-0.5) * saturate(fVLenSq / fVMaxLen ); fBlendW = saturate(1- (abs(cCurr.a – cPrev.a) * fVWeightScale  ); 		OUT.Color = lerp(cCurr, cPrev, fBlendW);
2x Quincunx SSAA Improving quality with 2 sub-samples Bilinear fetch to one of sub-samples “Aproximate” 4x SSAA
2x Quincunx SSAA
Distributed A-Buffer SSAA: Caveats Not temporally stable No AA on disocluded regions Input signal changes (color/lighting), no robust solution yet Alpha blending problematic Withouth OIT, only possible to handle correctly for first hit Additional overhead Multi-GPU Additional frame latency to address For Crysis 2, we switched to Nvidia’s FXAA when in MGPU	 Schimering was again, biggest complain from MGPU users
Future Work SSAA combo with post processed AA Maybe similarly to DLAA: horizontal/vertical edges, blend taps This means at least 4 additional taps AA on disocluded regions
No AA
2x SSAA
2x Quincunx SSAA
4x SSAA
4x SSAA + EdgeAA
No AA
2x SSAA
2x Quincunx SSAA
4x SSAA
4x SSAA + EdgeAA
Distributed A-Buffer SSAA: Current Results Far from perfect, but: Orthogonal Sub-pixel accuracy Shader anti-aliasing bonus 2x Quincunx SSAA:  1 ms for consoles 0.2 ms at 1080p on pc’s 2x SSAA + edge AA: 1.7 ms 4x SSAA + edge AA: 2.2 ms 3 MB additional memory footprint
Acknowledgements Nick Kasyan,Nicolas Schulz, Vaclav Kyba, Michael Kopietz, Carsten Wenzel, Vladimir Kajalin, Andrey Konich, Ivo Zoltan Frey Jorge Jimenez, Diego Guitierrez, Naty Hoffman And to the entire Crytek team
Further Readings Haeberli, P, Akeley, K “The Accumulation Buffer: Hardware Support for High-Quality Rendering”, 1990 Siggraph’96 Course , Blythe, D et al “Programming with OpenGL: Advanced Rendering”, 1996 Green, S “Stupid OpenGL Shader Tricks”, 2003 Sousa, T. “Crysis Next Gen Effects”, 2008 Swoboda, M “Deferred Rendering in FrameRanger”, 2009 Yang, G et al “Amortized Super Sampling”, 2010 Binks, D. “Dynamic Resolution Rendering”, 2011 Sousa, T., Kasyan, N. and Schulz, N. “Secrets of the CryENGINE 3 Technology”, 2011
Questions ? tiago@crytek.com twitter: crytek_tiago
Bonus: Marketing Screenshots
Bonus: Marketing Screenshots Always some trickery On CryENGINE 2 rendered multiple tiles at big resolutions and downsampled to get SSAA On CryENGINE 3 distributed  SSAA with many samples Random sub-pixel jitter Almost perfect SSAA All Crysis 2 marketing shots used this variation

Weitere ähnliche Inhalte

Was ist angesagt?

Five Rendering Ideas from Battlefield 3 & Need For Speed: The Run
Five Rendering Ideas from Battlefield 3 & Need For Speed: The RunFive Rendering Ideas from Battlefield 3 & Need For Speed: The Run
Five Rendering Ideas from Battlefield 3 & Need For Speed: The RunElectronic Arts / DICE
 
A Bit More Deferred Cry Engine3
A Bit More Deferred   Cry Engine3A Bit More Deferred   Cry Engine3
A Bit More Deferred Cry Engine3guest11b095
 
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Johan Andersson
 
Practical Occlusion Culling in Killzone 3
Practical Occlusion Culling in Killzone 3Practical Occlusion Culling in Killzone 3
Practical Occlusion Culling in Killzone 3Guerrilla
 
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open ProblemsHPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open ProblemsElectronic Arts / DICE
 
Efficient Rendering with DirectX* 12 on Intel® Graphics
Efficient Rendering with DirectX* 12 on Intel® GraphicsEfficient Rendering with DirectX* 12 on Intel® Graphics
Efficient Rendering with DirectX* 12 on Intel® GraphicsGael Hofemeier
 
Penner pre-integrated skin rendering (siggraph 2011 advances in real-time r...
Penner   pre-integrated skin rendering (siggraph 2011 advances in real-time r...Penner   pre-integrated skin rendering (siggraph 2011 advances in real-time r...
Penner pre-integrated skin rendering (siggraph 2011 advances in real-time r...JP Lee
 
Stable SSAO in Battlefield 3 with Selective Temporal Filtering
Stable SSAO in Battlefield 3 with Selective Temporal FilteringStable SSAO in Battlefield 3 with Selective Temporal Filtering
Stable SSAO in Battlefield 3 with Selective Temporal FilteringElectronic Arts / DICE
 
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...Johan Andersson
 
Destruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance FieldsDestruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance FieldsElectronic Arts / DICE
 
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...Electronic Arts / DICE
 
Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)Tiago Sousa
 
Progressive Lightmapper: An Introduction to Lightmapping in Unity
Progressive Lightmapper: An Introduction to Lightmapping in UnityProgressive Lightmapper: An Introduction to Lightmapping in Unity
Progressive Lightmapper: An Introduction to Lightmapping in UnityUnity Technologies
 
Checkerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOCCheckerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOCQLOC
 
Lighting Shading by John Hable
Lighting Shading by John HableLighting Shading by John Hable
Lighting Shading by John HableNaughty Dog
 
Past, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in GamesPast, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in GamesColin Barré-Brisebois
 
Paris Master Class 2011 - 07 Dynamic Global Illumination
Paris Master Class 2011 - 07 Dynamic Global IlluminationParis Master Class 2011 - 07 Dynamic Global Illumination
Paris Master Class 2011 - 07 Dynamic Global IlluminationWolfgang Engel
 
Moving Frostbite to Physically Based Rendering
Moving Frostbite to Physically Based RenderingMoving Frostbite to Physically Based Rendering
Moving Frostbite to Physically Based RenderingElectronic Arts / DICE
 

Was ist angesagt? (20)

Five Rendering Ideas from Battlefield 3 & Need For Speed: The Run
Five Rendering Ideas from Battlefield 3 & Need For Speed: The RunFive Rendering Ideas from Battlefield 3 & Need For Speed: The Run
Five Rendering Ideas from Battlefield 3 & Need For Speed: The Run
 
A Bit More Deferred Cry Engine3
A Bit More Deferred   Cry Engine3A Bit More Deferred   Cry Engine3
A Bit More Deferred Cry Engine3
 
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
 
Practical Occlusion Culling in Killzone 3
Practical Occlusion Culling in Killzone 3Practical Occlusion Culling in Killzone 3
Practical Occlusion Culling in Killzone 3
 
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open ProblemsHPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems
 
Efficient Rendering with DirectX* 12 on Intel® Graphics
Efficient Rendering with DirectX* 12 on Intel® GraphicsEfficient Rendering with DirectX* 12 on Intel® Graphics
Efficient Rendering with DirectX* 12 on Intel® Graphics
 
Penner pre-integrated skin rendering (siggraph 2011 advances in real-time r...
Penner   pre-integrated skin rendering (siggraph 2011 advances in real-time r...Penner   pre-integrated skin rendering (siggraph 2011 advances in real-time r...
Penner pre-integrated skin rendering (siggraph 2011 advances in real-time r...
 
Stable SSAO in Battlefield 3 with Selective Temporal Filtering
Stable SSAO in Battlefield 3 with Selective Temporal FilteringStable SSAO in Battlefield 3 with Selective Temporal Filtering
Stable SSAO in Battlefield 3 with Selective Temporal Filtering
 
Stochastic Screen-Space Reflections
Stochastic Screen-Space ReflectionsStochastic Screen-Space Reflections
Stochastic Screen-Space Reflections
 
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
The Intersection of Game Engines & GPUs: Current & Future (Graphics Hardware ...
 
Destruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance FieldsDestruction Masking in Frostbite 2 using Volume Distance Fields
Destruction Masking in Frostbite 2 using Volume Distance Fields
 
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
 
Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)
 
Progressive Lightmapper: An Introduction to Lightmapping in Unity
Progressive Lightmapper: An Introduction to Lightmapping in UnityProgressive Lightmapper: An Introduction to Lightmapping in Unity
Progressive Lightmapper: An Introduction to Lightmapping in Unity
 
Checkerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOCCheckerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOC
 
Lighting Shading by John Hable
Lighting Shading by John HableLighting Shading by John Hable
Lighting Shading by John Hable
 
Past, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in GamesPast, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in Games
 
Paris Master Class 2011 - 07 Dynamic Global Illumination
Paris Master Class 2011 - 07 Dynamic Global IlluminationParis Master Class 2011 - 07 Dynamic Global Illumination
Paris Master Class 2011 - 07 Dynamic Global Illumination
 
Moving Frostbite to Physically Based Rendering
Moving Frostbite to Physically Based RenderingMoving Frostbite to Physically Based Rendering
Moving Frostbite to Physically Based Rendering
 
Lighting you up in Battlefield 3
Lighting you up in Battlefield 3Lighting you up in Battlefield 3
Lighting you up in Battlefield 3
 

Andere mochten auch

Smaa : enhanced morphological anti-aliasing
Smaa : enhanced morphological anti-aliasingSmaa : enhanced morphological anti-aliasing
Smaa : enhanced morphological anti-aliasingJaeyun Lee
 
Te 4 pulse_modulation
Te 4 pulse_modulationTe 4 pulse_modulation
Te 4 pulse_modulationShohan Ean
 
CS 354 Blending, Compositing, Anti-aliasing
CS 354 Blending, Compositing, Anti-aliasingCS 354 Blending, Compositing, Anti-aliasing
CS 354 Blending, Compositing, Anti-aliasingMark Kilgard
 
CryENGINE 3 Rendering Techniques
CryENGINE 3 Rendering TechniquesCryENGINE 3 Rendering Techniques
CryENGINE 3 Rendering TechniquesTiago Sousa
 
Thesis, Image Registration Methods
Thesis, Image Registration MethodsThesis, Image Registration Methods
Thesis, Image Registration Methodsbalanou
 
Computer Graphics Notes
Computer Graphics NotesComputer Graphics Notes
Computer Graphics NotesGurpreet singh
 
GS-4133, CRYENGINE and AMD bringing the next generation now, by Sean Tracey
GS-4133, CRYENGINE and AMD bringing the next generation now, by Sean TraceyGS-4133, CRYENGINE and AMD bringing the next generation now, by Sean Tracey
GS-4133, CRYENGINE and AMD bringing the next generation now, by Sean TraceyAMD Developer Central
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsbhaveshbunk
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4PrathimaBaliga
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output PrimitivesRenita Santhmayora
 

Andere mochten auch (14)

Lecture15 anti aliasing
Lecture15 anti aliasingLecture15 anti aliasing
Lecture15 anti aliasing
 
Anti aliasing Computer Graphics
Anti aliasing Computer GraphicsAnti aliasing Computer Graphics
Anti aliasing Computer Graphics
 
Smaa : enhanced morphological anti-aliasing
Smaa : enhanced morphological anti-aliasingSmaa : enhanced morphological anti-aliasing
Smaa : enhanced morphological anti-aliasing
 
Pluse amplitude modulatiion
Pluse amplitude modulatiionPluse amplitude modulatiion
Pluse amplitude modulatiion
 
Te 4 pulse_modulation
Te 4 pulse_modulationTe 4 pulse_modulation
Te 4 pulse_modulation
 
CS 354 Blending, Compositing, Anti-aliasing
CS 354 Blending, Compositing, Anti-aliasingCS 354 Blending, Compositing, Anti-aliasing
CS 354 Blending, Compositing, Anti-aliasing
 
CryENGINE 3 Rendering Techniques
CryENGINE 3 Rendering TechniquesCryENGINE 3 Rendering Techniques
CryENGINE 3 Rendering Techniques
 
Thesis, Image Registration Methods
Thesis, Image Registration MethodsThesis, Image Registration Methods
Thesis, Image Registration Methods
 
Computer Graphics Notes
Computer Graphics NotesComputer Graphics Notes
Computer Graphics Notes
 
GS-4133, CRYENGINE and AMD bringing the next generation now, by Sean Tracey
GS-4133, CRYENGINE and AMD bringing the next generation now, by Sean TraceyGS-4133, CRYENGINE and AMD bringing the next generation now, by Sean Tracey
GS-4133, CRYENGINE and AMD bringing the next generation now, by Sean Tracey
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Anti aliasing
Anti aliasingAnti aliasing
Anti aliasing
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 

Ähnlich wie Anti-Aliasing Methods in CryENGINE 3

Crysis 2-key-rendering-features
Crysis 2-key-rendering-featuresCrysis 2-key-rendering-features
Crysis 2-key-rendering-featuresRaimundo Renato
 
Look Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus MobileLook Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus MobileUnity Technologies
 
Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360VIKAS SINGH BHADOURIA
 
NVIDIA Graphics, Cg, and Transparency
NVIDIA Graphics, Cg, and TransparencyNVIDIA Graphics, Cg, and Transparency
NVIDIA Graphics, Cg, and TransparencyMark Kilgard
 
new_age_graphics_android_x86
new_age_graphics_android_x86new_age_graphics_android_x86
new_age_graphics_android_x86Droidcon Berlin
 
Evolution of the modern graphics architectures with a focus on GPUs | Turing1...
Evolution of the modern graphics architectures with a focus on GPUs | Turing1...Evolution of the modern graphics architectures with a focus on GPUs | Turing1...
Evolution of the modern graphics architectures with a focus on GPUs | Turing1...Persistent Systems Ltd.
 
Optimizing the graphics pipeline with compute
Optimizing the graphics pipeline with computeOptimizing the graphics pipeline with compute
Optimizing the graphics pipeline with computeWuBinbo
 
Unity AMD FSR - SIGGRAPH 2021.pptx
Unity AMD FSR - SIGGRAPH 2021.pptxUnity AMD FSR - SIGGRAPH 2021.pptx
Unity AMD FSR - SIGGRAPH 2021.pptxssuser2c3c67
 
The Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next StepsThe Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next StepsJohan Andersson
 
Morphological antialiasing
Morphological antialiasingMorphological antialiasing
Morphological antialiasingChung-Yuan Lee
 
Threading Successes 06 Allegorithmic
Threading Successes 06   AllegorithmicThreading Successes 06   Allegorithmic
Threading Successes 06 Allegorithmicguest40fc7cd
 
GS-4152, AMD’s Radeon R9-290X, One Big dGPU, by Michael Mantor
GS-4152, AMD’s Radeon R9-290X, One Big dGPU, by Michael MantorGS-4152, AMD’s Radeon R9-290X, One Big dGPU, by Michael Mantor
GS-4152, AMD’s Radeon R9-290X, One Big dGPU, by Michael MantorAMD Developer Central
 
Hdr Meets Black And White 2
Hdr Meets Black And White 2 Hdr Meets Black And White 2
Hdr Meets Black And White 2 Francesco Carucci
 
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...Colin Barré-Brisebois
 
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)Johan Andersson
 
graphics processing unit ppt
graphics processing unit pptgraphics processing unit ppt
graphics processing unit pptNitesh Dubey
 
The technology behind_the_elemental_demo_16x9-1248544805
The technology behind_the_elemental_demo_16x9-1248544805The technology behind_the_elemental_demo_16x9-1248544805
The technology behind_the_elemental_demo_16x9-1248544805mistercteam
 

Ähnlich wie Anti-Aliasing Methods in CryENGINE 3 (20)

Crysis 2-key-rendering-features
Crysis 2-key-rendering-featuresCrysis 2-key-rendering-features
Crysis 2-key-rendering-features
 
Look Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus MobileLook Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus Mobile
 
Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360Next generation graphics programming on xbox 360
Next generation graphics programming on xbox 360
 
NVIDIA Graphics, Cg, and Transparency
NVIDIA Graphics, Cg, and TransparencyNVIDIA Graphics, Cg, and Transparency
NVIDIA Graphics, Cg, and Transparency
 
2.Hardware.ppt
2.Hardware.ppt2.Hardware.ppt
2.Hardware.ppt
 
new_age_graphics_android_x86
new_age_graphics_android_x86new_age_graphics_android_x86
new_age_graphics_android_x86
 
Xbox
XboxXbox
Xbox
 
Evolution of the modern graphics architectures with a focus on GPUs | Turing1...
Evolution of the modern graphics architectures with a focus on GPUs | Turing1...Evolution of the modern graphics architectures with a focus on GPUs | Turing1...
Evolution of the modern graphics architectures with a focus on GPUs | Turing1...
 
Optimizing the graphics pipeline with compute
Optimizing the graphics pipeline with computeOptimizing the graphics pipeline with compute
Optimizing the graphics pipeline with compute
 
Unity AMD FSR - SIGGRAPH 2021.pptx
Unity AMD FSR - SIGGRAPH 2021.pptxUnity AMD FSR - SIGGRAPH 2021.pptx
Unity AMD FSR - SIGGRAPH 2021.pptx
 
The Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next StepsThe Rendering Pipeline - Challenges & Next Steps
The Rendering Pipeline - Challenges & Next Steps
 
Morphological antialiasing
Morphological antialiasingMorphological antialiasing
Morphological antialiasing
 
Threading Successes 06 Allegorithmic
Threading Successes 06   AllegorithmicThreading Successes 06   Allegorithmic
Threading Successes 06 Allegorithmic
 
GS-4152, AMD’s Radeon R9-290X, One Big dGPU, by Michael Mantor
GS-4152, AMD’s Radeon R9-290X, One Big dGPU, by Michael MantorGS-4152, AMD’s Radeon R9-290X, One Big dGPU, by Michael Mantor
GS-4152, AMD’s Radeon R9-290X, One Big dGPU, by Michael Mantor
 
Hdr Meets Black And White 2
Hdr Meets Black And White 2 Hdr Meets Black And White 2
Hdr Meets Black And White 2
 
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
 
DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3
 
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
 
graphics processing unit ppt
graphics processing unit pptgraphics processing unit ppt
graphics processing unit ppt
 
The technology behind_the_elemental_demo_16x9-1248544805
The technology behind_the_elemental_demo_16x9-1248544805The technology behind_the_elemental_demo_16x9-1248544805
The technology behind_the_elemental_demo_16x9-1248544805
 

Anti-Aliasing Methods in CryENGINE 3

  • 1. Filtering Approaches for Real-Time Anti-Aliasing http://www.iryoku.com/aacourse/
  • 2. Filtering Approaches for Real-Time Anti-Aliasing Anti-Aliasing Methods in CryENGINE 3 Tiago SousaR&D Principal Graphics Engineer Crytek tiago@crytek.com
  • 3. CryENGINE 3 AA Requirements Orthogonal and general solutions No per-platform AA solution Play nice with HDR/Deferred techniques Sub-pixel accuracy is important for us Schimering was the biggest offender on Crysis 1 and 2 levels Crysis had imensively aliased assets: alpha tested/tiny sub-pixel details HDR makes it even worse, big range of lighting contrast/color variation Low memory footprint Cost less than 2 ms on low end GPUs Every ms counts for consoles
  • 4. MSAA Troubles for this HW Generation Memory requirements 2x, 4x, etc Multiplatform + Non conventional rendering [Sousa 2011] 0 support on PS3 for FP16 (for alpha blending passes) 10 MB EDRAM on x360 + Tilling + Resolves cost overhead Alpha testing AA, requires ATOC Tone mapping should be performed per sub-sample Else noticeable wrong results on high contrast regions Too expensive for older platforms
  • 5. The Quest for AA Alternatives
  • 6. Temporal Anti-Aliasing (aka Motion Blur) Directional blur along screen space velocity vector [Green 2003] Delta from prev/cur screen space position, per-pixel or per vertex Image space motion blur Main benefict: Less noticeable aliasing during movement Pt Pt-1
  • 8. A-Buffer SSAA [Haeberli90] Add sub-pixel jitter to camera frustum Brute force: Render scene multiple times N sub samples  N scene renders Robust and best quality Also more uses besides SSAA (TSSAA/DOF/Soft-Shadows) Base concept used for our techniques Problem: Cannot afford render scene multiple times (yet) Great for reference/marketing quality shots though
  • 11. Distribute A-Buffer SSAA Overframes Running at 60 fps ? Add sub-pixel jitter to camera frustum every frame Store previous/current frame and linear blend them Light-speed 2x SSAA: ~0.5 ms on current consoles 2 frames  2x SSAA, 4 frames  4x SSAA, etc But... not many reach 60 fps on consoles Lower fps results in extremelly noticeable image ghosting
  • 12. Linear blending => ghosting at low fps
  • 13. Minimizing Artifacts Improving blending: Reprojection Velocity vector fetches from previous frame sub-sample target Exactly same as in TAA (but single tap) Deformable geometry slightly more expensive to handle Output pixel velocity into a render target Could not affort for vegetation Problem: Disocluded regions ghosting
  • 15. Minimizing Artifacts (2) Disable blending if ||V|| > 0? Very rare the case when player not moving And we still want AA during camera movement Weighting using color/edge tagging ? Sub-pixel/hi frequency detail results in noticeable schimering Reprojection range clamping Pixel weight proportional to reprojection limit Eg: fBlendW = saturate( 1 - (fVLen / fVMaxLen) ) Coarse Depth stored in sub-sample buffer alpha channel Mask out if fVLen > fMaxVThreshold and fCurrD > fPrevD
  • 17. Minimizing Artifacts (3) Store ||V|| in sub-sample buffer alpha channel Weight: abs(fPrevLenV – fCurrLenV) / fVMaxLen
  • 18. Clamped reprojection + Velocity weighting
  • 19. Example Code float fDepth = GetLinearDepth(sDepth, tcBase.xy ); float3 vPosWS = WorldViewPos.xyz + IN.vCam.xyz * fDepth; float4 vPrevPos = mul(mViewProjPrev, float4(vPosWS, 1.0 )); vPrevPos /= vPrevPos.w; float2 vVelocity = vPrevPos.xy - tcBase.xy; half4 cObjVelocityParams = tex2D(sObjVelocity, tcBase.xy) ; half2 vObjVelocity = DecodeMotionVector( cObjVelocityParams ); vVelocity = cObjVelocityParams.w? vObjVelocity : vVelocity; float fVLenSq = dot(vVelocity.xy, vVelocity.xy) + 1e-6f; vVelocity /= fVLenSq; half4 cCurr = tex2D(sCurrFrame, tcBase.xy) half4 cPrev = tex2D(sPrevFrame, tcBase.xy + vVelocity * min(fVLenSq, fVMaxLen) ); half fBlendW = (0.5-0.5) * saturate(fVLenSq / fVMaxLen ); fBlendW = saturate(1- (abs(cCurr.a – cPrev.a) * fVWeightScale ); OUT.Color = lerp(cCurr, cPrev, fBlendW);
  • 20. 2x Quincunx SSAA Improving quality with 2 sub-samples Bilinear fetch to one of sub-samples “Aproximate” 4x SSAA
  • 22. Distributed A-Buffer SSAA: Caveats Not temporally stable No AA on disocluded regions Input signal changes (color/lighting), no robust solution yet Alpha blending problematic Withouth OIT, only possible to handle correctly for first hit Additional overhead Multi-GPU Additional frame latency to address For Crysis 2, we switched to Nvidia’s FXAA when in MGPU Schimering was again, biggest complain from MGPU users
  • 23. Future Work SSAA combo with post processed AA Maybe similarly to DLAA: horizontal/vertical edges, blend taps This means at least 4 additional taps AA on disocluded regions
  • 24. No AA
  • 28. 4x SSAA + EdgeAA
  • 29. No AA
  • 33. 4x SSAA + EdgeAA
  • 34. Distributed A-Buffer SSAA: Current Results Far from perfect, but: Orthogonal Sub-pixel accuracy Shader anti-aliasing bonus 2x Quincunx SSAA: 1 ms for consoles 0.2 ms at 1080p on pc’s 2x SSAA + edge AA: 1.7 ms 4x SSAA + edge AA: 2.2 ms 3 MB additional memory footprint
  • 35. Acknowledgements Nick Kasyan,Nicolas Schulz, Vaclav Kyba, Michael Kopietz, Carsten Wenzel, Vladimir Kajalin, Andrey Konich, Ivo Zoltan Frey Jorge Jimenez, Diego Guitierrez, Naty Hoffman And to the entire Crytek team
  • 36. Further Readings Haeberli, P, Akeley, K “The Accumulation Buffer: Hardware Support for High-Quality Rendering”, 1990 Siggraph’96 Course , Blythe, D et al “Programming with OpenGL: Advanced Rendering”, 1996 Green, S “Stupid OpenGL Shader Tricks”, 2003 Sousa, T. “Crysis Next Gen Effects”, 2008 Swoboda, M “Deferred Rendering in FrameRanger”, 2009 Yang, G et al “Amortized Super Sampling”, 2010 Binks, D. “Dynamic Resolution Rendering”, 2011 Sousa, T., Kasyan, N. and Schulz, N. “Secrets of the CryENGINE 3 Technology”, 2011
  • 37. Questions ? tiago@crytek.com twitter: crytek_tiago
  • 39. Bonus: Marketing Screenshots Always some trickery On CryENGINE 2 rendered multiple tiles at big resolutions and downsampled to get SSAA On CryENGINE 3 distributed SSAA with many samples Random sub-pixel jitter Almost perfect SSAA All Crysis 2 marketing shots used this variation

Hinweis der Redaktion

  1. Multitude of workarounds and added complexityEach platform with its own solution, workarounds and optimizationsPerformance costFor current Gen, situation doens’t look promising...Minimal G-BufferRGBA8 World Space BF Normals + GlossinessReadback Z24S8 Depth + Stencil for tagging interior areasDeferred lighting buffersXbox 360: 2x RGB10F resolved to RGB10A2 for performance/memoryPS3: 2x RGBA8 encoded in RGBKPC: 2x FP16Scene bufferX360: RGB10F resolved to FP16 for performancePS3: RGBA8 encoded in RGBK for opaque, FP16 for transparentsPC: FP16X360: 28 MB; PS3: 31.5MB; PC: 49 MB at 720p, 110 MB at 1080p and so on.
  2. Increasingly popularity since Crysis 1 and KZ2Aproximated as directional blur along screen space velocity vectorDelta from prev/cur screen space position, per-pixel or per vertex Added bonus: Great cinematic lookUser for all platforms
  3. Alternatively, the usual approach of rendering higher resolution and downscale
  4. Used in few older 60 fps games (DMC4?) , but who was first?And even at 60 fps, still noticeable ghosting
  5. Strafing is the worst case, we’ll use if for images
  6. Disable accumulation if ||V|| > 0?Very rare the case when player not movingAnd we still want AA during camera movementWeighting using color ?Sub-pixel/hi frequency detail results in noticeable schimeringReprojection range clamping ? (used for Crysis 2)Pixel weight proportional to reprojection limitEg: fBlendW = saturate( 1 - (fVLen / fVMaxLen) )Coarse Depth stored in sub-sample buffer alpha channelMask out if fVLen > fMaxVThreshold and fCurrD > fPrevD8 bit insufficient to cover large range, limited to nearby
  7. Missing pretty pictures
  8. If time allows