Progressive Fog Density

General discussion about Indigo Materials - material requests, material developement, feedback, etc..
User avatar
Onizuka
Posts: 111
Joined: Thu Jun 19, 2014 3:48 am
Location: Earth

Progressive Fog Density

Post by Onizuka » Tue Sep 06, 2016 6:09 am

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 ?
Attachments
MoreProgressiveFogDensity2.jpg

Eneen
Posts: 165
Joined: Thu Jan 21, 2016 9:32 am

Re: Progressive Fog Density

Post by Eneen » Tue Sep 06, 2016 7:23 am

That could be very useful for ground mist too!

User avatar
thesquirell
Posts: 382
Joined: Fri Aug 29, 2014 3:49 am
Location: Novi Sad, Serbia

Re: Progressive Fog Density

Post by thesquirell » Tue Sep 06, 2016 8:35 am

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., 8)

in

vec3(if(fracNoise>0.0, fracNoise, 0.0)) * 50.0

User avatar
Onizuka
Posts: 111
Joined: Thu Jun 19, 2014 3:48 am
Location: Earth

Re: Progressive Fog Density

Post by Onizuka » Tue Sep 06, 2016 11:42 pm

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 :)

FakeShamus
Posts: 508
Joined: Wed May 02, 2007 11:34 am

Re: Progressive Fog Density

Post by FakeShamus » Wed Sep 07, 2016 2:51 am

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)
Attachments
fog fade sphere.igm.zip
(726 Bytes) Downloaded 191 times

User avatar
Onizuka
Posts: 111
Joined: Thu Jun 19, 2014 3:48 am
Location: Earth

Re: Progressive Fog Density

Post by Onizuka » Wed Sep 07, 2016 3:32 am

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 :roll: so maybe later )

User avatar
thesquirell
Posts: 382
Joined: Fri Aug 29, 2014 3:49 am
Location: Novi Sad, Serbia

Re: Progressive Fog Density

Post by thesquirell » Wed Sep 07, 2016 5:10 am

Welcome aboard the mysterious ISL train! :D

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.

User avatar
Onizuka
Posts: 111
Joined: Thu Jun 19, 2014 3:48 am
Location: Earth

Re: Progressive Fog Density

Post by Onizuka » Wed Sep 07, 2016 5:21 am

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

Eneen
Posts: 165
Joined: Thu Jan 21, 2016 9:32 am

Re: Progressive Fog Density

Post by Eneen » Fri Sep 09, 2016 2:00 am

How to make that with cube to achieve volume fog/mist, denser on the ground?

User avatar
Onizuka
Posts: 111
Joined: Thu Jun 19, 2014 3:48 am
Location: Earth

Re: Progressive Fog Density

Post by Onizuka » Fri Sep 09, 2016 10:46 am

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 ;)
Attachments
Render 00361.jpg

User avatar
arc en ciel
Posts: 138
Joined: Tue Apr 12, 2016 2:33 am

Re: Progressive Fog Density

Post by arc en ciel » Fri Sep 09, 2016 10:59 am

beautiful :o

Eneen
Posts: 165
Joined: Thu Jan 21, 2016 9:32 am

Re: Progressive Fog Density

Post by Eneen » Fri Sep 09, 2016 6:53 pm

Onizuka: wow thanx, I'll try!

User avatar
bubs
2nd Place Winner
Posts: 614
Joined: Fri Jul 22, 2011 8:46 pm
Location: UK

Re: Progressive Fog Density

Post by bubs » Fri Sep 09, 2016 8:54 pm

Boom! :shock: 8) like this a lot!

User avatar
yonosoy
Posts: 491
Joined: Sat Dec 01, 2012 9:45 pm
Location: Spain

Re: Progressive Fog Density

Post by yonosoy » Thu Sep 15, 2016 9:19 pm

Congratulations Onizuka and thank you the squirrel, more code to play...
"... the hamster don't see the wheel, and this wasn't said before." (yoS eidaN "el Olvidao")
"... nor 0.2 galaxys, nor 0.8 little chikens ..."

User avatar
Onizuka
Posts: 111
Joined: Thu Jun 19, 2014 3:48 am
Location: Earth

Re: Progressive Fog Density

Post by Onizuka » Fri Sep 16, 2016 10:58 am

Thank you guys :)
What do you mean yonosoy ?

Post Reply
16 posts

Who is online

Users browsing this forum: No registered users and 0 guests