Bloom Effects in Game Design

C
o
n
v
o
l
u
t
i
o
n
 
(
F
F
T
)
 
B
l
o
o
m
David Hill
Principal Mathematician
Epic Games
5/25/2017
B
l
o
o
m
:
 
W
h
y
 
I
n
v
e
s
t
?
Adapt film / offline approach for use in real time
Additional realism with highly detailed effects
Provide ability to customize the camera / eye response
Target Cinematics and High End hardware
A convincing bloom adds subtle but impactful physically
motivated  effect.  Currently feasible on today’s high end
hardware..
B
l
o
o
m
 
A
s
 
W
e
a
k
 
S
c
a
t
t
e
r
i
n
g
Weak Scattering: Some Causes
Haze
Car Windshield (
mine is always a little dirty
)
Eyelash Diffraction
Inner-Camera Effects
Fraunhofer Diffraction
Physically-Based Glare Effects for Digital Images 
(1995, Spencer et al)
Glare Generation Based on Wave Optics
 
(2004, Kakimoto et al, Computer Graphics Forum)
B
l
o
o
m
 
A
s
 
W
e
a
k
 
S
c
a
t
t
e
r
i
n
g
Weak Scattering
A single pin point remains mostly focused
Model Assumptions:
Every point of light is scattered the same
For most sources the scattered amount is imperceptible
The scattering from bright sources creates “bloom”
 
In Camera scattering of a point
B
l
o
o
m
:
 
S
t
a
n
d
a
r
d
 
G
a
m
e
-
S
t
y
l
e
Weak Scattering
Sum of Gaussian Filter
Image down-sampled multiple times and Gaussian Blur applied
Resulting images are summed and added to original
Every pixel scatters light in a symmetric way to its neighbors
Very Fast!
But...
 
Standard Bloom in UE4: 
Recommended for game use
 
B
l
o
o
m
 
A
s
 
W
e
a
k
 
S
c
a
t
t
e
r
i
n
g
                The camera response to a single  bright source:
 
Camera scattering of point
Appears to be a very small star
Full image, adjusted contrast
Detail extents far across image!
              
Close Up of center
Center pixel about 10,000 times brighter
than any other point in this .exr
B
l
o
o
m
 
S
c
a
t
t
e
r
 
A
s
 
G
a
t
h
e
r
:
 
C
o
n
v
o
l
u
t
i
o
n
View this as a weighted sum, here in one dimension :
 
 
Filtered Value
Original Value
Filter
 
 
For Example, simple smoothing
 
Each Pixel Scatters to all the
others according to the filter.
B
l
o
o
m
 
S
c
a
t
t
e
r
 
A
s
 
G
a
t
h
e
r
:
 
C
o
n
v
o
l
u
t
i
o
n
Convolution:
Every point is weighted sum 
of all other points
N points gather from all N points.  
 O(N^2)
We need a faster way!  ->
 FFT
 
 
B
l
o
o
m
 
S
c
a
t
t
e
r
 
A
s
 
G
a
t
h
e
r
:
 
C
o
n
v
o
l
u
t
i
o
n
Convolution With Fast Fourier Transform:
1.
Image_Frequencies     = FFT(Image)
2.
Filter_Frequencies    = FFT(Filter)
3.
Convolved_Frequencies = Image_Frequencies x Filter_Freqencies
4.
Convolved_Image       = InverseFFT(Convolved_Frequencies)
 
B
l
o
o
m
:
 
W
h
y
 
F
F
T
 
C
o
n
v
o
l
u
t
i
o
n
?
Better Scaling
FFT from signal to frequencies  - O(N Log N)
Convolution in frequency space - O(N)
FFT from frequencies to signal   - O(N Log N)
Overall Scaling  
 O(N Log N)
 
For our purposes, the Fast Fourier Transform (FFT) is an acceleration
technique for convolution.
B
l
o
o
m
:
 
W
h
a
t
 
i
s
 
F
o
u
r
i
e
r
 
T
r
a
n
s
f
o
r
m
?
 
Any finite length signal can be expresses as a sum of sines and cosines
Signal      Amplitude of each frequency    Sine & Cos
 
 
 
Inverse computes amplitudes of each frequency
Low-Pass filter: only used first few V_k
B
l
o
o
m
:
 
F
a
s
t
 
F
o
u
r
i
e
r
 
T
r
a
n
s
f
o
r
m
?
 
Sines and Cosines have symmetries that can be exploited speeding the
transform
 
 
Split the sum into even and odd terms, and symmetry saves work!
 
 
 
Now recurse, each small transform (
Even, Odd)
 and be treated as new transforms
And subdivided.   Due to this splitting FFT does best with power_2 signals.
B
l
o
o
m
 
:
 
P
a
r
a
l
l
e
l
 
F
F
T
 
f
o
r
 
G
P
U
GPU: Highly parallel, but with thread-communication limitations.
Similar restriction are found in supercomputing architectures.
Stockham Formulation:  Parallel formulation
Used for Vector Computers
 
(1987 D Baily, Journal of Supercomputer Applications)
Applied to GPUs
 
