POV-Ray : Newsgroups : povray.advanced-users : Question about atmospheric media Server Time
2 Nov 2024 13:18:51 EDT (-0400)
  Question about atmospheric media (Message 1 to 9 of 9)  
From: Nieminen Juha
Subject: Question about atmospheric media
Date: 9 Sep 1999 04:20:51
Message: <37d76de3@news.povray.org>
I'm really confused with this media thing. If someone could enlighten me.

  Suppose this simple scene:

//-----------------
global_settings { ambient_light 2 }
camera { location -z*25+y*7 look_at 0 angle 35 }
light_source
{ (-x*10+y*5)*4, 2
  spotlight point_at 0 radius 5 falloff 6
}
plane { y,-2 pigment { checker rgb 1, rgb .5 } }
plane { -z,-2 pigment { checker rgb 1, rgb .5 } }
cylinder { -y*2, y*2, 1 pigment { rgb z } finish { specular .5 } }
//-----------------

  Now I want some media there so that I can see the light beam and the
cylinder casting the shadow on the dust. I add this:

media
{ intervals 20
  scattering { 3, rgb .01 }
  confidence .9999
}

  I get some slightly visible media.
  Now I want to make the media stronger so that I could see a strong bright
white beam of light and a clear shadow of the cylinder on the air.
  I just can't find a way to do it. If I make the color of the scattering
brighter, eg:

  scattering { 3, rgb .05 }

I just get an extremely dark (???) image instead of getting a brighter one.
  If I specify density, that doesn't help either. With a higher density
(eg. density { rgb 4 }) I get a dark image and with a lower density (eg.
density { rgb .1 }) I get an almost invisible media. Modifying the density
seems to work exactly like modifying the color of the scattering.
  Changing the type of scattering (from the type 3 I used here) doesn't help
either. I'm running out of parameters to modify...

  How can I get a bright white beam of light? I just can't figure it out.
With the atmosphere in povray3.0 it was easy.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Margus Ramst
Subject: Re: Question about atmospheric media
Date: 9 Sep 1999 05:27:52
Message: <37D77D75.8EA5D890@peak.edu.ee>
I am by no means an expert, but here are some suggestions.
The reason you get a dark image is quite obvious: the media is very
thick. Decreasing extinction will make the image lighter, but it will
not make the media more transparent. A highly directional scattering
model would help, but only when viewed at certain angles, i.e. nearly
parallel or anti-parallel. Another way would be to increase the
intensity of the light source - I see no reason why this shouldn't make
the light cone brighter.
The way density/colour_map and scattering/emission/absorption values
work together is pretty simple; if I'm not mistaken they are simply
multiplied together.

Margus


Nieminen Juha wrote:
> 
>   I'm really confused with this media thing. If someone could enlighten me.
> 
>   Suppose this simple scene:
> 
> //-----------------
> global_settings { ambient_light 2 }
> camera { location -z*25+y*7 look_at 0 angle 35 }
> light_source
> { (-x*10+y*5)*4, 2
>   spotlight point_at 0 radius 5 falloff 6
> }
> plane { y,-2 pigment { checker rgb 1, rgb .5 } }
> plane { -z,-2 pigment { checker rgb 1, rgb .5 } }
> cylinder { -y*2, y*2, 1 pigment { rgb z } finish { specular .5 } }
> //-----------------
> 
>   Now I want some media there so that I can see the light beam and the
> cylinder casting the shadow on the dust. I add this:
> 
> media
> { intervals 20
>   scattering { 3, rgb .01 }
>   confidence .9999
> }
> 
>   I get some slightly visible media.
>   Now I want to make the media stronger so that I could see a strong bright
> white beam of light and a clear shadow of the cylinder on the air.
>   I just can't find a way to do it. If I make the color of the scattering
> brighter, eg:
> 
>   scattering { 3, rgb .05 }
> 
> I just get an extremely dark (???) image instead of getting a brighter one.
>   If I specify density, that doesn't help either. With a higher density
> (eg. density { rgb 4 }) I get a dark image and with a lower density (eg.
> density { rgb .1 }) I get an almost invisible media. Modifying the density
> seems to work exactly like modifying the color of the scattering.
>   Changing the type of scattering (from the type 3 I used here) doesn't help
> either. I'm running out of parameters to modify...
> 
>   How can I get a bright white beam of light? I just can't figure it out.
> With the atmosphere in povray3.0 it was easy.
> 
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ken
Subject: Re: Question about atmospheric media
Date: 9 Sep 1999 06:00:47
Message: <37D784ED.A96D5292@pacbell.net>
Nieminen Juha wrote:
> 
>   I'm really confused with this media thing. If someone could enlighten me.

http://members.xoom.com/POVRAY3/media2.html

-- 
Ken Tyler

See my 850+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Nieminen Juha
Subject: Re: Question about atmospheric media
Date: 9 Sep 1999 06:03:18
Message: <37d785e6@news.povray.org>
Margus Ramst <mar### [at] peakeduee> wrote:
: Another way would be to increase the
: intensity of the light source - I see no reason why this shouldn't make
: the light cone brighter.

  The problem with this is that it will illuminate the objects too much, ie.
there will be too much contrast which isn't very nice.
  I still haven't a good solution.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Margus Ramst
Subject: Re: Question about atmospheric media
Date: 9 Sep 1999 06:21:17
Message: <37D78A09.4F4409E3@peak.edu.ee>
Then I can suggest only two options:
1) Use some clever bounding or the Superpatch's light groups (I think
you understand what I have in mind);
2) Use a cone to contain the media.
Other than that, what you want contradicts the way POV's media works.
You cannot have a diffuse (non-directional) scattering model, bright
scattered light and a transparent (thin) media all together. AFAIK, this
applies in Real Life, too.

