Page 1 of 2
Mist material
Posted: Wed Jun 23, 2010 2:46 pm
by chubakueno
I was trying to get some mist like this:
And I get this material:
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

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>
Re: Mist material
Posted: Wed Jun 23, 2010 3:14 pm
by StompinTom
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.
Re: Mist material
Posted: Wed Jun 23, 2010 3:20 pm
by chubakueno
With 0.0 IOR I get this result:
edit 1.0, but the image is correct
Re: Mist material
Posted: Wed Jun 23, 2010 3:38 pm
by StompinTom
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.
Re: Mist material
Posted: Wed Jun 23, 2010 3:49 pm
by chubakueno
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.
Re: Mist material
Posted: Wed Jun 23, 2010 4:31 pm
by StompinTom
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.
Re: Mist material
Posted: Wed Jun 23, 2010 4:44 pm
by StompinTom
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.
Re: Mist material
Posted: Wed Jun 23, 2010 5:11 pm
by Borgleader
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)

Re: Mist material
Posted: Wed Jun 23, 2010 11:57 pm
by CTZn
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.
Re: Mist material
Posted: Thu Jun 24, 2010 12:47 am
by StompinTom
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!
Re: Mist material
Posted: Wed Jun 30, 2010 5:55 am
by CTZn
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

Re: Mist material
Posted: Wed Jun 30, 2010 6:33 am
by fused
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

3d fbm decreasing over the z axis (up).
let me do that quickly

Re: Mist material
Posted: Wed Jun 30, 2010 6:49 am
by StompinTom
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

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

Re: Mist material
Posted: Wed Jun 30, 2010 6:54 am
by fused
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

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>
Re: Mist material
Posted: Wed Jun 30, 2010 7:16 am
by fused
nevermind guys... its soooooooooooo slow without LLVM (im on x64), it wont even start rendering.