Skip to content

Volumetric lighting and anamorphic lens flares

Compare
Choose a tag to compare
@iftodebogdan iftodebogdan released this 06 Dec 06:16
· 104 commits to master since this release

Implemented volumetric lighting with realistic fog attenuation effect.
While ray marching through the scene, samples are shaded using the radiative transport equation. Additionally, they are modulated with a 3D noise texture, sampled in world space (plus a time-dependent offset, for a "scrolling" animation), after which an exponential vertical falloff is applied for a realistic fog effect. The samples are then gathered into a quarter resolution (1/2 width and 1/2 height) render target. Ray starting positions are offset according to an 8x8 dither map (Bayer matrix) and, therefore, the texture in which the light is accumulated is blurred using a separable Gaussian kernel, taking care not to bleed over edges by adjusting the Gaussian weights based on the difference between the sample's depth and the depth of the currently shaded fragment. Finally, the quarter resolution texture is added to the scene using additive blending after an upscaling process which consists of a hybrid between the nearest-depth and bilinear filters. To avoid the typical blocky artifacts caused by it, the nearest-depth filter is applied only on edge fragments, as determined by the edge detection algorithm, defaulting to regular bilinear filtering on non-edge fragments.

The anamorphic lens flare effect consists of multiple horizontal blur passes on a very narrow render target (1/32 width of back buffer) after having done a brightness filter pass.

gitechdemo 2015-12-04 00-28-59-14_1
gitechdemo 2015-12-04 00-44-46-59_1
gitechdemo 2015-12-04 01-02-05-06_1
gitechdemo 2015-12-06 02-35-42-93