(2008 Govindaraju, Proceedings of ACM/IEEE on Supercomputing)
Our implementation largely follow this
Each Scanline
Transformed independently
Assigned to a thread group with group shared memory
B
l
o
o
m
:
 
C
o
m
p
u
t
e
 
S
h
a
d
e
r
s
FFT implemented as compute shaders
Pass
Forward Horizontal Transform
Uses 2-for-1 trick to transform (r,g) and (b,a)
Pass
Forward Vertical Transform
Convolution, i.e. Multiply, with cached pre-transformed Kernel
Inverse Vertical Transform
Pass
Inverse Horizontal Transform
Inverts 2-for-1 trick
 
From  GPUVisualizer
Slide Note
Embed
Share

Bloom effects, such as weak scattering and convolution, enhance the visual appeal of games by simulating light scattering. They add realism and customization options to game graphics, improving the overall visual experience. Weak scattering causes subtle yet impactful effects like glare and diffraction, creating a more immersive gaming environment. Implementing bloom effects can elevate the quality of cinematics and high-end hardware visuals.

  • Bloom Effects
  • Game Design
  • Visual Enhancement
  • Convolution
  • Weak Scattering

Uploaded on Nov 23, 2024 | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Convolution (FFT) Bloom David Hill Principal Mathematician Epic Games 5/25/2017

  2. Bloom: Why Invest? A convincing bloom adds subtle but impactful physically motivated effect. Currently feasible on today s high end hardware.. Adapt film / offline approach for use in real time Additional realism with highly detailed effects Provide ability to customize the camera / eye response Target Cinematics and High End hardware

  3. Bloom As Weak Scattering Weak Scattering: Some Causes Haze Car Windshield (mine is always a little dirty) Eyelash Diffraction Inner-Camera Effects Fraunhofer Diffraction Physically-Based Glare Effects for Digital Images (1995, Spencer et al) Glare Generation Based on Wave Optics (2004, Kakimoto et al, Computer Graphics Forum)

  4. Bloom As Weak Scattering Weak Scattering A single pin point remains mostly focused Model Assumptions: Every point of light is scattered the same For most sources the scattered amount is imperceptible The scattering from bright sources creates bloom In Camera scattering of a point

  5. Bloom: Standard Game-Style Weak Scattering Sum of Gaussian Filter Standard Bloom in UE4: Recommended for game use Image down-sampled multiple times and Gaussian Blur applied Resulting images are summed and added to original Every pixel scatters light in a symmetric way to its neighbors Very Fast! But...

  6. Bloom As Weak Scattering The camera response to a single bright source: Close Up of center Center pixel about 10,000 times brighter than any other point in this .exr Camera scattering of point Appears to be a very small star Full image, adjusted contrast Detail extents far across image!

  7. Bloom Scatter As Gather: Convolution Original Value Filtered Value Filter Each Pixel Scatters to all the others according to the filter. View this as a weighted sum, here in one dimension : For Example, simple smoothing

  8. Bloom Scatter As Gather: Convolution Convolution: Every point is weighted sum of all other points N points gather from all N points. O(N^2) We need a faster way! -> FFT

  9. Bloom Scatter As Gather: Convolution Convolution With Fast Fourier Transform: 1. Image_Frequencies = FFT(Image) 2. Filter_Frequencies = FFT(Filter) 3. Convolved_Frequencies = Image_Frequencies x Filter_Freqencies 4. Convolved_Image = InverseFFT(Convolved_Frequencies)

  10. Bloom: Why FFT Convolution? Better Scaling For our purposes, the Fast Fourier Transform (FFT) is an acceleration technique for convolution. FFT from signal to frequencies - O(N Log N) Convolution in frequency space - O(N) FFT from frequencies to signal - O(N Log N) Overall Scaling O(N Log N)

  11. Bloom: What is Fourier Transform? Any finite length signal can be expresses as a sum of sines and cosines Signal Amplitude of each frequency Sine & Cos Inverse computes amplitudes of each frequency Low-Pass filter: only used first few V_k

  12. Bloom: Fast Fourier Transform? Sines and Cosines have symmetries that can be exploited speeding the transform Split the sum into even and odd terms, and symmetry saves work! Now recurse, each small transform (Even, Odd) and be treated as new transforms And subdivided. Due to this splitting FFT does best with power_2 signals.

  13. Bloom : Parallel FFT for GPU GPU: Highly parallel, but with thread-communication limitations. Similar restriction are found in supercomputing architectures. Stockham Formulation: Parallel formulation Used for Vector Computers (1987 D Baily, Journal of Supercomputer Applications) Applied to GPUs (2008 Govindaraju, Proceedings of ACM/IEEE on Supercomputing) Our implementation largely follow this Each Scanline Transformed independently Assigned to a thread group with group shared memory

  14. Bloom: Compute Shaders FFT implemented as compute shaders Pass Forward Horizontal Transform Uses 2-for-1 trick to transform (r,g) and (b,a) Pass Forward Vertical Transform Convolution, i.e. Multiply, with cached pre-transformed Kernel Inverse Vertical Transform Pass Inverse Horizontal Transform Inverts 2-for-1 trick From GPUVisualizer

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#