Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Week 48/2013: Lens flares, VR

edited 2013 Dec 2 in Developers
Last week I was working on GL2 lens flare rendering.

I recorded a brief video showing my progress with the lens flares so far:

While this is very much work in progress and there is plenty of fine-tuning to do, I'm pretty happy with the appearance for now. At the moment, there is only a single test light source that is not attached to any world object, though — I'm sure once I start integrating the flares into real emitters more tuning of the flare images and appearance will be needed.

When drawing lens flares, it is crucially important to determine if a light source has been occluded by something between the viewer and the light source. Previously, Doomsday has been doing this based on map geometry only, meaning that anything else like sprites or masked walls would not occlude lights. The old renderer worked around this by drawing flares at the depth of the emitter, so that things closer by would simply be drawn over the flares in the background. This obviously does not respect the laws of physics, and results in flares "leaking" through objects and walls.

Much of my time last week was spent on reconfiguring the GL frame buffer in such a way that OpenGL shaders will be able to access depth buffer information. The depth values provide a more accurate way to determine light occlusion, and allow drawing a lens flare only if the light can actually reach the camera lens.

OpenGL frame buffer objects (FBOs) provide a lot of freedom when configuring the rendering buffers. I simply set up one GL texture for color values and another for depth/stencil values. Shaders can then sample the depth/stencil texture in any way they see fit. In the future this should prove useful for other purposes, too. However, there are still a couple of missing features to account for, like antialiasing support.

I forgot to mention it last week, but we've now merged some of cmbruns's VR features into the master branch and they are available in the latest unstable builds. While the Oculus Rift support is still incomplete, there are other goodies like anaglyph and side-by-side stereo rendering modes. You can change the VR rendering mode with the still-undocumented cvar "rend-vr-mode". We are targeting basic support for Oculus Rift in the 1.13 release.

My plan for this week is to integrate the new lens flare rendering into light emitters in the game world.
Sign In or Register to comment.