POV-Ray : Newsgroups : povray.binaries.images : Media discrepancy (artifact?) : Re: Media discrepancy (artifact?) Server Time
1 Aug 2024 16:29:20 EDT (-0400)
  Re: Media discrepancy (artifact?)  
From: Bruno Cabasson
Date: 4 Jun 2008 12:15:00
Message: <web.4846bf2b9a2aa192e8ba46670@news.povray.org>
"Kenneth" <kdw### [at] earthlinknet> wrote:
> "Bruno Cabasson" <bru### [at] alcatelaleniaspacefr> wrote:
> > Thanks a lot Kenneth for your analysis. I guess you spent quite a lot of time!
> >
> Sometimes, when I come across an interesting POV problem, I 'm like a dog
> chewing on a bone:  I can't let it go!  :-) When I'm experimenting, I like to
> throw some really ridiculous things at POV-Ray--just to see what might happen!
> More times than not, it leads me to a better understanding of how POV works.
>
>
> > Your work-around is a good
> > idea. However, and AFAIK, extinction is not the same as density, but it might
> > compensate.
>
> You're right, of course. In coming up with this goofy work-around, I was tying
> to figure out--in my own mind-- *some* kind of logical reason as to why it
> seemed to work; but my explanation is probably not accurate at all.
>
> BTW, I'm curious as to what function{1) or function{0} actually do. I've never
> used a function of a constant before. Can you explain?
>
> Ken W.


Try this code. It is some kind of nebula, which is more accurate for comparison
between renders than simple spheres. You can check that varying the number N of
medias yields the exact same render (verified with a color picker).

Bruno.

#version 3.5;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
}

// ----------------------------------------

camera {
  location  <0.0, 0.0, -4.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}


#declare N = 10;

light_source {
  <0, 0, 0>
  color rgb 3/N
}


// ----------------------------------------
difference
{
    sphere {0, 1}
    sphere {0, 0.01} // The light source must be outside the container,
otherwise scattering does not work properly (as if extinction were
inoperative).
    hollow
    pigment {rgbt 1}
    interior
    {
        #local i = 0;
        #while (i<N)
            media
            {
                scattering {1, rgb 7*<1, 0.7, 0.1>/N}
                absorption 10*(1-OrangeRed)/N
                density
                {
                    spherical scale 0.4
                    turbulence 1 lambda 1.4 omega 0.9 octaves 10
                }
            }
            #local i = i+1;
        #end
    }
}


However, this technique applied to the original problem does not work, as the
following code shows when rendered:

#version 3.5;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
}

// ----------------------------------------

camera {
  orthographic
  location  -100*z
  look_at 0
  right     5*x*image_width/image_height
  up 5*y
}

light_group
{
    light_source {
      <0, 0, 0>
      color rgb 0.8
      parallel point_at -y
      translate 100*y
    }


    #declare DistinctSpheres = union
    {
        sphere
        {
            0, 1
            hollow
            pigment {rgbt 1}
            interior
            {
                media
                {
                    intervals 3 samples 3 method 3
                    scattering {1, Blue}
                    density {function{1}} // Optionnal statement
                }
            }
            translate 1.1*y
        }

        sphere
        {
            0, 1
            hollow
            pigment {rgbt 1}
            interior
            {
                media
                {
                    intervals 3 samples 3 method 3
                    scattering {1, White}
                    density {function{1}} // Optionnal statement
                }
            }
            translate -1.1*y
        }
    }
    object {DistinctSpheres}
}

light_group
{
    light_source {
      <0, 0, 0>
      color rgb 0.8/2 // 2 medias
      parallel point_at -y
      translate 100*y
    }

    #declare UnionedSpheres = union
    {
        sphere {0, 1 translate 1.1*y}
        sphere {0, 1 translate -1.1*y}
        hollow
        pigment {rgbt 1}
        interior
        {
            media
            {
                intervals 3 samples 3 method 3
                scattering {1, rgb Blue/2}
                density {spherical color_map {[0 rgb 0] [0.001 rgb 1]} translate
1.1*y}
            }
            media
            {
                intervals 3 samples 3 method 3
                scattering {1, rgb White/2}
                density {spherical color_map {[0 rgb 0] [0.001 rgb 1]} translate
-1.1*y}
            }
        }
    }


    object {UnionedSpheres translate 2*x}
}

You can also try to make the medias overlap (suppress the translate statements),
and see the differences. So why exact same values with the nebula, and not with
the spheres? The only thing I see is that in the sphere case, there are two
distinct containers, and therefore the rays pass through container boundary,
and we may face the container artifact. This is a good bone to chew ...



       Bruno

PS: I just hope that I am not mislead by something so obvious I can't see it!


Post a reply to this message

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