|
|
I was playing with scattering media today. I happened to stick my light
source inside the media container and was surprised to find POV-Ray
suddenly running orders of magnitude faster - seconds instead of minutes.
On digging it looks to me when media is inside a container and the light
outside, media_attenuation is on no matter the light source setting in
the SDL. If the light source is inside the container, media_attenuation
is off.
If we move the media block to the top level of the scene the
media_attenuation keyword in any light source behaves as I expect. In
other words, I can turn media attenuation on and off.
Is this the expected behavior for media_attenuation?
It goes back to 3.7.0 at least. I've for years assumed media_attenuation
was off unless I turned it on whether or not I had a media container -
and assumed that media was always really slow.
In the attached image, the light sources for the left column explicitly
set media_attenuation on. The right column explicitly sets it off. The
bottom and top row use a media {} block at the top of the scene hierarchy.
The middle two rows use a sphere as a container for the same defined
media. The first two rows have the light at a position which places it
inside the sphere container in row 2. The last two rows have the light
position such that it is outside the containing sphere in row 3.
When the light is inside the container in row 2, media attenuation is
always off no matter the setting. When the light is outside the
container (the common use case I think) media_attenuation looks to
always be on.
Bill P.
//---------- LightMediaAttenuationTest.pov ---------
#version 3.7;
global_settings { assumed_gamma 1 }
#default { finish {ambient 0.0 diffuse 1.0} }
#declare Grey20 = srgb <0.2,0.2,0.2>;
background { color Grey20 }
#declare Camera00 = camera {
perspective
location <2.7,2.7,-2.701>
sky y
angle 35
right x*(image_width/image_height)
look_at <0,0,0>
}
#declare VarDist = 0.207;
#declare VarDistRes = 0.02;
#declare VarDistPos = VarDist+(VarDistRes/2);
#declare White = srgb <1,1,1>;
#declare LightInsideAttenOff = light_source {
<0.5,0.95,-0.5>, White
fade_distance VarDistPos
fade_power 2
media_attenuation off
}
#declare LightInsideAttenOn = light_source {
<0.5,0.95,-0.5>, White
fade_distance VarDistPos
fade_power 2
media_attenuation on
}
#declare LightOutsideAttenOff = light_source {
<0.5,1.05,-0.5>, White
fade_distance VarDistPos
fade_power 2
media_attenuation off
}
#declare LightOutsideAttenOn = light_source {
<0.5,1.05,-0.5>, White
fade_distance VarDistPos
fade_power 2
media_attenuation on
}
#declare Red = srgb <1,0,0>;
#declare CylinderX = cylinder { -2*x, 2*x, 0.01 pigment { Red } }
#declare Green = srgb <0,1,0>;
#declare CylinderY = cylinder { -2*y, 2*y, 0.01 pigment { Green } }
#declare Blue = srgb <0,0,1>;
#declare CylinderZ = cylinder { -2*z, 2*z, 0.01 pigment { Blue } }
#declare BrightBlue = srgb <0.05882,0.2549,1>;
#declare Box00 = box {
<-1.001,-1.001,-1.001>,<1.001,0.499,1.001>
pigment { color BrightBlue }
}
#declare DensitySph = density {
spherical
scale 0.4
translate <0.5,0.5,-0.5>
scale 3
turbulence 0.35 octaves 6 omega 0.63 lambda 5
scale 1/3
}
#declare Sphere00 = sphere { <0.5,0.5,-0.5>, 0.5 hollow }
#declare Media00 = media {
method 3
samples 100
absorption rgb <0,0,0>
emission rgb <0,0,0>
scattering { 1, rgb <5,5,5> extinction 1 }
density { DensitySph }
}
#declare Interior00 = interior { ior 1 media { Media00 } }
#declare Clear100 = srgbt <1,1,1,1>;
#declare PigmClear100 = pigment { color Clear100 }
#declare TxtrClear100 = texture { pigment { PigmClear100 } }
#declare MatrClear100 = material {
texture { TxtrClear100 }
interior { Interior00 }
}
#declare Obj00 = object { Sphere00 material { MatrClear100 } hollow }
//--- scene ---
camera { Camera00 }
object { Box00 }
object { CylinderX }
object { CylinderY }
object { CylinderZ }
//--- Use one of these
// Inside position just inside top of Sphere00
// Outside position just outside top of Sphere00
light_source { LightInsideAttenOn }
// light_source { LightInsideAttenOff }
// light_source { LightOutsideAttenOn }
// light_source { LightOutsideAttenOff }
//--- Use one of these
// media { Media00 } // Inside vs Outside means nothing to top media
object { Obj00 }
//------ End of scene -------
Post a reply to this message
Attachments:
Download 'mediaattensummary.jpg' (141 KB)
Preview of image 'mediaattensummary.jpg'
|
|