Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Volumetric Lighting Experimental Application  (Read 2122 times)

0 Members and 1 Guest are viewing this topic.

Zyl

  • Newbie
  • *
  • Posts: 12
    • View Profile
Volumetric Lighting Experimental Application
« 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:


With VL:


No VL:


With VL:


No VL:


With VL:


No VL:


With VL:


The In-Program menu which uses font-rendering. You can click and hold, then move mouse up or down to change values:


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!
« Last Edit: April 11, 2014, 11:07:07 pm by Zyl »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 9191
    • View Profile
    • development blog
    • Email
Re: Volumetric Lighting Experimental Application
« Reply #1 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?
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: Volumetric Lighting Experimental Application
« Reply #2 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? =)

Zyl

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Volumetric Lighting Experimental Application
« Reply #3 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.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6155
  • Thor Developer
    • View Profile
    • Bromeon
Re: Volumetric Lighting Experimental Application
« Reply #4 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?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: first SFML book

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 9191
    • View Profile
    • development blog
    • Email
Re: Volumetric Lighting Experimental Application
« Reply #5 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
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
——————————————————————
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/

Zyl

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Volumetric Lighting Experimental Application
« Reply #6 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.