SFML community forums

General => SFML projects => Topic started by: Zyl on April 11, 2014, 11:00:54 pm

Title: Volumetric Lighting Experimental Application
Post by: Zyl on April 11, 2014, 11:00:54 pm
Hello,

I finished my B.Sc. in Media IT recently where I wrote an implementation for dynamic volumetric lighting in OpenGL for my thesis. It is mostly fragment shader code Most brain-power went into fragment shader code.

More specifically, this means you want to reflect light from light sources in mid-air because of particles (smoke, fog, dust, etc.) blocking some of the light.

Result and reason was to show it is perfectly ready for use in real-time 3D graphics applications, ranging from 100 (GT540M) to 1200 (GTX640) frames per second in an otherwise basic "rendering engine" (for-loop which renders all VAOs; textured polies with diffuse lighting).

So yeah, just posting some images for motivation. SFML was mostly used for input processing and font rendering (which turned out to be EXTREMELY useful and easy to use! kudos to you!!)

No VL:
(http://i.imgur.com/ZSdqwIj.png)

With VL:
(http://i.imgur.com/1dlBQxV.png)

No VL:
(http://i.imgur.com/J9ZaFlt.png)

With VL:
(http://i.imgur.com/u17DlXS.png)

No VL:
(http://i.imgur.com/8jjjeXT.png)

With VL:
(http://i.imgur.com/jj4gGeV.png)

No VL:
(http://i.imgur.com/3CI8m27.png)

With VL:
(http://i.imgur.com/5pbgQ9i.png)

The In-Program menu which uses font-rendering. You can click and hold, then move mouse up or down to change values:
(http://i.imgur.com/rLqquRB.png)

There are some visible artifacts in some cases, and the shown scenes aren't all polished, but you have many ways to change the way the effect looks and really use it in cool ways.

I think the only feature I ended up #including windows.h for was to check if window was minimized to stop rendering.

All in all a quite demanding project with a load of physics (attenuation, optical depth, rayleigh-scattering) and a nifty algorithmic procedure (interleaved sampling). If images look a bit weird, well there is varying gamma correction since I presented some of these through a beamer.

I learned A TON while doing this, especially because I built this ground up, camera controls, VAO and VBO handling, rendering code and all. Hope you like it and thanks for making SFML!
Title: Re: Volumetric Lighting Experimental Application
Post by: eXpl0it3r on April 11, 2014, 11:25:33 pm
This looks quite awesome! :)
Did you try with Anti-aliasing active? I see a lot of sharp edges.

I think the only feature I ended up #including windows.h for was to check if window was minimized to stop rendering.
You could've achieved that by tracking the Focus event with SFML. ;)

Will you be releasing the source code and/or paper?
Title: Re: Volumetric Lighting Experimental Application
Post by: Grimshaw on April 12, 2014, 02:17:13 am
This is some nice work, thanks for sharing! However, I believe the effect in itself is unrealistic and really too exaggerated. Nevertheless, interesting visual results :)

There are really nice screen space VL techniques in nvidia gpu gems, you should find it easily if you wish to perhaps research on other approaches? =)
Title: Re: Volumetric Lighting Experimental Application
Post by: Zyl on April 12, 2014, 02:46:55 am
Anti-aliasing is a seperate deal but yeah it should work with a multisampled texture.

Source release mayhaps though it is rather chaotic haha.

Paper is in German so not sure if that will help :p There are papers on this already but mine was to go and benchmark it a bit.

@ unrealistic: Well yea I had to exaggerate to get anything to show up in presentation at all haha. Video beamers are shit :x Trust me in saying you can customize and parametrize the hell out of this to get it fairly realistic or otherwise good-looking.

GPU gems I did read through quite a bit. Picked up some motivation and info from various places.
Title: Re: Volumetric Lighting Experimental Application
Post by: Nexus on April 12, 2014, 12:50:30 pm
Looks really good! Your technique could be used for some nice fog effects in dark harbor alleys :)

Do you have plans to extend your work, maybe for a small game or so, or was the purpose primarily experimental?
Title: Re: Volumetric Lighting Experimental Application
Post by: eXpl0it3r on April 12, 2014, 01:16:51 pm
Anti-aliasing is a seperate deal but yeah it should work with a multisampled texture.
I was more relating to the extremely jagged model edges.

Paper is in German so not sure if that will help :p There are papers on this already but mine was to go and benchmark it a bit.
There are quite a few people around here, that understand German. :P
Title: Re: Volumetric Lighting Experimental Application
Post by: Zyl on April 12, 2014, 06:26:44 pm
Well strictly speaking it is an exam document and hence any further use would need approval of at least both my examiners.

I don't intend to continue on this specifically. I just fucking hated to see the default distance-lerp-OpenGL-fog in even modern game titles. Just changing the curve from mix() to exp() makes the thing much more authentic, even though your fog is still going to look emissive in dark areas and drastically lessen the visual quality of the scene.