1 / 29

Post-Processing Pipeline GDC March 2nd, 2011 by Michael Alling

Post-Processing Pipeline GDC March 2nd, 2011 by Michael Alling. Goal. Simulate a real camera for PostFX Real Camera Effects Real Camera Controls Focus Position (Depth of Field) Focal Length (Zoom) ISO Speed Aperture (F-Stop) Shutter Angle (Shutter Speed). Intro to Camera Basics.

wilda
Download Presentation

Post-Processing Pipeline GDC March 2nd, 2011 by Michael Alling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Post-Processing PipelineGDC March 2nd, 2011by Michael Alling

  2. Goal • Simulate a real camera for PostFX • Real Camera Effects • Real Camera Controls • Focus Position (Depth of Field) • Focal Length (Zoom) • ISO Speed • Aperture (F-Stop) • Shutter Angle (Shutter Speed)

  3. Intro to Camera Basics • F-Stop (Aperture) • Determines size of opening in camera • Affects how much light comes in • Affects depth of field • Affects bokeh shape

  4. Intro to Camera Basics • Depth of Field • The area in focus

  5. Intro to Camera Basics • ISO Speed • How fast film reacts to light • More reactive film is noisy • Less reactive film absorbs less light over time • Shutter Speed • Time frame is exposed to light • Focal Length • Distance of one lens from another • Creates zoom • Affects depth of field size • Changing the focus position changes the focal length very slightly

  6. Pipeline • Reduce • Adapt Camera • DOF Blur • Upsample • Final Pass

  7. Start

  8. Reduction • Reduce the scene to a size that will balance performance and quality

  9. Reduction

  10. Reduction

  11. Camera Adaptation • Convert reduced texture to log luminance • Reduce to 1x1 and store in a history texture • Average the history

  12. Camera Adaptation • Use this average luminance to calculate the four main variables • Input: ISO Speed, Shutter Speed, Aperture Size, Average Luminance • Output: ISO Speed, Shutter Speed, Aperture Size, Exposure • Aperture^2 / Shutter Speed = Average Luminance * ISO Speed / 12.5 • Try to keep as much of the calculations on the GPU as possible

  13. Depth of Field • Used physically based equations to control DOF blur size • Use the aperture size (from previous pass) and focus position • Blur the reduced buffer based on depth using a 7x7 blur that simulates a circle (bokeh) • Gaussian and box filters do not simulate bokeh [Gotanda] • Upsample the blurred image

  14. Depth of Field Blur

  15. Upsample

  16. Upsample

  17. Final Pass • Generate blur size and lerp between blurred image and the original image • Resolve MSAA afterward

  18. Camera controls • Use focal length, aperture size, and focus position controls to generate blur size float GetRangeCoefficient( float focalLength, float fStop, float focusDist ){ //http://en.wikipedia.org/wiki/Circle_of_confusion return (focalLength * focalLength) / (fStop * (focusDist – focalLength));}float GetBlurSize( float depth, float focalLength, float fStop, float focusDist, float blurScale ){ //http://en.wikipedia.org/wiki/Circle_of_confusion float factor = abs( depth - focusDist ) / depth; float rangeC = GetRangeCoefficient( focalLength, fStop, focusDist ); float scale = blurScale; float result = abs( scale * factor * rangeC ); //prevents artifacts from the algorithm (you probably don't need) return min( result, 20.0f ); //can't be lower than 0 since abs()}

  19. F-Stop 0.5

  20. F-Stop 2

  21. F-Stop 5.6

  22. F-Stop 64

  23. Focal Length and Focus Distance • Increasing focal length zooms and crunches depth of field (area in focus) • Changing focus distance causes... • Focal length to change slightly which causes fov to change slightly • Depth of field to crunch

  24. FOV Change with Focus Position

  25. FOV Change with Focus Position

  26. Misc • Remember to convert world coordinates into meters or nothing will looked scaled correctly • Can reuse reduced buffer for bloom, scotopic vision, etc. • If tonemapping, remember to tonemap then resolve MSAA [Persson]

  27. References • Useful information: http://en.wikipedia.org/wiki/Circle_of_confusion http://en.wikipedia.org/wiki/Focal_length http://en.wikipedia.org/wiki/Depth_of_field http://en.wikipedia.org/wiki/Aperture http://en.wikipedia.org/wiki/Shutter_angle http://en.wikipedia.org/wiki/Iso_speed http://en.wikipedia.org/wiki/Exposure_value

  28. References [Engel] Wolfgang Engel, "High-Dynamic Range Rendering", http://wiki.gamedev.net/index.php/D3DBook:High-Dynamic_Range_Rendering [Persson] Emil Persson, “Deferred Shading 2”, http://www.humus.name/index.php?page=3D [Gotanda] Yoshiharu Gotanda, "Star Ocean 4: Flexible Shader Management and Post-processing", http://research.tri-ace.com/Data/SO4_flexible_shader_managment_and_postprocessing.ppt

  29. Finish

More Related