POV-Ray : Newsgroups : povray.binaries.animations : media_attenuation of a light source -- animation tests : media_attenuation of a light source -- animation tests Server Time
4 Dec 2023 19:06:00 EST (-0500)
  media_attenuation of a light source -- animation tests  
From: Kenneth
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...


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

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

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...
            scattering{1, 3.5 extinction  ...some value... }
            method 3
            intervals 1
            samples 20
                            [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

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.

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.

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(?)

(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!).

'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.

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

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

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

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