Light scattering effect filter for JME3

Hello monkeys, i’ve been working on a light scattering effect based on the idea in this post



The idea is to render only far objects and to apply a radial blur on the resulting image and blend it with the final render.

That’s what i did. i borrowed the radial blur effect from the Nvidia’s examples because the one i implemented before was not good enough.



Here are the results









You can test it in the last SVN (TestLightScattering)

There are still some glitches (when you face back the light for example), and it’s a bit frame rate greeedy.



I’d be glad to have some feed back

4 Likes

That’s our jmonkeyengine.com front page slide right there!

wow! amazing! Nice work!

Cool stuff! But my video card seems to be turning the terrain into something evil:

Evil Terrain

O_o…Evil ati cards



Maybe i went too far with the decimate modifier in blender…

I think I see the same mesh (NVIDIA GT330M)… I just see a black mountain from the initial pov…

I think you may need to check the normals, they might be incorrect or something.

Beautiful work!

Ok, there where some problems with uv on the mesh. Changed it…;re-textured it…i hope it will work.

Could you test it again, please?

Well I think the terrain still has some problems :confused:



Here is a fix:

Node nod = (Node) scene;

Geometry geo= (Geometry) nod.getChild(0);

TangentBinormalGenerator.generate(geo.getMesh());



Before:



http://www.bilder-space.de/bilder/f99753-1284332705.png



After

http://www.bilder-space.de/bilder/3c819b-1284333002.png

Aah, cool! Thanks, I commited a fix for the test.

Cheers,

Normen

oh cool, thank you Empire Phoenix!!

I don’t get why it worked without generating the tangents on my computer though…

Thats hot!



Plenty of good information over at the blenderartists forum. There was a cool faux IR filter that was posted about, but never had source attached though. All I know about it is it was a combination of the zbuffer (as Sample2D) and Fresnel equation.

It looks beautiful now. Good job!

Looks very good. Congratulations on making this filter @nehon. Is there any implemented method or easy way to disable it when it is hidden behind an opaque object because as it sits, the whole scene goes 100% black if the camera looks at it?

EDIT: Who +1’ed me on this and did not leave a reply? :smiley:

1 Like

Hi Rémy @nehon! inb4 damn AMD card hahah… this time it’s not an AMD card! On a 1 year old core i5 laptop with a dedicated nVidia graphics mobile chip (I’ll try to get the GeFoce or GTX exact model) we get this error with the LightScattering shader, can you fix it pretty please? :smiley:

Thx :smiley:

I’ll look into it

Maybe replace line #33: fragColor =mix(colorRes ,mix( colorRes, res, m_LightDensity),mean);

by

gl_FragColor =mix(colorRes ,mix( colorRes, res, m_LightDensity),mean);

?.. because where is fragColor declared anyway?

Is it in stable?
Because in nightly it’s gl_FragColor and I don’t have the error.

I’m always using what I think is the most up to date nightly build. I just did HELP > CHECK FOR UPDATES and it says there are no updates available. Like I said, I have tested my app on like 15 different computers ranging from laptops to PC’s with very high end cards to lower end cards, to mobile cards, to Intel GMA chipsets and the only place this error appeared was on 2 iMacs that use Radeon HD 5670 and another Radeon HD 5xxx (don’t remember the exact model number) and also it happened for the very first time on a nVidia mobile chipset, it was exactly this crappy mobile chipset: GeForce GT 520MX

Isn’t this the most up to date frag file?? >> https://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core-effects/Common/MatDefs/Post/LightScattering.frag?spec=svn11057&r=11057