POV-Ray : Newsgroups : povray.newusers : A trivial example of media ? Server Time
29 Jul 2024 04:23:53 EDT (-0400)
  A trivial example of media ? (Message 1 to 4 of 4)  
From: Dennis Clarke
Subject: A trivial example of media ?
Date: 3 Jun 2006 21:40:00
Message: <web.4482391d16b5ba2cfd8466960@news.povray.org>
I am trying to put together a trivial example of media in which a beam of
light would be scattered in much the same way that a flashlight beam would
be in a dark night with heavy fog or smoke.

I have been reading through the manual in the section on media [ section
3.6.2 Media in "POV-Ray 3.6 for UNIX documentation" ] and I get the rather
distinct feeling that "trivial" is tough to achieve.

RE: http://www.blastware.org/docs/html/s_129.html#s03_06_02

Please pardon me for being redundant here :

 The complete syntax for a media statement is as follows:

MEDIA:
    media { [MEDIA_IDENTIFIER] [MEDIA_ITEMS...] }
MEDIA_ITEMS:
    method Number | intervals Number | samples Min, Max |
    confidence Value  | variance Value | ratio Value |
    absorption COLOR | emission COLOR | aa_threshold Value |
    aa_level Value |
    scattering {
       Type, COLOR [ eccentricity Value ] [ extinction Value ]
    }  |
    density {
       [DENSITY_IDENTIFIER] [PATTERN_TYPE] [DENSITY_MODIFIER...]
    }   |
    TRANSFORMATIONS
DENSITY_MODIFIER:
    PATTERN_MODIFIER | DENSITY_LIST | COLOR_LIST |
    color_map { COLOR_MAP_BODY } | colour_map { COLOR_MAP_BODY } |
    density_map { DENSITY_MAP_BODY }

I see the all of that spec and wonder how much of it is optional parameters
or are they all needed ?  The vertical bar between parameters seems to
indicate "OR" but I am not sure.  It seems as if _everything_ is optional.

Regardless I am thinking of smoke.  I think that cigarette smoke of the
smoke from burning wood is in actual fact very fine particles that absorb
light, casts a shadow like a cloud does and must scatter light somewhat.  I
doubt that it will emit light unless there are hot embers in the smoke.

   http://www.blastware.org/docs/images/WarOfTheWorlds2.png

The "search light" there on the martian robots shoulder casts a focused beam
that appears to be made of two light sources; one is hot white and it
attenuates to nothing very quickly and then there is a blue beam that seems
to appear out of nowhere ( as if there were a lens effect and the beam has
passed through a focal point ) and it projects into smoke.

I am thinking of isolating that one picture element, the beam which consists
of a two cones as well as the smoke.  The cones are on the same axis and
their points are at the focal point of the light beam.  One leaves to the
left and it bright white while the other leaves to the left and is blueish.

The first question is not the cones or the light sources but is in fact the
media itself.  The smoke.

I would think that starting with a simple smoke that is everywhere
consistent and linear in thickness would be a fine start.

The definition of this smoke eludes me.

The documentation seems very unclear or at least not very "spoon feed me
step by step" to allow me to translate the desite into a media definition.

I am thinking that I need absorption but how much and what color ?
No one can know but I think I will simply guess :

    absorption rgb < 0.25, 0.15, 0.10 >

So then more Red light is absorbed than Blue or Green.

I hope for a blueish tint to things on the other end of the media.

    emission rgb < 0.0, 0.0, 0.0 >

But I do not really know what effect this will have.  Perhaps the smoke will
now be invisible and only seen when light passes through it?

    SCATTERING:
    scattering {
        Type, COLOR [ eccentricity Value ] [ extinction Value ]
    }

This is a bit of a monster.  This scattering thing.  I am going to guess
that "Type 4 Rayleigh scattering" makes sense for microscopic particles
like smoke.

Section "3.6.2.2 Sampling Parameters & Methods" makes no bloody sense to me
at all.  It seems to be a lot of talk about the Monte Carlo Integration
approach.  I am certainly okay with statistical methods but "this" section
makes little sense to me.

The examples that follow in that chapter make no reference to any of these
parameters and I fail to see where media type is set let alone esoteric
issues such as "samples Min,  Max keyword" etc etc.

