Improved light scattering GLSL filter

Just Been Playing around with the code for the light scattering filter and have managed to achieve this. I thought I’d share.

Tested with nVidia card, and have confirmation of working on ATI.

Tested with Blender 2.65a.

GodRays.blend (852 KB)



Is that the code i’m seeing very intresting

Very nice, thanks for sharing.

I think something is going on when using different resolution. The rays act as expected when the viewport is a part of the window, but when maximized the rays act strange, the direction of the rays seem wrong, anyhow I would expect the rays behave the same independently of the resolution.

Windowed (as expected):

Maximized (strange direction of the rays):

Or maybe the maximized view is the correct behavior since the rays seems centered, not sure.

The Xpos/Ypos affects that, its currently set to render at 1920x1080, you can play with the settings to find the correct light position.

i’d make it dynamic to change according to window width, I just don’t have the time atm.

Ah, I see that now, thanks alot, this is really useful!

Damn man, looking nice.

What fps do you get?

ATI work and i have 60 fps

Hmm. Now that I’ve actually got a change to look at it, it won’t work. Using 2.65a.

great filter CTBM!
Is this filter free to use? How about commercial usage?

use however you like, this is open source software isn’t it ? :smiley:

well the software! but your blendfile and your code is under the licence you pusblish it! als long you do not bundle your code within the blenderplayer.exe you have full copyright to it!

but thanks :slight_smile:

Many thanks for this. I love these ‘plug and play’ type filters that don’t require any setup and run relativity fast. Adds a nice touch to scenes and you exposed just enough variables to make it nicely tweakable.

wow klauser how did you do?
Thanks CTMB

I’ve never once used the “save to runtime” feature. i prefer compiling the code modules and encrypting the blends and using a launcher made in C++.

Any thoughts on it not running on my computer?

i dont know your computer.

could either be a resolution issue which can be fixed with adjusting the Xpos or Ypos. or its a graphics / OpenGL related issue.

Looks very nice,got to try it myself.

To get this to work on Linux, just add

#version 120

to the top of the shader file.

Great work, by the way!

Very nice!

I got it working on Win7 / NVidia GT650M by adding the “#version 120” code, too!
Blender 2.65a: 12 fps
Blender 2.66: between 11 and 14 fps

… probably my laptop is not the fastest computer ever! :eyebrowlift2: