Game Development Community

Volumetric lights...

by Sorin Daraban · in Torque 3D Professional · 07/11/2009 (12:24 am) · 13 replies

Will this feature be available in the final release of T3D?
I really love the volumetric texture used to show which way the spot light is facing.
Is there a way to enable it during play rather than just in the Editor?

#1
07/11/2009 (12:57 am)
yeah, volume lights should come back,
(thinks of night scene, with street lamps, and little bugs flying around and under them in the volumetric light, or a light in fog, headlights for vehicles, torches)

the sgLighting was good, why was it not included in T3D?
#2
07/11/2009 (12:08 pm)
Yeah, I totally agree. That'd be sweet!
#3
07/11/2009 (12:58 pm)
...

For real, guys?

Export a cone/sphere mesh...set the material to translucent, emissive. Put it in the scene. Volumetric light = done.
#4
07/11/2009 (1:41 pm)
Are the volumetric limited to just the sun then? I dont see why this cannot be added for spot lights as well.
#5
07/11/2009 (2:25 pm)
so Pat, would that work for a flashlight? or a vehicle headlight? and would it cast the light out ahead onto the terrain and through fog at night?
cause if so, thats just what I need
#6
07/11/2009 (4:01 pm)
Deepscratch, if you mount a light to a mount node (headlight, flashlight), you can mount a shape to that same mount node. You use this imposter-light in addition to placing a light. This allows you to place dynamic lights, and have the 'volume effect'...or chose not to, or place light volumes for static (lightmapped) lights...instead of hacking functionality into dynamic lights (which will then have different implementations for Basic and Dynamic lighting).

This allows the artist to define the solution, the materials, and to re-use these effects for things other than just an actual scene light. Why should a volumetric effect material be limited to pont/spot lights? Why can't you use a point light (a poorly tesselated sphere) to do the dynamic lighting, and an intricate, shaped mesh for the 'volume effect'.

For the actual volume material, I would suggest using texture animation for some simple 'dust/bug' effects. An effect which uses scene-depth information is also possible and would be interesting to try.
#7
07/12/2009 (6:02 am)
dunno Pat, what you describe sounds more like a hack to get around the fact that there is no point and volumetric lighting in T3D, where as in TGEA, there was, and it worked quite well too.
#8
07/12/2009 (12:51 pm)
Uh...no there was not volumetric lighting in TGEA, and there was nothing about TGEA lighting that worked well at all.

What I am describing is how to blend a next-generation lighting system with the last-generation hack-feature you are describing.
#9
07/12/2009 (1:02 pm)
mm, I stand corrected then.
ultimatly I'm just looking for a realistic solution to headlights and flash lights, a big part of the game I'm working on takes place at night.
#10
07/12/2009 (1:51 pm)
That came off a bit terse, and I admit it was a twitch reaction to the TGEA lighting.

Please let me describe to you how Advanced Lighting is different from TGEA lighting, and why it actually can do true volume effects, where as previous effects, and like the mount-a-shape method I described, are actually the hacks.

Advanced Lighting, in TGEA, is a stripped-down version of deferred shading called pre-pass lighting. Googling this technique will come up with a bunch of hits. It is also described in ShaderX7 (and the subsequent article, about pre-pass lighting using the LUV color space, was authored by yours truly). This method captures the depth of objects in the scene (view this by typing 'toggleDepthViz' or using editor viz menu) in order to do very efficient lighting for literally hundreds of dynamic lights, in real time. This method is favorable over previous deferred shading methods because it has much lower requirements. When properly tuned down, Advanced Lighting can actually be stripped down (this requires tech work) to work in Shader Model 2.0. It does not require multiple render targets (although advanced-lightmap integration can use it, but that is an entirely different topic, and don't freak out about that in the least, it is an optional path).

In order to light the scene, light volumes are drawn to a "light buffer" (view this by typing 'toggle LightColorViz' or using editor dropdowns). These light volumes are low-poly spheres/cones/cubes which represent the areas covered by a light. When the volume is rendered, it samples scene depth ('toggleDepthViz') and the per-pixel normal ('toggleNormalViz') and uses that to compute the lighting information.

The "god rays" for the sun, use the same scene-depth information to figure out when the rays are blocked by geometry. This very same technique can be used to do true volume lighting effects. However the reason why that functionality is not in the light object itself is not only because it is a very expensive effect, but because the actual 'volume effect' is not part of the lighting process. It is a post-effect (I know that sounds like I am splitting hairs but please hear me out). The proper way to implement this is to actually piggyback off of the previous "hack" functionality...

The goal of this is to get an artist/designer customizable volume effect which can fit in multiple scenes and game designs. In order to achieve this goal, the best way of implementing the effect is to actually use the method I described in previous posts (again hear me out). This allows you to "fade" the effect based on distance, without actually fading the illumination of the light. It lets you use a simple animating texture to simulate an easy and inexpensive (but ultra customizable) effect. It also lets you go for a full on depth-sampling shader which can get as crazy as you want.

I do want to make sure that I stress, it is not until the current round of technology (per-pixel depth) that you could actually do a true volume effect. All previous "light volume effects" were either billboards, or something similar to the "draw a cone/sphere with a material on it" hack I described.

It is also worth noting that the Basic Lighting, and Advanced Lighting do things totally differently, and this is another reason why this "volume effect" is not actually a light option. The sun-rays will only work under Advanced Lighting. To fake these rays, in previous games/technology, we would use emissive, translucent billboards and have them fade in/out based on distance from the camera. This isn't something that you can just "turn on" as an option. The fake billboard lightrays need to be placed by an artist.

Maybe the discussion should be changed to, "How can we more clearly communicate how to achieve the effect you are looking for."
#11
07/12/2009 (2:04 pm)
A round of applause for that explanation. Thanks Pat!

I for one am glad to see sgLighting gone. That code still gives me headaches just thinking about it ;D

Didn't Todd Pickens make use of fake sunrays (and even a fake lamp glow) in his FPS Environment Pack?
#12
07/12/2009 (7:06 pm)
A (soft) particle with a large softening distance and additive blending would create a very nice volumetric volume.
#13
07/13/2009 (11:04 am)
sgLighting had this VolumeLight object which rendered multiple quad slices to fill a volume of light. It was a light only because it derived from the sgLightObject class... it only added the rendering of these billboards into the scene. This is exactly what Pat is describing above to generate a fake volume.

We would like to do something similar using the LightFlareData or a new LightVolumeData object, but it probably won't be in T3D 1.0.