POV-Ray : Newsgroups : povray.binaries.animations : media_attenuation of a light source -- animation tests Server Time
21 Dec 2024 08:21:45 EST (-0500)
  media_attenuation of a light source -- animation tests (Message 1 to 4 of 4)  
From: Kenneth
Subject: media_attenuation of a light source -- animation tests
Date: 16 Feb 2018 01:55:01
Message: <web.5a867ea2f618c605a47873e10@news.povray.org>
This is a seven-part animation(!), to test media_attenuation of a light. This is
the current POV-Ray behavior  (as of 3.7.1 beta 9, anyway; I haven't tested any
3.8 version.) See William Pokorny's separate thread about this topic...

http://news.povray.org/povray.binaries.images/thread/%3C5a842989%241%40news.povray.org%3E/

I'm using his excellent 'sphere-differencing' trick for some of the tests.

The documentation for media_attenuation seems to imply that it relates only to
'atmospheric' media (with the camera inside the media) to see the effect. That's
not completely clear, though. I'm instead using a distinct media-filled object
here, with the camera outside. But it's an interesting test anyway, and shows
what currently happens in this situation.  (I 'll try to do a similar series of
tests with atmospheric media later; these tests take a fair amount of time to
render!)

BTW, I'm starting off with a some basic assumptions (and/or questions!):
A) IMO, media_attenuation of a light should affect both how the media itself
reacts to it, and also the light's distance-based effect on objects due to that
media. But perhaps media_attenuation means ONLY the lighting effect seen 'upon
or within' the media itself, and not on other objects?? I don't know the
answer... and it's an important distinction.

B) Does a light's distance from media (OR it's relative position within media)
affect the degree of media_attenuation (the light attenuation) on the media
itself and on objects? That may sound like a naive question-- the answer being
yes, of course it does. Yet my video tests show it to be a mystery.

C) Does media_interaction *depend on* scattering's extinction value? My tests
seem to indicate that it does... or else the answer to B) seems to be 'no',
and/or  A) doesn't work like I thought.

Of course, all of this depends on whether or not my object-media test scene is
correctly set up to show what's happending ;-)  (If anyone has a suggestion for
a different test, or of different parameters to use, let me know and I'll try to
run it.)

