Game Development Community

dev|Pro Game Development Curriculum

TGEA Advanced Shaders (Image Heavy)

by Matt Vitelli · 11/09/2008 (5:42 pm) · 11 comments

I've been working hard on post processes since late June. Only recently have I implemented many of the effects TGEA users have desired for years. This has taken a great many months, but things are finally coming together. I've learned powerful lessons and valuable techniques for working with image-space. Below is a compilation of the past few months.


God-Rays
Similar to my light-extrusion mapping from an earlier plan, only this creates one based on objects in the scene and collision intersections with the sun.

i63.photobucket.com/albums/h138/eternaldark112/GodRays.png
Motion-Blur

This uses the good ol' frame-to-frame blur method. An example of this can be found in RenderMonkey.

i63.photobucket.com/albums/h138/eternaldark112/MotionBlur.png

Real-Time Atmospheric Day and Night Cycles and Dynamic Atlas Shadows

Video Here
This is useful for realistic day and night cycles. The sun is dynamically generated using a shader and the entire sky uses 3 lookup tables. This is a performance enhancement compared to the many textures used in the original skybox class. It also is visually more appealing.

Dynamic atlas shadows are also part of this. Unfortunately, I have no video of this in action, though it can be clearly seen in the screenshots. The shadowing uses a height-tracing algorithm similar to relief mapping. This has some benefits to standard shadow mapping, but also some disadvantages visually. Ambient-occlusion is also calculated in the shader.

Day
i63.photobucket.com/albums/h138/eternaldark112/Day.png
Sunset
i63.photobucket.com/albums/h138/eternaldark112/Sunset.png
Night
i63.photobucket.com/albums/h138/eternaldark112/Night.png

Atmospheric Glare Using Diffraction
Essentially, this is the effect seen when a viewer squints their eyes at a light source. The halo gets skewed in seemingly random directions when you squint your eyes, creating a cross in glare.

i63.photobucket.com/albums/h138/eternaldark112/GlareEffects.png
Depth of Field
Pretty good technique, but it requires a high-precision, high-resolution depth map for quality. (R32 texture-type)

i63.photobucket.com/albums/h138/eternaldark112/DepthofField.png
Normal-Based Screen Space Ambient Occlusion
This is similar to the traditional depth-based approach, only it is done using the normal-angles to calculate occlusion. It tends to be more accurate and gives better results and less of the "black aura" that's seen in depth-map based approaches.

Without AO
i63.photobucket.com/albums/h138/eternaldark112/WithoutAO.png
With AO
i63.photobucket.com/albums/h138/eternaldark112/WithAO.png

#1
11/09/2008 (6:04 pm)
one word (not including these, of course)... AMAZING
#2
11/09/2008 (8:08 pm)
Very cool .plan Matt. Thanks for sharing =)
#4
11/09/2008 (8:35 pm)
god work !
#5
11/10/2008 (12:50 am)
Very nice. The day/night transitions are great, that would be good for any RPGs out there. If you decide you want to license that out, poke me.
#6
11/10/2008 (3:08 am)
Impressive!
#7
11/10/2008 (9:39 am)
Very cool!! Although I like all your work, I'm really interested in the day/night system. Is there any chance you'll be making your work available for others? Again, great work!
#8
11/10/2008 (2:12 pm)
WOAH!
#9
11/10/2008 (4:17 pm)
Wow, some awesome effects. But what's with the bands across the terrain in the AO effect?
#10
11/10/2008 (4:33 pm)
Morrock, basically there's not enough of a change in the normals (since right now its per-vertex, and that's a low-res mesh) so you get banding effects.
#11
11/12/2008 (7:50 am)
Great work! A couple of quick notes.

Have you tried implementing pixel-motion blur? Like (I know, I know.. :) .....) the project offset guys?

And about the SSAO, why don't you try blurring the end image a couple of times more to smooth them out, before blending it with the color. Could you elaborate a bit on how differently you're doing it, I might be able to give you a few ideas. I've tried implementing SSAO with a deferred shading system - with decent results.

As a matter of fact, (dont know If I've mentioned this earlier to you), I did implement SSAO with TGE and OpenGL. You can take a look at a sample here:

koushikremains.googlepages.com/ssaosample.JPG
If you look closely, you'll realize that its Kork running around in the "interior lighting Demo" level. You can see the per-vertexness (for want of a better term) in there. I managed to offset this by rendering the normals out (not in TGE, I redid the implementation elsewhere) and using them to adjust the occlusion terms, determined from the depth map (rendered in a previous pass, or using MRT/ FBOs). Maybe I'll port it to TGE now that I'm going to be getting some more free time soon... (fingers crossed)