POV-Ray : Newsgroups : povray.general : media ignores an EVEN number of samples : media ignores an EVEN number of samples Server Time
26 Apr 2024 16:53:14 EDT (-0400)
  media ignores an EVEN number of samples  
From: Kenneth
Date: 19 May 2017 18:50:00
Message: <web.591f75ea5dfea5f4883fb31c0@news.povray.org>
(running v3.7.1 beta 7 in Windows 7 64-bit)

I was doing a media animation experiment, and noticed what could be a subtle,
undocummented bit of behavior that I had never noticed before. Not an
Earth-shattering discovery, but worth mentioning.

Media (with default settings, at least) does not actually make use of an EVEN
number of samples, but ignores that and reverts to the previous ODD value,
visually. For example, an even value-- say 8, between 7 and 9-- shows NO change
to media from 7 samples. I tried it with both scattering and absorption medias.

Perhaps it's some kind of now-and-then interplay between all the various
media options like extinction, confidence, ratio, etc. OR, maybe a math
interplay re: the number of scene lights vs. the number of media intervals--
which the docs allude to in an arcane way (although I've never understood it).
From the paragraph about 'ratio':
"Note that the total number of intervals must exceed the number of illuminated
intervals. If a ray passes in and out of 8 spotlights but you have only
specified 5 intervals then an error occurs."

Anmyway, I've written a small animation scene example to show this, with
purposely crude samples values so it renders faster. Animate 10 frames, clock 0
to 1, AND with Cyclic_Animation on (to get 'clock' values to be exact multiples
of 0.1, which is important.) A small-size render is good enough to see it, like
320 X 240.

------
(scene is a scattering-media 'cloud' with a green box embedded in it, to easily
show shadowing behavior and samples/intervals changes)

#version 3.71; // or 3.7

global_settings{assumed_gamma 1.0 max_trace_level 5}

#declare SAM = 5 + 10*clock; // to go from 5 to 14, integers only;
// using Cyclic-Animation, the clock is always 0.0 on the first
// animation frame

camera {
  perspective
  location  <0, 0, -3.5>
  look_at   <.32, .05,  0>
  right     x*image_width/image_height
  angle 16  // 16 for close-up view; 35 shows full media sphere
}

light_source {
  0*x
  color rgb 2.0*<1,1,1>
  translate <10, 30, -10>
}

background {rgb .2}

plane{y,-.61
    texture{
    pigment{cells scale .5 rotate 15*y}
    finish{emission .1 diffuse .4}
    }
    }

text{
ttf "timrom.ttf" concat("samples = ",str(SAM,1,5))
    .01, 0
    texture{
        pigment{rgb 1}
        finish{emission 1 diffuse 0}
        }
    scale .07
    translate <-.03,.24,-.8>
    no_shadow
    }

text{
ttf "timrom.ttf" concat("clock = ",str(clock,1,5))
    .01, 0
    texture{
        pigment{rgb 1}
        finish{emission 1 diffuse 0}
        }
    scale .06
    translate <.07,.19,-.8>
    no_shadow
    }

// long box
box{<-.025,-1,-.025>, <.025,1,.025>
    texture{
        pigment{rgb <.4,1,.4>}
        finish{emission .1 diffuse .9}
        }
        rotate 30*y
        rotate 90*x
        rotate -20*y
        translate <.2,.15,0>
       }

sphere{0,1
hollow on
texture{
    pigment {rgbt 1}
    finish {emission 0 diffuse 0}
    }
    interior{
        media{
            scattering{1, 10 extinction 2.1}
            method 3
            intervals 1
            samples SAM
            density{
                spherical
                    color_map{
                            [0.22 rgb 0]
                            [0.32 rgb <.4,.6,1>]
                            [1.0 rgb <.4,.6,1>]
                             }
                   scale 2.5
                   warp{turbulence .9 omega .6}
                   scale 1/2.5
                   }
              }
             }
          scale <1,.6,1>
         }


Post a reply to this message

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