Pyramid Algorithm Framework for Real-Time Image
Effects in Game Engines
Tuesday 3rd
May, 2016
Adrià Arbués Sangüesa - Andreea-Daniela Ene - Nicolai Krogh
Jørgensen -Christian Aagaard Larsen - Daniel Michelsanti - Martin
Kraus
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Agenda
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
2 Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Introduction
Blur
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
3 Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Introduction
Convolutional Methods
∗ =
k ✕ k
Gaussian Filter
N ✕ N
Input Image
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
4 Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Introduction
Convolutional Methods
∗ =
k ✕ k
Gaussian Filter
2N ✕ 2N
Input Image
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
5 Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Introduction
Convolutional Methods
In order to have the same effect: double the size of the
kernel.
Complexity: O(N2
× k2
)
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
6 Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Pyramid Methods
How to reduce the complexity?
Pyramid:
Linear complexity on the number of pixels of the input
image [5].
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
7 Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Pyramid Methods
Analysis Synthesis
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
8 Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Pyramid Methods
Analysis Synthesis
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
9 Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Motivation
No built-in support to use pyramid methods in many game
engines.
Goal: build a framework to make pyramid methods easily
accessible.
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
10 Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Framework
Game Engine
Global game engine market share:
Unity Closest competitor Others
Figure: [4]
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
11 Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Framework
Structure
Frame_1
Analysis List
Synthesis Dictionary
Key_1 Frame_1
Key_2 Frame_2
… …
Master Dictionary
Key_1 Synthesis_1
… …
Synthesis Dictionary
Key_n Synthesis_n
1024 x 1024
512 x 512
256 x 256
…
32 x 32
2048 x 2048
1024 x 1024
Generate
non power of two
resolution texture
1080 x 1920
512 x 512
Generate
synthesis
list
Synthesis List
1080 x 1920
Screen
Generate
analysis list
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
12 Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Framework
Effects
Figure: [1], [2], [3]
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
13 Blur
Bloom
Depth of Field
Results
Conclusions
References
Appendices
Framework
Blur
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
14 Bloom
Depth of Field
Results
Conclusions
References
Appendices
Framework
Bloom
A
BC
A: Bright colors extraction
B: Pyramidal blur
C: Combination of the textures
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
15 Depth of Field
Results
Conclusions
References
Appendices
Framework
Depth of Field
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
16 Depth of Field
Results
Conclusions
References
Appendices
Framework
Depth of Field
FD
A A
2 FS
FCP
1024 x 1024
512 x 512
256 x 256
…
32 x 32
2048 x 2048 2048 x 2048
1024 x 1024 1024 x 1024
2048 x 2048
512 x 512
1080 x 1920
Analysis Synthesis 1 Synthesis 2 Synthesis 3Screen
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
17 Results
Conclusions
References
Appendices
Results
Figure: Performance of the Framework (ms)
Figure: VRAM Usage (MB)
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
18 Conclusions
References
Appendices
Conclusions
Pyramid algorithm framework implemented in Unity.
Demonstrated and tested by implementing image effects.
Performed slightly worse than the built-in effects.
Expected results as the framework is a work in progress.
Thanks for your attention!
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
19 References
Appendices
References
[1] Blur effects.
http://docs.worldviz.com/vizard/postprocess_blur.htm.
Accessed: 01-03-2016.
[2] Simple bloom node setup.
http://www.blendswap.com/blends/view/21849.
Accessed: 01-03-2016.
[3] Understanding depth of field.
http://www.24frameslater.com/2013/03/05/understanding-depth-of-field-episode-1.
Accessed: 01-03-2016.
[4] Unreleased McKinsey report.
[5] Peter J Burt.
Fast filter transform for image processing.
Computer graphics and image processing, 16(1):20–51, 1981.
[6] Ondˇrej Fialka and Martin ˇCadik.
Fft and convolution performance in image filtering on gpu.
In Information Visualization, 2006. IV 2006. Tenth International Conference on, pages 609–614.
IEEE, 2006.
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
20 Appendices
Appendices
Convolutional Methods
How to reduce the complexity?
Separable kernel:
∗ =∗
Complexity: O(N2
× 2k).
Still dependent on the kernel size.
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
21 Appendices
Appendices
Convolutional Methods
How to reduce the complexity?
Frequency domain:
. =FF
-1
F
Complexity: O(4N2
× log2(N)).
Filter-size independent, but not linear on the number of
pixels of the input image.
Suitable for non-separable big filters.
Further details on these approaches: [6].
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
22 Appendices
Appendices
Filters
2x2 Box
Analysis Filter
4x4 Box
Analysis Filter
Biquadratic B-Spline
Analysis Filter
Biquadratic B-Spline
Synthesis Filter
Original Image
Blurred Image
2x2 Box Filter
Blurred Image
4x4 Box Filter
Blurred Image
Biquadratic B-Spline Filter
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
23 Appendices
Appendices
Graphics and Compute Pipelines
Compute
Shader
Unordered
Access
Resources
Shader
Resources and
Constant Buffers
Tessellation
Index Buffers
Vertex Buffers
Input
Assembler
Vertex
Shader
Hull Shader
Tessellator
Domain
Shader
Geometry
Shader
Rasterizer
Pixel Shader
Output
Merger
Render
Targets
Unordered
Access
Resources
Shader
Resources and
Constant Buffers
Tessellation
Buffers
24
Pyramid Algorithm
Framework
Adrià Arbués
Sangüesa et al.
Introduction
Blur
Convolutional Methods
Pyramid Methods
Motivation
Framework
Game Engine
Structure
Effects
Blur
Bloom
Depth of Field
Results
Conclusions
References
24 Appendices
Appendices
Blur

