Page 1 of 3

Heterogeneous participating media tests

Posted: Sun Nov 01, 2009 8:20 pm
by OnoSendai
So, I've been upgrading the absorption_coefficient_spectrum and scattering_coefficient_spectrum parameters in media to 'proper' parameters, called 'volume parameters'. These can either be constant, (with respect to position), or shaders. In the case of shaders, the shader program can compute more-or-less arbitrary spectra as a function of position.

Here are some tests using a shader to drive the absorption coefficient: (scattering coefficient is zero, so no scattering). There's a cube with IOR 1.0 in the middle of this scene.

Please excuse the noisy renders, I'm working on an old laptop.

Clamped sin wave absorption with phase increasing to the right:
sin_absorption.JPG
sin_absorption.JPG (67.51 KiB) Viewed 19218 times

Code: Select all

<absorption_coefficient>
        <shader>
          <shader>
            <![CDATA[	
						
def eval(vec3 pos) vec3 :
	vec3(
                sin(
                  doti(pos) * 10.0
		)
        )
	]]>
          </shader>
          <wavelength_dependent>false</wavelength_dependent>
        </shader>
Colourful absorption test:
colourful_absorption.JPG
colourful_absorption.JPG (62.24 KiB) Viewed 19223 times

Code: Select all

      <absorption_coefficient>
        <shader>
          <shader>
            <![CDATA[	
						
						def eval(vec3 pos) vec3 :
							vec3(
                  doti(pos) + 1.0,
                  0.0, #doti(pos) + 1.0,
                  1.0 - doti(pos)
              )
						]]>

          </shader>
          <wavelength_dependent>true</wavelength_dependent>
        </shader>
       </absorption_coefficient>

Re: Heterogeneous participating media tests

Posted: Sun Nov 01, 2009 9:58 pm
by WytRaven
Oooooh! Nice! :)

Re: Heterogeneous participating media tests

Posted: Mon Nov 02, 2009 3:54 am
by CTZn
Aaaah yeees !!!

Even though the two examples are only of technical interest there's much more beneath... I can see clouds layers on the first one, and ground fog in the second, yummy
Thanks a lot Ono, how exciting !

Re: Heterogeneous participating media tests

Posted: Mon Nov 02, 2009 4:14 am
by Borgleader
I have a little question about this...would it allow something like, a drop of blood in water? (kind of a gore example but, first thing that came to mind after watching the "SAW" game review)

Re: Heterogeneous participating media tests

Posted: Mon Nov 02, 2009 9:22 am
by OnoSendai
Borgleader wrote:I have a little question about this...would it allow something like, a drop of blood in water? (kind of a gore example but, first thing that came to mind after watching the "SAW" game review)
Sure.. if you can write the shader for it :)

Re: Heterogeneous participating media tests

Posted: Mon Nov 02, 2009 9:29 am
by Borgleader
OnoSendai wrote:
Borgleader wrote:I have a little question about this...would it allow something like, a drop of blood in water? (kind of a gore example but, first thing that came to mind after watching the "SAW" game review)
Sure.. if you can write the shader for it :)
We will assimilate someone to do it for us 8) No but seriously cool stuff :)

Re: Heterogeneous participating media tests

Posted: Fri Nov 06, 2009 11:25 pm
by sweetcement
Smoke, clouds, etc. Explosions. Air pollution.

I remember the cloudy sky tests a couple of years ago -- used a noise to simulate clouds, looked pretty good.

What would be really interesting is if we could manipulate index of refraction by position...atmospheric media to simulate the sun getting squashed looking during sunset, etc.

Or an atmospheric gradient that is steeper, so it makes the horizon curve up, like some estimates said would be seen by space probes that landed on Venus.

Or mirages, or simulating the horizon on a flat earth, or a world much larger than earth -- atmospheric refraction would make it look like the world was a shallow bowl, since the rays of light near the horizon would follow curved paths because of atmospheric density gradients.

Re: Heterogeneous participating media tests

Posted: Sat Nov 07, 2009 11:23 am
by OnoSendai
sweetcement wrote:Smoke, clouds, etc. Explosions. Air pollution.

I remember the cloudy sky tests a couple of years ago -- used a noise to simulate clouds, looked pretty good.

What would be really interesting is if we could manipulate index of refraction by position...atmospheric media to simulate the sun getting squashed looking during sunset, etc.

Or an atmospheric gradient that is steeper, so it makes the horizon curve up, like some estimates said would be seen by space probes that landed on Venus.

Or mirages, or simulating the horizon on a flat earth, or a world much larger than earth -- atmospheric refraction would make it look like the world was a shallow bowl, since the rays of light near the horizon would follow curved paths because of atmospheric density gradients.
I don't think I'll allow modification of the IOR anytime soon, because it makes the ray paths non-linear as you said. Although it would allow some cool effects I guess :)

Re: Heterogeneous participating media tests

Posted: Sat Nov 07, 2009 11:30 am
by psor
OnoSendai wrote:I don't think I'll allow modification of the IOR anytime soon, because it makes the ray paths non-linear as you said. Although it would allow some cool effects I guess :)

What would happen then? :twisted: :wink:




take care
psor

Re: Heterogeneous participating media tests

Posted: Sat Nov 07, 2009 11:52 am
by OnoSendai
If you allow modification of the IOR, you can simulate stuff like heat haze, mirages etc..

Re: Heterogeneous participating media tests

Posted: Sat Nov 07, 2009 11:55 am
by benn
Could we also hack up relativistic effects with that? ;D Bendy stick renders!

Re: Heterogeneous participating media tests

Posted: Sat Nov 07, 2009 11:57 am
by psor
@Nik

Well that's what sweetcement said, then you said ...
OnoSendai wrote:I don't think I'll allow modification of the IOR anytime soon, because it makes the ray paths non-linear as you said.

... and then I said ...
psor wrote: What would happen then?
More to read as why wouldn't you wanna allow that. Is there a side effect you want to avoid? :? ;)





take care
psor

Re: Heterogeneous participating media tests

Posted: Sat Nov 07, 2009 8:39 pm
by lycium
benn wrote:Could we also hack up relativistic effects with that? ;D Bendy stick renders!
actually, i'm just busy learning about that this evening...

Re: Heterogeneous participating media tests

Posted: Sun Nov 08, 2009 3:07 pm
by neo0.
Will this only be available to people who know ISL?

Re: Heterogeneous participating media tests

Posted: Sun Nov 08, 2009 3:19 pm
by lycium
edit: see nick's reply on next page