PDA

View Full Version : Sunbeams in Crysis



Leadwerks
03-09-2008, 10:51 PM
How would you go about implementing this kind of effect? I have shadowmapping done, and I am guessing this uses the shadowmap to brighten the screen in a final pass, but I am not sure how:
http://youtube.com/watch?v=W0G2b6TabyQ

Ilian Dinev
03-10-2008, 01:22 AM
See the squid in 2:56 here: http://www.youtube.com/watch?v=OAYg8bzehPQ&feature=related
Maybe this hints the effect is like radial blur, with black color. It's a post-processing effect alright. Then again, .pak files are .zip...

despoke
03-10-2008, 05:46 AM
Isn't it a post processing effect called God-rays?
GPU gems 3 has an article about that (chapter 13, Volumetric Light Scattering as a Post-Process).

-NiCo-
03-10-2008, 06:01 AM
Isn't it a post processing effect called God-rays?


Yes it is. And like Ilian Dinev said, it's some kind of radial blurring effect. Nvidia used it in their Nalu demo for GF6 cards.

nicolasbol
12-17-2008, 09:36 AM
I experimented GPU Gems 3: Kenny Mitchell's 2D post effect technique. The result was pretty good, the only drawback is that you lose the god's ray is the sun is in your back.

I prefer it to the light volume technique described by Jason Mitchell in "Light Shaft Rendering" ShadersX3 . Mostly because it's easier to implement and it doesn't make your GPU melt.

I published the source code and a little explanation of the process with openGL:

http://fabiensanglard.net/lightScattering/

Brolingstanz
12-17-2008, 10:18 AM
The Gems 3 technique does require a rather large-ish kernel for good effect (better perf with smaller/downsampled image). Though I think it's incredibly effective given it's simplicity (post process only, no preprocessing whatsoever). (Btw, GPU Gems 3 is online now.)

HellRaiZer
12-18-2008, 01:09 AM
As everyone above me said, Crysis uses a postprocessing shader which performs radial blur on a "masked" framebuffer (masked = all foreground objects in black, with a colorful background/sky).

If you are interested in a more correct approach with less artifacts, you can take a look at nvidia's Volume Light demo (http://developer.download.nvidia.com/SDK/10.5/direct3d/samples.html#VolumeLight). They are tracing rays from the eye to the first intersection in the scene (depth buffer), and use the shadowmap for checking how many samples are in the shadow and how many are lit. Check the paper for more details.

The problem with this approach is that the final effect looks more like volumetric fog, instead of god rays, for open environments. You can always modify the shader to match Crysis' god rays if you want, but the paper doesn't mention that.

Hope that helps.

HellRaiZer

sqrt[-1]
12-18-2008, 11:04 PM
That is a very nice demo nicolasbol. Thanks for sharing.

_NK47
12-19-2008, 03:06 AM
amazing sample. thanks alot nicolasbol. unfortunately it crashed my system on Radeon HD 2400 Pro - WinXP. ;(

Eosie
12-19-2008, 01:42 PM
Same here. It seems not to be working on ATI. The FBO path crashes the driver, the texture-copy path surely does something, but it's still far from god rays. :)

nicolasbol
12-20-2008, 12:26 PM
Sorry guys, I don't have any ATI GPU available to test :( !

Although I believe you, I don't understand why the FBO is working on NVidia an not ATi. I used only standard ARB methods.

I suspect the issue to be with the shader. If anyone can try to start from the command line, you should be able to see shader compilation errors...

Hopefully someone with an ATI will dive in my code....if Santa brings me a Radeon HD 4870, I promise I will will fix it.

Mikkel Gjoel
12-21-2008, 07:40 PM
Check out the discussion on this demoscene forum

http://pouet.net/topic.php?which=4964&page=1&x=6&y=11

- or wait for Nvidia to release chapter 13 of GPU Gems3... or just go buy it :)

http://http.developer.nvidia.com/GPUGems3/gpugems3_pref01.html