Graphics Reference
In-Depth Information
Triangle Down
(Up in final image)
Triangle Up
(Down in final image) Lens
Point Source
of Light
Plane of Sharp Focus
Triangular Aperture
Figure 3.5. Aperture shape affecting out-of-focus detail in the image.
3.3 The Sprite-Based Approach
Sprite-based bokeh effects are pretty simple to understand and are very flexible,
allowing artist modification to achieve the desired result. The main idea is to
take each pixel of the framebuffer and analyze its luminance:
L i,j =0 . 2126 R i,j +0 . 7152 G i,j +0 . 0722 B i,j ,
average pixel luminance = Σ i j L i,j
m
.
×
n
To analyze each pixel of the framebuffer, you start with a filter kernel, to
analyze the pixels surrounding the current pixel. The bigger the kernel size is,
the more expensive the luminance calculation is. (See Figure 3.6.) In my tests I
Figure 3.6. Framebuffer example with a 5 × 5 pixel kernel used to compute the average
luminance of the pixel.
Search WWH ::




Custom Search