POV-Ray : Newsgroups : povray.bugreports : Scattering media, spotlights, and the camera Server Time
22 Dec 2024 04:27:43 EST (-0500)
  Scattering media, spotlights, and the camera (Message 1 to 2 of 2)  
From: Reactor
Subject: Scattering media, spotlights, and the camera
Date: 5 Sep 2009 03:15:01
Message: <web.4aa20f6d4d223152d026f4ce0@news.povray.org>
This occurs under 3.6.1 and 3.7b33, and is so much of an edge case that I am
almost hesitant to report it, but...

While working on a scene that uses scattering media and a spotlight, the media
refused to scatter.  Instead, only the absorption component rendered, leaving a
dark, unshaded media.  The scattering media behaved as expected when the
spotlight was a point light, but only the emission and absorption medias (or
the absorption component of scattering media) rendered when it was a spotlight,
even to the point that the scattering media became completely transparent with
extinction set to 0.

I couldn't even  get it down to a minimal scene until I realized that I was
suffering from my own 'cleverness.'  The scene involved spotlights that were
being used as flashlights, and had code like the following (which destroys
scattering media):

#local Camera_location = <0, 5,-22>;
#local Camera_look_at  = <2, 5,  5>;

camera
{
    location Camera_location
    look_at  Camera_look_at
}

light_source
{
    Camera_location,
    color rgb <1,1,1>
    spotlight
    point_at Camera_look_at
    radius 6
    tightness 50
    falloff 7
    fade_distance 15
    fade_power 2
}

However, everything worked correctly after changing the camera to this:

camera
{
    location Camera_location + <0.001,0,0> // move camera just a little bit
    look_at  Camera_look_at
}


It is kind of silly, I know, but I am sooo relieved to get it working again
(since the scene heavily depends on the flashlight for lighting), I figured I'd
post it in case someone out there runs into something similar.
Anyway, here is a complete minimal scene for the curious:


//---------CODE:
sphere{
    <0,0,0>, 1
    pigment{ color rgbt <1,0,0,0.95> }

interior{
    media{
        samples 10
        scattering{ 1, color rgb 1 }
        density{ spherical }
    }
}
hollow
translate <0,1,0>
}


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



camera{
    location <0,2,-10>                // media is incorrect
//    location <0,2,-10> + <0.0001,0,0> // media is correct
    look_at  <0,1,0>
}



light_source{
    <0,2,-10>, color rgb 1
// commenting out spotlight portion yields correct media
    spotlight point_at <0,1,0>
    radius    10
    tightness 1
    falloff   20

fade_distance 15
fade_power 2

}

//----------END CODE

Lesson learned:  Don't put stuff in the same place as other stuff.

-Reactor


Post a reply to this message

From: clipka
Subject: Re: Scattering media, spotlights, and the camera
Date: 5 Sep 2009 05:29:02
Message: <4aa22f5e$1@news.povray.org>
Reactor schrieb:
> Lesson learned:  Don't put stuff in the same place as other stuff.

That's an absolute borderline case indeed: I guess the code to test 
whether the ray starts inside the spotlight cone, and the code to test 
for intersections with the cone along the ray, run a bit out of sync 
here, so that POV-Ray gets confused whether the ray is actually inside 
or outside of the cone.


Post a reply to this message

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