Margus

Nieminen Juha wrote:
> 
> Margus Ramst <mar### [at] peakeduee> wrote:
> : Another way would be to increase the
> : intensity of the light source - I see no reason why this shouldn't make
> : the light cone brighter.
> 
>   The problem with this is that it will illuminate the objects too much, ie.
> there will be too much contrast which isn't very nice.
>   I still haven't a good solution.
> 
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Nieminen Juha
Subject: Re: Question about atmospheric media
Date: 9 Sep 1999 08:11:00
Message: <37d7a3d4@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
: http://members.xoom.com/POVRAY3/media2.html

  Yes, the answer was there. The extinction value is the one:

global_settings { ambient_light 2 }
camera { location -z*25+y*7 look_at 0 angle 35 }
light_source
{ (-x*10+y*5)*4, 2
  spotlight point_at 0 radius 5 falloff 6
}
plane { y,-2 pigment { checker rgb 1, rgb .5 } }
plane { -z,-2 pigment { checker rgb 1, rgb .5 } }
cylinder { -y*2, y*2, 1 pigment { rgb z } finish { specular .5 } }

media
{ intervals 20
  scattering { 3, rgb .1 extinction .1 }
  confidence .9999
}

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Peter Popov
Subject: Re: Question about atmospheric media
Date: 9 Sep 1999 19:51:47
Message: <mI7XN6MFA3UOyv9FCSkQhs=cXtKE@4ax.com>
On 9 Sep 1999 04:20:51 -0400, Nieminen Juha <war### [at] cctutfi> wrote:

Warp,

with time I was able to come up with en empiric formula for the
calculation of the color of a media sample. Here it goes in
pseudocode:


D = GetDensityColor(Density, SamplePosition);


For emission:

E = EmissionColor * D;

The final ray color is the average of all sample colors. This adds up
with whatever color the ray gets after passing through the media
container. Therefore a yellow emititon media on a blue background will
look white.


For absorption:

A = AbsorptionColor * D;

The contributions of all samples are averaged ans substracted from the
color the ray gets after it leaves the media container object.
Therefore a blue absorbing media on a blue background will look black,
clear on a yellow background and yellow on a white background.


For scattering:

CameraVec = SamplePosition - CameraLocation;
LightVec = SamplePosition - LightPosition;

S = ShadowRayColor * ScatteringColor * ScatteringFunction ( Type,
CameraVec, LightVec);

ShadowRayColor is the color of the ray sent to the light source. It
might hit the light source directly, or not hit it at all (i.e. a
shadow) or it might get filtered through a semitransparent object.

After calculating S, the color of the sampling ray is attenuated
according to:

SampleRayColor = SampleRayColor - Extinction * S;

Then the calculations are performed for the next sample along the ray.
Finally all sample contributions are averaged.

Check out this scene:

sphere 
{ 0, 1
  pigment { rgbf 1 }
  hollow
  interior
  { media
    { intervals 10 samples 1, 10 confidence 0.9999 variance 0.0001
      scattering { 1, red 2 }
      // absorption Cyan
    }
  }
}

camera
{ location  <0.0 , 2.0 ,-5.0>
  angle 30
  look_at   <0.0 , 0.0 , 0.0>
}

light_source { <100,100,0> color rgb 1 }

plane { y, -1 pigment { checker color rgb 0 color rgb 1 } }

Note that the media looks red upon a black background and cyan upon a
white background. That's because when you substract red from black,
the result is still black, while if you attenuate the red off a white
background, you get white.

Because as the the ray passes through the media, its color is
attenuated by the amount of scatering multiplied by the extinction
value on a sample-by-sample basis, setting an overkill value for
either scattering or density will attenuate the light a lot and the
scene will look black. A setting for scatering which is too low will
make the beam too faint. You have to find the value which works for
your case. Or, you could turn down extinction which, though not
realistic, may suit your needs. A value of 0.1 is what I used four
your scene with a scattering type of 3 and and amount of 0.1.

I hope I cleared up the fog (err, media) in your head at least a
little :)


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Peter Popov
Subject: Re: Question about atmospheric media
Date: 9 Sep 1999 22:16:51
Message: <YGnYNyEBvrkB=F2Ywxrms3cTj6ew@4ax.com>
On Thu, 09 Sep 1999 13:20:58 +0300, Margus Ramst <mar### [at] peakeduee>
wrote:

>Then I can suggest only two options:
>1) Use some clever bounding or the Superpatch's light groups (I think
>you understand what I have in mind);
>2) Use a cone to contain the media.
>Other than that, what you want contradicts the way POV's media works.
>You cannot have a diffuse (non-directional) scattering model, bright
>scattered light and a transparent (thin) media all together. AFAIK, this
>applies in Real Life, too.
>
>Margus

Ever tried negative extinction? :)

You can do all of the above with an extinction of 0, isotropic
scattering and some tweaking of the scattering amount. Adding a little
emission (to bting up the background) helps, too.


Peter Popov
ICQ: 15002700


Post a reply to this message

From: Margus Ramst
Subject: Re: Question about atmospheric media
Date: 10 Sep 1999 06:29:11
Message: <37D8DD58.D846D709@peak.edu.ee>
Yes. Sorry about the misinformation. For some reason I thought extinction
affects both absorption _and_ emission components of scattering, while in
actuality it only affects absorption...
Both my solutions vere valid, though :)

Margus

Peter Popov wrote:
> 
> Ever tried negative extinction? :)
> 
> You can do all of the above with an extinction of 0, isotropic
> scattering and some tweaking of the scattering amount. Adding a little
> emission (to bting up the background) helps, too.
> 
> Peter Popov
> ICQ: 15002700


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.