Mist material

Come here for help & support.
chubakueno
Posts: 34
Joined: Wed Jun 03, 2009 9:42 am

Mist material

Post by chubakueno » Wed Jun 23, 2010 2:46 pm

I was trying to get some mist like this:
normal_un-arbre-seul-dans-la-brume.jpg
And I get this material:
MIST.jpg
As you will see at the base of the sphere the mist material is almost transparent, that's because the paper es above the sphere's base, but the material should be volumetric
And sorry for my poor english :roll: :mrgreen:
edit: Mist material

Code: Select all

<medium>
		<name>Unnamed</name>
		<precedence>2</precedence>
		<basic>
			<ior>1.0001</ior>
			<cauchy_b_coeff>0</cauchy_b_coeff>
			<absorption_coefficient_spectrum>
				<uniform>
					<value>0</value>
				</uniform>
			</absorption_coefficient_spectrum>
		</basic>
	</medium>
	<material>
		<name>Fog</name>
		<glossy_transparent>
			<exponent>
				<constant>
					5000
				</constant>
			</exponent>
			<internal_medium_name>Unnamed</internal_medium_name>
			<absorption_layer_transmittance>
				<shader>
					<shader><![CDATA[def eval(vec3 pos) vec3 :
	vec3(
if(
dotk(pos)>1.0,
0.0,
add(dotk(pos),0.2)
)
)]]></shader>
				</shader>
			</absorption_layer_transmittance>
			<layer>0</layer>
		</glossy_transparent>
	</material>
Attachments
Arbre-brume.jpg

StompinTom
Indigo 100
Posts: 1828
Joined: Mon Sep 04, 2006 3:33 pm

Re: Mist material

Post by StompinTom » Wed Jun 23, 2010 3:14 pm

You need to use an SSS material. So something like IOR 1.0 (doesn't need to refract light) and a Uniform scattering factor of 0.01 or something.

chubakueno
Posts: 34
Joined: Wed Jun 03, 2009 9:42 am

Re: Mist material

Post by chubakueno » Wed Jun 23, 2010 3:20 pm

With 0.0 IOR I get this result:
MISTior0.jpg
edit 1.0, but the image is correct

StompinTom
Indigo 100
Posts: 1828
Joined: Mon Sep 04, 2006 3:33 pm

Re: Mist material

Post by StompinTom » Wed Jun 23, 2010 3:38 pm

StompinTom wrote:You need to use an SSS material. So something like IOR 1.0 (doesn't need to refract light) and a Uniform scattering factor of 0.01 or something.
I'm not sure if 0 is physically possible. Mist is basically just light scattering. There's is some refraction, I'm sure, but for all intents and purposes it's just air that's dusty. So scattering does all the work for you.
Attachments
mist.jpg

chubakueno
Posts: 34
Joined: Wed Jun 03, 2009 9:42 am

Re: Mist material

Post by chubakueno » Wed Jun 23, 2010 3:49 pm

Yes, but the floor mist is what I'm trying to achieve and the only way that I have found to do it is with heterogeneus participating media.

StompinTom
Indigo 100
Posts: 1828
Joined: Mon Sep 04, 2006 3:33 pm

Re: Mist material

Post by StompinTom » Wed Jun 23, 2010 4:31 pm

chubakueno wrote:Yes, but the floor mist is what I'm trying to achieve and the only way that I have found to do it is with heterogeneus participating media.
So, instead of modulating the IOR as you move from the bottom up (IOR 1.0 to 0.0), change the scattering instead (0.01 to 0.00) so the higher the mist is, the less it scatters, therefore the clearer it appears. I'm just pointing out what settings make that effect. For fog, the IOR should always stay at 1.0.

StompinTom
Indigo 100
Posts: 1828
Joined: Mon Sep 04, 2006 3:33 pm

Re: Mist material

Post by StompinTom » Wed Jun 23, 2010 4:44 pm

For example:

Code: Select all

	<medium>
		<name>mist-medium</name>
		<precedence>10</precedence>
		<basic>
			<ior>1</ior>
			<cauchy_b_coeff>0</cauchy_b_coeff>
			<absorption_coefficient_spectrum>
				<uniform>
					<value>0.001000</value>
				</uniform>
			</absorption_coefficient_spectrum>
			<subsurface_scattering>
				<scattering_coefficient_spectrum>
                                     <shader>
                                          <shader><![CDATA[def eval(vec3 pos) vec3 :
                                      vec3(
                                           if(
                                                dotk(pos)>1.0, 0.0,
                                                add(dotk(pos),0.2)
                                              )
                                         )]]></shader>
                                    </shader>
				</scattering_coefficient_spectrum>
				<phase_function>
					<uniform/>
				</phase_function>
			</subsurface_scattering>
		</basic>
	</medium>
	<material>
		<name>mist</name>
		<specular>
			<transparent>true</transparent>
			<internal_medium_name>mist-medium</internal_medium_name>
		</specular>
	</material>
Or something like that. Haven't tried it and I'm shit with code, but that's the gist of what I think it may be.

User avatar
Borgleader
Posts: 2149
Joined: Mon Jun 16, 2008 10:48 am

Re: Mist material

Post by Borgleader » Wed Jun 23, 2010 5:11 pm

First error I got was "could not find roor "scenedata"" so i added the <scenedata> ... </scenedata> tags before and after the code.

then i got:
SceneLoaderExcep: Found unexpected element 'shader'. (In element 'scattering_coefficient_spectrum', around line 14, column 13)

:?
benn hired a mercenary to kill my sig...

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Re: Mist material

Post by CTZn » Wed Jun 23, 2010 11:57 pm

Wrong assertion I wrote:Heterogeneous participating media were demonstrated to work with Indigo long ago, but the feature is still not present/exposed in current builds (perhaps for speed concerns ?).

Myself am much anticipating heterogeneous participating media :)
As noted below, Indigo 2.4.3 is exposing the feature.

You also want to avoid specular/glossy volumes to intersect with simple surfaces, as such intersections are opening the volume and therefore do lead to incorrect results. Either reduce the radius of the sphere or move it up in order to manage a space superior to 0.2mm above the ground, for safety.
Last edited by CTZn on Wed Jun 30, 2010 5:59 am, edited 1 time in total.
obsolete asset

StompinTom
Indigo 100
Posts: 1828
Joined: Mon Sep 04, 2006 3:33 pm

Re: Mist material

Post by StompinTom » Thu Jun 24, 2010 12:47 am

Borgleader wrote:First error I got was "could not find roor "scenedata"" so i added the <scenedata> ... </scenedata> tags before and after the code.

then i got:
SceneLoaderExcep: Found unexpected element 'shader'. (In element 'scattering_coefficient_spectrum', around line 14, column 13)

:?
Oh there's no way that I got it perfectly right. I was just showing where I think the shader code should go (what parameter needs to change over the height of the object). He was playing with absorption layer transmittance and IOR, where I was trying to show that it's actually the scattering coefficient he's looking for. My two cents!

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Re: Mist material

Post by CTZn » Wed Jun 30, 2010 5:55 am

Hoh, shame on me...

OnoSendaï did introduce heterogeneous participating media with Indigo 2.4.3 ! I bet the shader would be quite "simple".

Still, it's above my head :oops:
obsolete asset

User avatar
fused
Developer
Posts: 3648
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Re: Mist material

Post by fused » Wed Jun 30, 2010 6:33 am

CTZn wrote:Hoh, shame on me...

OnoSendaï did introduce heterogeneous participating media with Indigo 2.4.3 ! I bet the shader would be quite "simple".

Still, it's above my head :oops:
3d fbm decreasing over the z axis (up).

let me do that quickly :)

