Improved light scattering GLSL filter

hey all!

light scattering with update of light position
UPBGE 0.2.5 version.
this takes advantage of HDR and mipmaping:
lightScatter_UP.blend (506.1 KB)

4 Likes

Thanks dude!

1 Like

Sorry, i missed the call.

The blend works! no slowdowns.

Nice job!

1 Like

Bro, can you please tell me step by step how to use this filter and how to change the direction of ligh scatter and most importantly, HOW DO I SET THIS UP, please tell me step by step

Don’t ask me, I am no glsl wizard haha.

Great stuff, thanks!

1 Like

When I Pause my game and go to another scene, everything looks messed up.
Also when I remove the filter ingame it keeps happening.
Any idea how to avoid this?

@ANSH, @a-k-m

You can change the numbers in the lines 6-9 and the quality in the line 21.

Filter lines 13-14 are the screen coordinates of your light object. The file has a scan python script that changes that dynamically in-game. The script looks for a object named ‘sun’ that is the light scattering origin and says the filter if it is in the screen and where.

The “sun” object is hard-coded thus if you change scenes there has to be a object named “sun” in the scene. Use ‘disable filter’ instead of ‘remove filter’ in the actuator. Don’t use pulse mode triggering in a alwaysSensor to apply the filter.

Unfortunately, the messed up optics persists also after using the disable filter actuator.
The problem with the hard coded sun is that you can’t have different scenes with an object that is called exactly the same (sun.001, etc). If I link the sun object to other scenes, it only works if I start the scene directly from blender and not when changing it ingame.
Here is what it looks like, just to give you an idea

Hey dude, I got an idea, if you want then please use this because I know it will 100% work!

Listen, I think you know about one of the premade logic bricks actuator called GAME in BGE/UPBGE, if you dont, let me tell you, it basically starts a whole new game from an independent blend file inside of another game!
I mean that assume your scene 1 is saved in a blend file , and you create your another scene in an whole another blend file, and when you want to change from one blend file to the another, just you any of the sensors and connect it with the another blend file, it will be just like switiching scenes but in reality you will switching between 2 games, and as you are using 2 different game files, then you can name both the light source in both blend files as ‘sun’ ! Therefore you will have a game where even if you switch scenes, then too the light scattering will work!

Hope this helps!

Have you checked “use mipmap” in the filter actuator?
the godrays are removed but you get ‘messed up optics’ ? Try to set the mipmap factor to 0.0 (line 43)
whats your system? What version are you using?
this filter is kinda a hybrid of OP’s and adriansnetlis filters.

lightScan script line 9 should be:

lamp = scene.objects[own["lamp"]]

and you put a prop named ‘lamp’ in the camera(owner) with the name of your light obj as a string “sun”.

1 Like

Hey dude, I had a small question, when i use this shader in UPBGE 2.5, it works good but i want to ask something, whenever I implement light scattering the light rays always face my screens direction, i want it to be like a scaterring from a window where the light scattering position remains constant, I think you might get what i am trying to get, if no, please tell me so…

disable the lightscan update script and…

1 Like

Can you give me a blend file consisting of what you told?

you mean you want the light rays NOT to update is that right?

Yes, I want them to remain at a pre defined space instead of always poiting at the camera

them dont always point to the camera, them aways point to the light object.
@ANSH try this, i still think its a downgrade:
lightScattering.blend (505.8 KB)

Oh ok, so can you give me a blend file where the light rays ARE NOT DOING it?

download

I want the light rays to behave like this

Hello dude? Are you there?