Pyramid Algorithm Framework for Real-Time Image Effects in Game Engines

  • 1.
    Pyramid Algorithm Frameworkfor Real-Time Image Effects in Game Engines Tuesday 3rd May, 2016 Adrià Arbués Sangüesa - Andreea-Daniela Ene - Nicolai Krogh Jørgensen -Christian Aagaard Larsen - Daniel Michelsanti - Martin Kraus
  • 2.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices Agenda Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices
  • 3.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction 2 Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices Introduction Blur
  • 4.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur 3 Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices Introduction Convolutional Methods ∗ = k ✕ k Gaussian Filter N ✕ N Input Image
  • 5.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur 4 Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices Introduction Convolutional Methods ∗ = k ✕ k Gaussian Filter 2N ✕ 2N Input Image
  • 6.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur 5 Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices Introduction Convolutional Methods In order to have the same effect: double the size of the kernel. Complexity: O(N2 × k2 )
  • 7.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods 6 Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices Pyramid Methods How to reduce the complexity? Pyramid: Linear complexity on the number of pixels of the input image [5].
  • 8.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods 7 Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices Pyramid Methods Analysis Synthesis
  • 9.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods 8 Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices Pyramid Methods Analysis Synthesis
  • 10.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods 9 Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices Motivation No built-in support to use pyramid methods in many game engines. Goal: build a framework to make pyramid methods easily accessible.
  • 11.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework 10 Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices Framework Game Engine Global game engine market share: Unity Closest competitor Others Figure: [4]
  • 12.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine 11 Structure Effects Blur Bloom Depth of Field Results Conclusions References Appendices Framework Structure Frame_1 Analysis List Synthesis Dictionary Key_1 Frame_1 Key_2 Frame_2 … … Master Dictionary Key_1 Synthesis_1 … … Synthesis Dictionary Key_n Synthesis_n 1024 x 1024 512 x 512 256 x 256 … 32 x 32 2048 x 2048 1024 x 1024 Generate non power of two resolution texture 1080 x 1920 512 x 512 Generate synthesis list Synthesis List 1080 x 1920 Screen Generate analysis list
  • 13.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure 12 Effects Blur Bloom Depth of Field Results Conclusions References Appendices Framework Effects Figure: [1], [2], [3]
  • 14.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects 13 Blur Bloom Depth of Field Results Conclusions References Appendices Framework Blur
  • 15.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur 14 Bloom Depth of Field Results Conclusions References Appendices Framework Bloom A BC A: Bright colors extraction B: Pyramidal blur C: Combination of the textures
  • 16.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom 15 Depth of Field Results Conclusions References Appendices Framework Depth of Field
  • 17.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom 16 Depth of Field Results Conclusions References Appendices Framework Depth of Field FD A A 2 FS FCP 1024 x 1024 512 x 512 256 x 256 … 32 x 32 2048 x 2048 2048 x 2048 1024 x 1024 1024 x 1024 2048 x 2048 512 x 512 1080 x 1920 Analysis Synthesis 1 Synthesis 2 Synthesis 3Screen
  • 18.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field 17 Results Conclusions References Appendices Results Figure: Performance of the Framework (ms) Figure: VRAM Usage (MB)
  • 19.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results 18 Conclusions References Appendices Conclusions Pyramid algorithm framework implemented in Unity. Demonstrated and tested by implementing image effects. Performed slightly worse than the built-in effects. Expected results as the framework is a work in progress.
  • 20.
    Thanks for yourattention!
  • 21.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions 19 References Appendices References [1] Blur effects. http://docs.worldviz.com/vizard/postprocess_blur.htm. Accessed: 01-03-2016. [2] Simple bloom node setup. http://www.blendswap.com/blends/view/21849. Accessed: 01-03-2016. [3] Understanding depth of field. http://www.24frameslater.com/2013/03/05/understanding-depth-of-field-episode-1. Accessed: 01-03-2016. [4] Unreleased McKinsey report. [5] Peter J Burt. Fast filter transform for image processing. Computer graphics and image processing, 16(1):20–51, 1981. [6] Ondˇrej Fialka and Martin ˇCadik. Fft and convolution performance in image filtering on gpu. In Information Visualization, 2006. IV 2006. Tenth International Conference on, pages 609–614. IEEE, 2006.
  • 22.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References 20 Appendices Appendices Convolutional Methods How to reduce the complexity? Separable kernel: ∗ =∗ Complexity: O(N2 × 2k). Still dependent on the kernel size.
  • 23.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References 21 Appendices Appendices Convolutional Methods How to reduce the complexity? Frequency domain: . =FF -1 F Complexity: O(4N2 × log2(N)). Filter-size independent, but not linear on the number of pixels of the input image. Suitable for non-separable big filters. Further details on these approaches: [6].
  • 24.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References 22 Appendices Appendices Filters 2x2 Box Analysis Filter 4x4 Box Analysis Filter Biquadratic B-Spline Analysis Filter Biquadratic B-Spline Synthesis Filter Original Image Blurred Image 2x2 Box Filter Blurred Image 4x4 Box Filter Blurred Image Biquadratic B-Spline Filter
  • 25.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References 23 Appendices Appendices Graphics and Compute Pipelines Compute Shader Unordered Access Resources Shader Resources and Constant Buffers Tessellation Index Buffers Vertex Buffers Input Assembler Vertex Shader Hull Shader Tessellator Domain Shader Geometry Shader Rasterizer Pixel Shader Output Merger Render Targets Unordered Access Resources Shader Resources and Constant Buffers Tessellation Buffers
  • 26.
    24 Pyramid Algorithm Framework Adrià Arbués Sangüesaet al. Introduction Blur Convolutional Methods Pyramid Methods Motivation Framework Game Engine Structure Effects Blur Bloom Depth of Field Results Conclusions References 24 Appendices Appendices Blur