Perhaps I am missing something obvious and I hope that someone can shed some
illumination on this topic.  Sorry for the pun.

How shall I define a nice fine smoke hanging in the air?

Dennis


Post a reply to this message

From: Tom York
Subject: Re: A trivial example of media ?
Date: 3 Jun 2006 23:20:01
Message: <web.44825122e5b9af5a7d55e4a40@news.povray.org>
"Dennis Clarke" <dcl### [at] blastwaveorg> wrote:
> I see the all of that spec and wonder how much of it is optional parameters
> or are they all needed ?  The vertical bar between parameters seems to
> indicate "OR" but I am not sure.  It seems as if _everything_ is optional.

Back in "the good old days" when media's predecessor system (known as halo)
was around, there was an excellent tutorial/walkthrough that used an
explosion as an example with which to demonstrate the basic syntax and use
of this sort of effect. It was probably replaced by documentation section
2.3.6 (in povray 3.6.1, at any rate), which you may want to check out, it
has many useful examples.

An absolutely minimal media (medium?) would look something like the
following. You have a container object that must be declared to be hollow,
(usually) with a completely transparent surface. The absolute minimum
required for the media definition is a declaration of the type of media
you're using, with any requirements that statement involves.

sphere {
  <0,0,0>, 1

  hollow on

  texture { pigment { colour rgbt 1 } }

  interior {
    media {
      emission <1,1,1>
      // OR:  absorption <1,1,1>
      // OR:  scattering { 1, <1,1,1> }
    }
  }
}

Everything else is optional, but not necessarily ignorable.

> I am trying to put together a trivial example of media in which a beam of
> light would be scattered in much the same way that a flashlight beam would
> be in a dark night with heavy fog or smoke.

In my experience, emission media is almost always trivial, absorption media
is less so, and scattering media is highly non-trivial. Check out those
examples in the documentation and see if any of them serve your needs.
Things I remember that may not be obvious: scattering media, far more than
the other two types, can be extremely time-consuming to render and hence
difficult to adjust. It may require extremely high sampling parameters to
capture shadows cast by light sources. Scattering media is *not*
illuminated by shadowless lights (which is another thing they oddly fail to
do).


Tom


Post a reply to this message

From: Dennis Clarke
Subject: Re: A trivial example of media ?
Date: 4 Jun 2006 01:05:00
Message: <web.448269a0e5b9af5afd8466960@news.povray.org>
"Tom York" <alp### [at] zubenelgenubi34spcom> wrote:
> "Dennis Clarke" <dcl### [at] blastwaveorg> wrote:
> > I see the all of that spec and wonder how much of it is optional parameters
> > or are they all needed ?  The vertical bar between parameters seems to
> > indicate "OR" but I am not sure.  It seems as if _everything_ is optional.
>
> Back in "the good old days" when media's predecessor system (known as halo)
> was around,

  That seems to ring a bell somewhere ... way back in the dusty corners
 of my head :-)

> there was an excellent tutorial/walkthrough that used an
> explosion as an example with which to demonstrate the basic syntax and use
> of this sort of effect. It was probably replaced by documentation section
> 2.3.6 (in povray 3.6.1, at any rate), which you may want to check out, it
> has many useful examples.

Ah ha !

http://www.blastware.org/docs/html/s_71.html#s02_03_06
2.3.6 Simple Media Tutorial

How could I have missed that .. geez ...

> An absolutely minimal media (medium?) would look something like the
> following. You have a container object that must be declared to be hollow,

  Oh?  I guess in my mind I think of a fog bank as being "everywhere" and
smoke would be the same.  I guess in any computer based representation I
would need to contain the mathematical model of smoke in some bounded
manifold.  Makes perfect sense although not intuitive.

> (usually) with a completely transparent surface. The absolute minimum
> required for the media definition is a declaration of the type of media
> you're using, with any requirements that statement involves.
>
> sphere {
>   <0,0,0>, 1
>
>   hollow on
>
>   texture { pigment { colour rgbt 1 } }
>
>   interior {
>     media {
>       emission <1,1,1>
>       // OR:  absorption <1,1,1>
>       // OR:  scattering { 1, <1,1,1> }
>     }
>   }
> }
>
> Everything else is optional, but not necessarily ignorable.

 I see that now.  :-)