As William P. pointed out, the media_attenuation keyword, whether on or off,
doesn't currently *control* the effect. It's either on or off depending on the
circumstances(!) (In my code, it's specifically turned ON, just to be safe.)
That presents a problem with these tests: media_attenuation -- and scattering
media's own shadowing effects-- are currently 'mixed together' and can't be
separated. Scattering's 'extinction' value is making any attenuation very
difficult (or impossible) to see, on its own.   The sum of these effects is very
confusing.

In any case...
The small red sphere shows the moving position of the single light source; the
light travels directly through the media sphere. The green circle delineates the
boundary of that sphere. (The outline is actually a separate torus object,
placed closer to the camera so as not to interfere with the tests--  scaled and
positioned to outline the sphere's surface.) There is also a small cylinder
shape to the right, which is completely *inside* the media sphere, to show any
lighting effects or changes that may occur there.

The first THREE parts of the video do not use William's sphere-differencing
trick to create a tiny 'void' around the light; the others do.

These are my media settings...
        media{
            scattering{1, 3.5 extinction  ...some value... }
            method 3
            intervals 1
            samples 20
            density{
                spherical
                    color_map{
                            [0.0 rgb 0]  // OUTSIDE SURFACE
                            [0.24 rgb 0]
                            [0.34 rgb 1]
                            [1.0 rgb 1] // CENTER of sphere
                                         }
                 //  scale 2.5
                //   warp{turbulence .8 omega .7}
                //   scale 1/2.5
                  }
            }

PART 1:
This is simply the 'control'-- no media in the sphere. It's only meant to show
the expected constant light brightness on objects, as the light moves-- and to
compare against the effects seen in the other tests.

PART 2:
Media has been added-- but I changed scattering's 'extinction' value to an
unnatural 0.0, just to show what happens. There is no shadow effect *from* the
media onto other objects, and no light/media_attenuation either, even when the
light enters the media. But it does show shadow effects cast from an object
*into* the media. It appears  that the 'extinction' value directly affects
media_attentuation-- or else the attenuation is now turned OFF, no matter if the
light is inside the media or not.

PART 3:
I changed the 'extinction' value to 0.6, which brings back some expected
extinction effects.(The default is apparently 1.0, but that's too dark for some
of the effects I wanted to see). This test is 'typical' current behavior of
media_attenuation... at least for object media. As the light travels toward the
sphere, there doesn't *appear* to be a light-attenuation change on the embedded
cylinder (or the flat box shape), just  the shadow effect of the media, along
with  typical 'angle-of-incidence' changes.  As the light ENTERS the media
sphere, there's an *abrupt* change--  maybe from the greater-than-1.0 scattering
'density' that I chose to use, although I wasn't expecting that. But there seems
to be no 'extinction' interaction with the light now. And any possible
light/media_attenuation is swamped by all this... or alternately, as William
says, media_attenuation is simply OFF when the light is inside the media. It's
hard to tell which situation is occuring.

An alternate explanation for the sudden brightness change is that
media_attenuation IS on, (but only outside)-- causing a major jump in brightness
when it turns off inside the sphere. But again, the lack of any object or media
brightness change *AS* the light is moving (outside) makes me wonder.  What's
interesting though is the vast speed-up in rendering, when the light enters the
sphere-- as William also mentioned--which would seem to indicate that
media_attenuation is indeed ON when outside,  taking lots more time to
calculate-- but having no 'constantly changing' effect as the light moves(?)

PART 4:
(This is the first example that uses William's tiny-sphere/CSG-differencing
trick for the light-- the 'void' around it. BTW, this CSG-difference is OK even
when the light starts *outside" the media sphere; it doesn't change any of the
various behaviors. I tested with and without it.)

Same general test setup as Part 2-- extinction 0.0-- but unfortunately,  the
same results as well. The void around the light doesn't change anything (yet!).

PART 5:
'Extinction' is back to 0.6. This shows definite light/media interactions, of
some kind-- even when the light is inside the media, an effect that has
apparently been missing from POV-ray for quite awhile. William's
sphere-differencing trick certainly works, even with object media! The question
remains of whether there is media_attenuation of the light, and not just
shadowing effects due to extinction. Difficult to tell.

PART 6:
Identical set-up as Part 4, but with some media turbulence thrown in. Same
results, too.

PART 7:
Same as Part 5, but with turbulence.  *Really* nice light/media interactions.
But is there any 'changing' media_attenuation of the light?


Post a reply to this message


Attachments:
Download 'media_attenuation_test_1.mp4.mpg' (1098 KB)

From: Kenneth
Subject: Re: media_attenuation of a light source -- animation tests
Date: 16 Feb 2018 02:35:01
Message: <web.5a8686cdee9d509da47873e10@news.povray.org>
My code for the scene...

#version 3.71;

global_settings {assumed_gamma 1.0 max_trace_level 5}
#default{finish{ambient 0 emission 0 diffuse 0}}
//-------------------------------
#declare USE_CSG_DIFFERENCE = on; // for differencing a tiny sphere
// from the media sphere, to create a 'void' around light

#declare LIGHT_LOCATION = <-2.6 + 4.2*clock, .1, .1>; // for BOTH the
// point light source AND the tiny differenced sphere;
// they move together
#declare MEDIA_SAMPLES = 20;
#declare SCAT_EXTINCTION = .6; // extinction value for scattering media
#declare LIGHT_INTENSITY = .7; // 0.7 when extinction = 0.0,  0.11 when
// extinction = 0.6

//-------------------------------
camera {
  perspective
  location  <0, .2, -4>
  look_at   <0, .1,  0>
  right     x*image_width/image_height
  angle 67
}

light_source {
  0*x
  color rgb LIGHT_INTENSITY
  looks_like{sphere{0,.05}
       pigment{rgb <1,0,0>}
       finish{ambient 0 emission 1 diffuse 0}
            }
  translate LIGHT_LOCATION
  media_attenuation on
}

sky_sphere{
    pigment{
        average
        pigment_map{
            [1 bozo warp{turbulence .5 omega .5} scale .03*<12,1,1>]
            [70 rgb .01]
                  }
           }
          }

#if(USE_CSG_DIFFERENCE)
difference{
sphere{0,1}
sphere{0, .005 translate LIGHT_LOCATION}
#else
sphere{0,1
#end
hollow on
texture{
    pigment {rgbt 1}
    finish {ambient .2 diffuse 0}
    }
    interior{
        media{
            scattering{1, 3.5 extinction SCAT_EXTINCTION}
            method 3
            intervals 1
            samples MEDIA_SAMPLES
            density{
                spherical
                    color_map{
                            [0.0 rgb 0]  // OUTSIDE SURFACE
                            [0.24 rgb 0]
                            [0.34 rgb 1]
                            [1.0 rgb 1] // CENTER of sphere
                             }
                  //  scale 2.5
                  //  warp{turbulence .8 omega .7}
                  //  scale 1/2.5
                  }
            }
          }
         }

// flat vertical slab to the right
box{0, <0,2.6,2.6>
   translate <0,-1.3,-1.3>
   pigment{rgb 1}
   finish{ambient 0 emission 0 diffuse 1}
   translate 1.8*x
   }

// cylinder embedded in media to the right, to try and show any
// changing light-brightness effects
cylinder{-.015*x, .015*x .1
    pigment{rgb 1}
    scale <1,2,2>
    finish{ambient 0 emission 0 diffuse 1.0}
    rotate <0,-15,-20> translate <.88,-.2,.1>
    }

// to delineate the main sphere's boundary, seen from the camera
// position
torus{1.39, .008
   pigment{rgb <.2,1,.2>} finish{ambient .1 diffuse 0}
   rotate 90*x
   scale .52
   translate <0,.057,-1.2>
   }

text {
#if(USE_CSG_DIFFERENCE)
    internal 1 "WITH small CSG-differenced sphere."
    #else
    internal 1 "NO small CSG-differenced sphere."
    #end
    .001, 0
    scale .17
    no_shadow
    pigment{rgb 1} finish {ambient 0 emission 1 diffuse 0}
    translate <-1.8,1.4,0>
    }

text {
    internal 1
    concat("scattering EXTINCTION = ",str(SCAT_EXTINCTION,0,2))
    .001, 0
    scale .17
    no_shadow
    pigment{rgb 1} finish {ambient 0 emission 1 diffuse 0}
    translate <-1.8,1.2,0>
    }

text {
    internal 1
    concat("light: rgb  ",str(LIGHT_INTENSITY,0,2))
    .001, 0
    scale .17
    no_shadow
    pigment{rgb 1} finish {ambient 0 emission 1 diffuse 0}
    translate <-1.8,1.0,0>
    }


Post a reply to this message

From: William F Pokorny
Subject: Re: media_attenuation of a light source -- animation tests
Date: 16 Feb 2018 08:53:58
Message: <5a86e276$1@news.povray.org>
On 02/16/2018 01:49 AM, Kenneth wrote:
> This is a seven-part animation(!), to test media_attenuation of a light. This is
> the current POV-Ray behavior  (as of 3.7.1 beta 9, anyway; I haven't tested any
> 3.8 version.) See William Pokorny's separate thread about this topic...
> 
> 

Thanks for the detail and code. I'll come back to it, but I have other 
active threads too - under which I'm already buried! Your results are 
mostly in line with my tentative understanding and yep, the media run 
times are certainly a factor for me too on my little two core i3.

In trying to verify the media attenuation apart from the scattering I 
set up a simpler scene with with two renders - light in at top, light 
out at bottom. The attached image shows the difference at bottom. As I'd 
expect the media_attenuation is getting applied only in the band where 
the media is lit in the second and not to the background. In other words 
attenuation looks to me to be working - when it's on - at least to a 
first order.

Bill P.


Post a reply to this message


Attachments:
Download 'a_to_b.jpg' (46 KB)

Preview of image 'a_to_b.jpg'
a_to_b.jpg


 

From: Kenneth
Subject: Re: media_attenuation of a light source -- animation tests
Date: 16 Feb 2018 12:50:00
Message: <web.5a871922ee9d509da47873e10@news.povray.org>
William F Pokorny <ano### [at] anonymousorg> wrote:

>
> In trying to verify the media attenuation apart from the scattering I
> set up a simpler scene with with two renders - light in at top, light
> out at bottom. The attached image shows the difference at bottom...

I didn't think to try that simple image-differencing trick. I'll re-render some
images and test them in Photoshop, to double-check my theories.


Post a reply to this message

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