StompinTom
Indigo 100
Posts: 1828
Joined: Mon Sep 04, 2006 3:33 pm

Re: Mist material

Post by StompinTom » Wed Jun 30, 2010 6:49 am

fused wrote:
CTZn wrote:Hoh, shame on me...

OnoSendaï did introduce heterogeneous participating media with Indigo 2.4.3 ! I bet the shader would be quite "simple".

Still, it's above my head :oops:
3d fbm decreasing over the z axis (up).

let me do that quickly :)
Yessss. But you stick the shader in the <scattering_coefficient_spectrum> under <value>, right?

EDIT: Tutorials on ISL would be amazing. The reference is probably great for people familiar with that kind of coding, but not so for us mere mortals :)

User avatar
fused
Developer
Posts: 3648
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Re: Mist material

Post by fused » Wed Jun 30, 2010 6:54 am

StompinTom wrote:
fused wrote:
CTZn wrote:Hoh, shame on me...

OnoSendaï did introduce heterogeneous participating media with Indigo 2.4.3 ! I bet the shader would be quite "simple".

Still, it's above my head :oops:
3d fbm decreasing over the z axis (up).

let me do that quickly :)
Yessss. But you stick the shader in the <scattering_coefficient_spectrum> under <value>, right?
I think it should absorb a bit, too. otherwise the scattered rays fly around forever.

It has to look like this:

Code: Select all

    <medium>
        <name>MedIndigo Material_mid1</name>
        <precedence>10</precedence>
        <basic>
            <ior>1.000000</ior>
            <cauchy_b_coeff>0.000000</cauchy_b_coeff>
          <absorption_coefficient>
            <shader>
              <shader>
                <![CDATA[   
                def eval(vec3 pos) vec3 :
                   vec3(fbm(pos, 3) * 0.1)
                   #vec3(0.0)
                ]]>
              </shader>
              <wavelength_dependent>false</wavelength_dependent>
            </shader>
          </absorption_coefficient>
          <subsurface_scattering>
            <scattering_coefficient>
              <shader>
                <shader>
                  <![CDATA[   
                def eval(vec3 pos) vec3 :
                   vec3(fbm(pos, 3) * 0.1)
                   #vec3(0.0)
                ]]>
                </shader>
                <wavelength_dependent>false</wavelength_dependent>
              </shader>
            </scattering_coefficient>
            <phase_function>
              <uniform />
            </phase_function>
          </subsurface_scattering>
        </basic>
    </medium>

User avatar
fused
Developer
Posts: 3648
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Re: Mist material

Post by fused » Wed Jun 30, 2010 7:16 am

nevermind guys... its soooooooooooo slow without LLVM (im on x64), it wont even start rendering.

Post Reply
18 posts

Who is online

Users browsing this forum: No registered users and 26 guests