Progressive Fog Density
Progressive Fog Density
Hi,
I need to create a fog material but the actual medium system is not accurate enough for the purpose.
What I need is that the sphere, or the box containing the fog material/medium becomes less delimitate. that the shape of the box disapears completely.
I mean that the density of the fog should be more progressive, like a much less at the entering of the box, and more and more dense as you aproach the center of the box ( no matter its shape), especially on very large scales ( millions or thousands of millions of kilometers ).
I'm not sure if I explain correctly so I I join an image illustrating what I mean: Imagining both spheres are the same diameter, the sphere on the left is more like the actual model of absorption for the fog, and the sphere on the right would be more like what I need.
Is there a parameter or another way to modify this please ?
I need to create a fog material but the actual medium system is not accurate enough for the purpose.
What I need is that the sphere, or the box containing the fog material/medium becomes less delimitate. that the shape of the box disapears completely.
I mean that the density of the fog should be more progressive, like a much less at the entering of the box, and more and more dense as you aproach the center of the box ( no matter its shape), especially on very large scales ( millions or thousands of millions of kilometers ).
I'm not sure if I explain correctly so I I join an image illustrating what I mean: Imagining both spheres are the same diameter, the sphere on the left is more like the actual model of absorption for the fog, and the sphere on the right would be more like what I need.
Is there a parameter or another way to modify this please ?
Re: Progressive Fog Density
That could be very useful for ground mist too!
- thesquirell
- Posts: 428
- Joined: Fri Aug 29, 2014 3:49 am
- Location: Novi Sad, Serbia
Re: Progressive Fog Density
The shape of the box will disappear, or it would look like it, kinda, with the right settings, if you control scattering with fbm ISL shader.
Code example:
def eval(vec3 pos) vec3 :
let
fracNoise = fbm(pos*30.,
in
vec3(if(fracNoise>0.0, fracNoise, 0.0)) * 50.0
Code example:
def eval(vec3 pos) vec3 :
let
fracNoise = fbm(pos*30.,

in
vec3(if(fracNoise>0.0, fracNoise, 0.0)) * 50.0
Re: Progressive Fog Density
Thanks Squirell, but since I am completely new with ISL, could you explain me what part of this code is doing what ? and exemples of values that I should change, please ? 
Edit: Well I get the changes and I'm approaching the results I was looking for thank you man ! But I guess you could still explain more if you want to, so that anyone gets it better

Edit: Well I get the changes and I'm approaching the results I was looking for thank you man ! But I guess you could still explain more if you want to, so that anyone gets it better

-
- Posts: 512
- Joined: Wed May 02, 2007 11:34 am
Re: Progressive Fog Density
I've gotten this to work before, for a sphere at least, using a distance (dist) function as in the attached.
the x, y, and z params determine the center of the sphere and the radius is the distance of the falloff. Not sure if this is exactly what you are asking for, but maybe it will help?
you could adapt it to box geometry too, you'd need to combine variations of it for each dimension of your box (x,y,z individually)
the x, y, and z params determine the center of the sphere and the radius is the distance of the falloff. Not sure if this is exactly what you are asking for, but maybe it will help?
you could adapt it to box geometry too, you'd need to combine variations of it for each dimension of your box (x,y,z individually)
- Attachments
-
- fog fade sphere.igm.zip
- (726 Bytes) Downloaded 1759 times
Re: Progressive Fog Density
Thank you FakeShamus, it seems interesting for spheres, but It won't work for toric shapes for example or other complicate shapes I guess ( But I still can't make it work for a sphere for the moment
so maybe later )

- thesquirell
- Posts: 428
- Joined: Fri Aug 29, 2014 3:49 am
- Location: Novi Sad, Serbia
Re: Progressive Fog Density
Welcome aboard the mysterious ISL train! 
In essence, you will have to play with number, because I can only describe in words what it looks like when messing with them. The number at the end vec3(if(fracNoise>0.0, fracNoise, 0.0)) * 50.0, that *50 will scale up the values, so what you get is a thicker fog, because of the greater scattering. Numbers inside fbm will define the largest feature and detail ammount. Those will depend on the scale of the volume. My suggestion is to reset them all to 1, and then play further with them. If you want that no edge look, then your scene must be engulfed with scattering volume. If it happens that you find yourself outside this volume, you may easily "bump" into the edges. Sorry I couldn't be more of a help here, ISL is like an Icelandic village to me.

In essence, you will have to play with number, because I can only describe in words what it looks like when messing with them. The number at the end vec3(if(fracNoise>0.0, fracNoise, 0.0)) * 50.0, that *50 will scale up the values, so what you get is a thicker fog, because of the greater scattering. Numbers inside fbm will define the largest feature and detail ammount. Those will depend on the scale of the volume. My suggestion is to reset them all to 1, and then play further with them. If you want that no edge look, then your scene must be engulfed with scattering volume. If it happens that you find yourself outside this volume, you may easily "bump" into the edges. Sorry I couldn't be more of a help here, ISL is like an Icelandic village to me.
Re: Progressive Fog Density
You're already of a good help; I played with the numbers and got some nice results; of course depending on the scale of my scene the numbers have to be changed to fit the scene.
I understand that the shape of the box containing the scene will better disappear if it englobes the whole scene; but as it is never as simple as that, in the particular case I'm working on, the SSS shape is seen from the outside, that's why I needed a different scattering model than the original.
But I'm approaching what I needed with that code you post TheSquirell, it's a matter of playing with numbers as you said
Edit: Also this code seem great for mist as it allows the fog to be unevenly disposed like volutes of vapour
I understand that the shape of the box containing the scene will better disappear if it englobes the whole scene; but as it is never as simple as that, in the particular case I'm working on, the SSS shape is seen from the outside, that's why I needed a different scattering model than the original.
But I'm approaching what I needed with that code you post TheSquirell, it's a matter of playing with numbers as you said
Edit: Also this code seem great for mist as it allows the fog to be unevenly disposed like volutes of vapour
Re: Progressive Fog Density
How to make that with cube to achieve volume fog/mist, denser on the ground?
Re: Progressive Fog Density
Eneen : Try to put the middle of the height of the fog box at the ground level, and adjust its height, and the values to get the result your looking for ?
That's my little test here : By the way if yonosoy comes around, this is officially my first success with visible god rays on a simple render
That's my little test here : By the way if yonosoy comes around, this is officially my first success with visible god rays on a simple render

Re: Progressive Fog Density
Boom!
like this a lot!


Re: Progressive Fog Density
Congratulations Onizuka and thank you the squirrel, more code to play...
"... nor 0.2 galaxys, nor 0.8 little chikens ..."
Re: Progressive Fog Density
Thank you guys 
What do you mean yonosoy ?

What do you mean yonosoy ?
Who is online
Users browsing this forum: No registered users and 32 guests