> > I am trying to put together a trivial example of media in which a beam of
> > light would be scattered in much the same way that a flashlight beam would
> > be in a dark night with heavy fog or smoke.
>
> In my experience, emission media is almost always trivial, absorption media
> is less so, and scattering media is highly non-trivial.

Oh dear.  Well, I know that I am thinking of a combination of absorption and
scattering at the same time.  That should keep my CPU busy.

> Check out those
> examples in the documentation and see if any of them serve your needs.

I will definately climb on top of that.

> Things I remember that may not be obvious: scattering media, far more than
> the other two types, can be extremely time-consuming to render and hence
> difficult to adjust.

I have been placing objects in the scene files and then doing renders with
the +Q5 option for quality.  That gives me object placement and not too
much else.

Then I have been doing "quick" renders at full +Q9 with 800x600 images and
then my test images are at 4096x3072.  Needless to say the final images are
taking an hour or so with a lot of reflection and refraction on some glass
objects.  I am happy with the result thus far and want to now add in the
smoke effect with search beams.

> It may require extremely high sampling parameters to
> capture shadows cast by light sources. Scattering media is *not*
> illuminated by shadowless lights (which is another thing they oddly fail to
> do).

OKay .. that is odd.  I keep thinking of smoke as particles but in reality
its not the case.  I think to actually model smoke one would need several
trillion tiny spheroids with a supercomputer ( BlueGene ) to perform the
render.

Thanks for the input and I hope to follow up this thread with some results.

Dennis


Post a reply to this message

From: Tom York
Subject: Re: A trivial example of media ?
Date: 4 Jun 2006 06:40:00
Message: <web.4482b7c7e5b9af5a7d55e4a40@news.povray.org>
"Dennis Clarke" <dcl### [at] blastwaveorg> wrote:
>   Oh?  I guess in my mind I think of a fog bank as being "everywhere" and
> smoke would be the same.  I guess in any computer based representation I
> would need to contain the mathematical model of smoke in some bounded
> manifold.  Makes perfect sense although not intuitive.

Well, you can use media as a scene-wide effect. Simply declare the media
statement without attaching it to any object, eg:

camera { ... }

light_source { ... }

object { ... } // scene objects, no media

media { ... } // media declaration as before, but is now everywhere.

I don't normally do this, because it's very slow (every pixel in the image
will involve media samples).

If you are using scattering media with absorbing media (quite common when
extra control is desired), you may want to turn the scattering media's own
absorption off by setting

scattering { 1, 1 /* <-- or whatever */ extinction 0 }

Then the amount and colour of absorption is entirely up to you.

> Then I have been doing "quick" renders at full +Q9 with 800x600 images and
> then my test images are at 4096x3072.  Needless to say the final images are
> taking an hour or so with a lot of reflection and refraction on some glass
> objects.  I am happy with the result thus far and want to now add in the
> smoke effect with search beams.

Yes, the quality switch is normally a great help. But I find scattering
media defeats it because it's a high-quality feature (+Q9 at least, IIRC),
and you need a full quality view anyway to debug it. So, when I have to
deal with scattering media I hide objects that aren't relevant by switching
them in and out;

#declare FinalImage = false;

#if(FinalImage)
  object { ... }  // incidental object that doesn't depend much on media
effects
#end

media { ... }

This can help. Sometimes. Also tweaking the samples used can help, although
the quality difference between samples 3,3 and samples 30,30 can be
enormous (like, no cast volumetric shadows vs. very obvious shadows).
Again, makes debugging slow.

> OKay .. that is odd.  I keep thinking of smoke as particles but in reality
> its not the case.  I think to actually model smoke one would need several
> trillion tiny spheroids with a supercomputer ( BlueGene ) to perform the
> render.

Sure, but that's not necessary. If you want dust motes or larger particles
to be visible in your media you could just add another density or a
separate media. As for shadowless lights, they're just odd. Normal lights
work as you would probably expect with all media types.

Tom


Post a reply to this message

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