Skip to content

Revised bokeh depth of field effect with chromatic aberration, vignetting and film grain

Compare
Choose a tag to compare
@iftodebogdan iftodebogdan released this 19 May 13:11
· 82 commits to master since this release

Revised the bokeh depth of field effect for added performance. In this sense, a multi-pass approach has been employed where a blur kernel the shape of a hexagon has been used. The samples are weighted based on their respective circle of confusion (CoC) value, which is stored in the alpha channel during an initial pass. Depending on the size of the aperture, bokeh will appear larger on screen, but multiple passes will be required so as not to have the appearance of a dithered pattern due to undersampling. Bokeh is extracted by utilizing a brightness pass filter, where all samples above a specified luminance value have their weight increased with respect to the specified gain value. Aperture size directly relates to the size of the blur kernel. As such, in order to maximize coverage of samples over all passes, the kernel size varies for each pass. Vignetting and the chromatic aberration effect have remained unchanged from the previous shader version. The option to render into a quarter resolution target has been removed, though, since the new full resolution version provides increased quality at an acceptable performance cost (besting even the old quarter resolution variant).

Added a film grain effect at the end of the post-processing chain (after tonemapping) so as not to be affected by other effects or by exposure adjustments. It uses an ALU based pseudo-random number generator seeded by the last frame's CPU time and by the current fragment's texture coordinate. It provides decent procedural noise without an apparent pattern associated to it (as is the case with precomputed noise textures) and has low ALU and no bandwidth cost.

At an application level, support for enforcing display refresh rate has been implemented, albeit it will only work in fullscreen mode. VSync has also been added as an option which, unlike the latter, will work when the application is in windowed mode as well. Other quality of life fixes for the window management system have found their way into the current release, such as glitch-free switching between fullscreen and windowed modes.

Update v1.6.1 - optimization to volumetric light sample distribution
*ray samples for the volumetric light effect now have a customizable distribution via the corresponding artist parameter - this provides a higher sample density near the camera
*the intensity of the volumetric light now scales with the intensity of the directional light

Update v1.6.2 - optimization to rendering flow, concerning gamma space, resulting in higher quality dark tones
*gamma correction is no longer applied to input diffuse textures
*the G-Buffer's albedo component now stores sRGB color information and gamma correction is done at lighting stage

gitechdemo 2016-05-16 23-08-19-38