General Volumetric Fog

@julien-moreau

how would you recommend doing some fast volumetric fog with 6 point lights interacting?

Should I just follow along with: Volumetric lights - Alexandre Pestana and do a loop for each light?

I tired with the Use the Volumetric LightScattering post-process - Babylon.js Documentation but that seemed to make more glitches in my PBR materials than anything.

3 Likes

@Pryme8, an unconventional approach, from the falcon - as usual.

Put a box of frosted glass around the camera?

GREAT random refractions in transluscent 2D Plane experiments recently. Next, attempt is to BOX THE CAMERA… like 2D filters. Just in 3D.

A static box around a cam.

It is imprecise. But might work for “general fog” (and other things).

And you could make certain directions always… more or less foggy.

And change the fog-box based on zone.

:eagle:

: )

why you challenge me :slight_smile:

1 Like

@aFalcon

Ive had a raymarch solution for a while its just not done yet.
https://www.babylonjs-playground.com/#1UWAVK#28

I have not been able to get a raymarched solution working in the manor that I want, I was close at one point I just cant get the “slices” to line up correct and have been struggling getting the depth pass to work as well…

Been getting close but dont have the time to really hammer in on it.

Calling batman (for a friend). : )

Nas starts the concept of “challenges”. So, it is for your joy.

CONCEPTS: for general fog

Do you have a good fog already? Better than Falcons unconventional CAMBOX (no doubt).


@Pryme8 - that RAYMARCH PG is AWESOME (wish I understood it) so diving in.

This was the inspiration of the CAMBOX BTW (THANKS - and perfect starting point).

Also I learn RayMarching from you.


Notion is to INVERT IT - and put the CAM inside… then POS CAMBOX TO CAM.

What would the effect be?? Might it look foggy?

I try as ROOKIE. Looking…

  • flip to inside box not outside

  • decrease alpha

  • add blending (ONEONE or MAXIMIZED)

would it look like (simple) atmospherics?

Trying…

Awwww, dude I did not know :slight_smile: that kinda makes me happy. I might not be the guy to teach you really, but I am glad that I could introduce you to something so interesting.

If you have any questions or confusion on things let me know, I can prolly help with what to look up at least.

1 Like

Got it! The effect works. Your RayMarch GREAT starting point.

Put the CAM in a BOX, invert the culling, drop the alpha, BLEND more, and ANM UV.

https://www.babylonjs-playground.com/#2Y9FB9

This code is really nice… best way to learn shaders (for me). :pray:

Visualizes concept of FOGBOX.

LIKE! : )

Check this out out too, I forgot I added uniforms controls
https://www.babylonjs-playground.com/#1UWAVK#25

You should be able to go “inside” of this box as well.

I also need to get some script in there to pull it out of a death spiral of steps and do a more loose approximation so when you are all up in it the FPS does not drop.

Also, the main hitch is still the plane alignment, I think I have the depth stuff figured out in another demo that I can dig up.

I’m just worried this solution is not performant enough due to the procedural noise, and that I should shift to a volume map.

This is what I am basing it off of:

1 Like

@Pryme8
Unfortunately it is now intended to work with multiple lights at the moment :frowning:
Also, it works only with spot light.
I recommande, for point lights, to adopt a ray marching method but the problem stays the same: you’ll need 6 shadow maps per light and compute Ray marching for each. This require a lot of gpu power. Maybe @Deltakosh or @sebavan have an idea, let’s try :slight_smile:

Not on my side unfortunately.

1 Like

What about a cheap version?
https://www.babylonjs-playground.com/#BHNVUE#2

1 Like

I might be able to make that work. <3 Its not really want I want but its the best for client considerations.

1 Like