Previous Blog Next Blog
Prev/Next Blog
by date

Shaders Galore! Texture-Space Diffusion, God Rays, and Light Extrusion Mapping!

Shaders Galore! Texture-Space Diffusion, God Rays, and Light Extrusion Mapping!
Name:Matt Vitelli 
Date Posted:Jul 29, 2008
Rating:4.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Matt Vitelli

Blog post
Being several months overdue for a blog, I decided it was time to write one.

A great deal has happened over the past few months. I've done a lot of work with TGEA and have been working on an assortment of post-processing effects.

I am honored to say I am now an associate of Garage Games and hope to continue doing work to improve Torque technology.

For starters, I have written several iterations of deferred renderers. For those unfamiliar with a deferred renderer, the general idea is to save out
position and normal information from the entire scene into a texture. This allows you to control your lighting process almost entirely on the GPU.

I've written my own algorithm for Screen-Space Ambient Occlusion. In ambient occlusion, light comes in from every direction. My algorithms use the
8 surrounding cardinal directions to test for occlusion and shade based on that. It is run completely as a post-process using scene depth information and
requires only 8 samples, unlike many SSAO algorithms. The picture below is a crude example, using 32-bit precision. Good SSAO (and really, most post-processing effects) should use 128-bit textures. This does, however, have many performance drawbacks making a subtle effect such as SSAO somewhat pointless.



I've also been working on texture-based diffusion. While the terminology may confused some, it is really quite simple. You perform your diffusion and lighting in one pass, saving the result into a texture. You then perform many gaussian blur filters and adjust color operations to suit your needs. Then, the result is reapplied to the mesh and specular is calculated. The results produce soft, realistic skin. So far, the major problem with incorperating this into TGEA has been storing every diffusal texture, seeing as every mesh requires a new one.









SSAO and texture-based diffusion are great, but the real focus of this blog is to expose a new rendering technique I'm coining as "light extrusion mapping". Light is "extruded" from pixels on a texture map and the result is rendered as a post-process. This means NO geometry is being rendered for each ray. Many games are adopting similar effects, including Crysis and STALKER.
Plenty of neat effects can be done, some of which include god rays, foliage sun-scattering, and truely emissive images. Below are some of the results that can be accomplished with such light extrusion maps.










The really neat thing about this is that a light extrusion map is just a simple alpha channel, but it can easily be scaled to allow ranges of color from every channel.

Recent Blog Posts
List:11/10/08 - TGEA Advanced Shaders (Image Heavy)
07/29/08 - Shaders Galore! Texture-Space Diffusion, God Rays, and Light Extrusion Mapping!
05/15/08 - Day and Night System
09/27/07 - Illumina Screenshots!
08/14/07 - Forgotten Lands, Real-Time Ambient Occlusion, and Motion Blur!
08/03/07 - Illumina, Forgotten Lands, and Shaders!(Screenshot heavy)
11/08/06 - Various Tools and Projects (Screenshot Heavy)
09/16/06 - The Past Year

Submit ResourceSubmit your own resources!

Taylor Petrick   (Jul 29, 2008 at 10:03 GMT)
Wow. I could definetly think of some places where that light extrusion would be handy. It would sure beat putting volume lights on all windows facing the sun. Keep up the amazing work Matt.

Dave Young   (Jul 29, 2008 at 11:22 GMT)
That is incredible looking!

Anthony Rosenbaum   (Jul 29, 2008 at 11:59 GMT)
Slick!

Kevin James   (Jul 29, 2008 at 12:21 GMT)
Holy Heavenly Beams of Light, Christian Bale!

J.C. Smith   (Jul 29, 2008 at 13:03 GMT)
This stuff looks incredible.

Christian S   (Jul 29, 2008 at 13:12 GMT)
This is really cool stuff Matt.

The 2nd face surface reminds me a bit of the skins in Age of Conan ;)

Kory James   (Jul 29, 2008 at 13:19 GMT)   Resource Rating: 5
This looks amazing, can't wait to see more keep up the great work
Edited on Jul 29, 2008 13:20 GMT

Pat Wilson   (Jul 29, 2008 at 15:24 GMT)
That looks sweet.

I'm really interested in the SSAO especially, because I've been poking at the idea of downsampling both the depth and the N.L * Atten buffer. The downsampled depth can be used for the SSAO (if the technique requires it), and the downsampled luminance buffer could be processed similar to SSAO to generate a screen space global illumination effect.

Any more info on the light extrusion effect?

Taylor Petrick   (Jul 29, 2008 at 15:47 GMT)
Are you planning on releasing any of your code, specifically the light rays? Every time I look that them it makes me wanna put them in my game. =D

Matt Vitelli   (Jul 29, 2008 at 16:09 GMT)
Pat,

The major problem I've found when working on depth-based ambient occlusion has been the precision required for the effect. Perhaps with some algorithms, R32 precision is unnecessary and an 8-bit single channel would be just fine. Screen-Space Global Illumination though, that's a neat idea. Would you be employing some type of screen-space ray tracing?

Taylor,

I'm considering it. I really want to get it to a level that gives the user complete control in modifying every detail.

Kenneth Holst   (Jul 29, 2008 at 17:13 GMT)
This is really coool stuff, Matt! Thanks for sharing

Koushik   (Jul 30, 2008 at 00:20 GMT)
Great work!

For SSAO, are you using the depth buffer-only route to save on memory and speed?

I'm working on my own implementation of SSAO for TGE. Using only depth comparison can yield some artifacts. In fact, I think that is one of the reasons that your model gives the per-vertex-shading effect, which makes it look a little flat.

You might want to output the screen-space normal out as well. You might want to bias the sampling for the occlusion points using the normals. That gives better results and removes artifacts.

I'm trying to finish up a post-process framework for TGE soon. I guess I'll be posting more stuff on my blog, and although the source would be GLSL, the algorithm should be the same.

Keep up the good work!

Matt Vitelli   (Jul 30, 2008 at 00:47 GMT)
Koushik,

I'm using a combination of a depth buffer and normals. That image is just using the depth buffer, though the full algorithm uses a combination of the two.

I'll be really eager to see your algorithm when it is finished. Post-processing in general is extremely exciting and it's always great to see different techniques.

Frank Bignone   (Jul 30, 2008 at 04:52 GMT)
@Matt: very nice effect. by the way, i still have an issue when using FSAA and FullScreen Shader (www.garagegames.com/mg/forums/result.thread.php?qt=74388), do you have the same on your side?

Matt Vitelli   (Jul 30, 2008 at 06:31 GMT)
Well, I know anti-aliasing does not work with multiple render targets(hence why a lot of HDR systems don't work with AA), but I haven't given any FSAA implementations a try. See, anti-aliasing in and of itself is a somewhat hacky solution to emulate smooth edges. What's really great is that with modern GPUs, you can write a fullscreen shader that blurs along edges. ;)

Lorne McIntosh   (Sep 10, 2008 at 02:43 GMT)
Very cool! What sorts of implementations do you think you'd want to use for the light extrusion technology?

If you want some additional resource regarding SSAO I just finished creating my own SSAO shader pack for TGEA. You can check out the video's and screenshots on my website. www.ubiqvisuals.com/index.php?option=com_content&view=article&id=46%C2%A...


Edited on Sep 10, 2008 02:46 GMT

You must be a member and be logged in to either append comments or rate this resource.