Hey there 3d users of the GMC,
I've been working on something special lately, and I think it's finally ready to show off.
Proudly I present to you: Volumetric Lighting.
So what is volumentric lighting?
Wikipedia states the following: "Volumetric lighting is a technique used in 3D computer graphics to add lighting effects to a rendered scene. It allows the viewer to see beams of light shining through the environment; seeing sunbeams streaming through an open window is an example of volumetric lighting, also known as God rays."
Why is the surface fix needed and how does it work?
The surface fix by amd24 is crucial in this technique. It allows me to render to a texture, which is exactly what I'm doing. In the step event, I make a seperate render of the scene, just like in my glow example. Except this time, everything in the scene will be black, except for 1 object: the light. The light will still use it's default texture.
My idea is that by scaling this 2d rendered "light-surface", you can create beams of light. But to do so, it needs to be scaled around a focus point. This focus point is the 3d position of the light. Problem is that we need to convert that 3d point to a 2d point on the screen, in order to do the scaling. That's where Yourself's conversion scripts come into play, which I made an example of here.
Using the resulting 2d focus point, it's possible to draw the "light-surface" a number of times with various scaling, around a certain 2d point on the screen. When drawing it on top of the normal scene render, light beams will come out really nicely.
Controls in the example:
- Move around using WASD
- Change height with QE
- Look around with the mouse
- It now takes into account the angle you're looking at it, smoothly fading away!
- Because of the nature of how this works, the sun gets brighter when you look directly into it.
- In this new version the game only needs 1 render of the scene instead of 2, making this a lot more efficient!
- When the sun is outside the defined borders the effect will not be computed, saving performance.

Download link: right here!
File size: 0.51 MB
Old version (v1.0):
http://img153.imageshack.us/img153/8162/volumentric.png
http://img265.imageshack.us/img265/5086/volumentic2.png
http://host-a.net/Ph.....ing Fixed.zip
Enjoy!
- Phantom107
Edited by Phantom107, 09 December 2011 - 11:28 AM.











