POV-Ray : Newsgroups : povray.general : Dark spots in media Server Time
25 Nov 2024 21:36:27 EST (-0500)
  Dark spots in media (Message 1 to 2 of 2)  
From: cubicApocalypse
Subject: Dark spots in media
Date: 25 Feb 2013 19:10:01
Message: <web.512bfd3935e1cb21116286700@news.povray.org>
How do I fix these dark spots around the stars? I'm only using one absorbing
media, and it's for the shadows in the nebula.

Image: http://i.imgur.com/uSiDBfL.png

Code:


global_settings {
 max_intersections 128
 max_trace_level 32

}


#declare blueSize = seed(934);
#declare randBlueSize = (rand(blueSize)+0.5);

#declare blueStar = union {
  sphere {
  0
  0.3
  pigment { bozo scale 0.1 turbulence 2 color_map {[0 rgb <0.1,0.4,1>][1 rgb
<0.1,0.2,0.5>] } }
  finish { ambient 10 }
  }
  sphere {
  0
  1
  hollow
  pigment { rgbf 1 }
  interior { media { emission rgb <0.3,0.7,1>
  density {

        spherical
        color_map {[0 rgb 0][0.7 rgb <0.5,0.7,1>]}

  }

   }}
  finish { ambient 1 }
  }
  }


#declare Amount = 1000;
#declare Seed = seed(134);
#declare MinExtent = <-100, -100, -100>;
#declare MaxExtent = <100, 100, 100>; // Modify as desired

#declare Index = 0;
#while(Index < Amount)
  object
  { blueStar scale 0.2*randBlueSize
    #declare RandVector = <rand(Seed), rand(Seed), rand(Seed)>;
    translate MinExtent + (MaxExtent - MinExtent) * RandVector
  }
  #declare Index = Index + 1;
#end

#declare whiteSize = seed(897);
#declare randWhiteSize = (rand(whiteSize)+0.5);

#declare whiteStar =  union {
  sphere {
  0
  0.3
  pigment { bozo scale 0.1 turbulence 2 color_map {[0 rgb 0.5][1 rgb 1] } }
  finish { ambient 10 }
  }
  sphere {
  0
  1
  hollow
  pigment { rgbf 1 }
  interior { media { emission rgb <0.3,0.7,1>
  density {

        spherical
        color_map {[0 rgb 0][0.7 rgb 0.6]}

  }

   }}
  finish { ambient 1 }
  }
  }


#declare Amount = 1000;
#declare Seed = seed(1340);
#declare MinExtent = <-100, -100, -100>;
#declare MaxExtent = <100, 100, 100>; // Modify as desired

#declare Index = 0;
#while(Index < Amount)
  object
  { whiteStar scale 0.2*randWhiteSize
    #declare RandVector = <rand(Seed), rand(Seed), rand(Seed)>;
    translate MinExtent + (MaxExtent - MinExtent) * RandVector
  }
  #declare Index = Index + 1;
#end

#declare redStar = union {
  sphere {
  0
  0.3
  pigment { bozo scale 0.1 turbulence 2 color_map {[0 rgb <1,0.4,0.1>][1 rgb
<0.5,0.2,0.1>] } }
  finish { ambient 10 }
  }
  sphere {
  0
  1
  hollow
  pigment { rgbf 1 }
  interior { media { emission rgb <0.3,0.7,1>
  density {

        spherical
        color_map {[0 rgb 0][0.7 rgb <1,0.7,0.5>]}

  }

   }}
  finish { ambient 1 }
  }
  }

#declare redSize = seed(875);
#declare randRedSize = (rand(blueSize)+0.5);

#declare Amount = 1000;
#declare Seed = seed(13400);
#declare MinExtent = <-100, -100, -100>;
#declare MaxExtent = <100, 100, 100>;

#declare Index = 0;
#while(Index < Amount)
  object
  { redStar scale 0.2*randRedSize
    #declare RandVector = <rand(Seed), rand(Seed), rand(Seed)>;
    translate MinExtent + (MaxExtent - MinExtent) * RandVector
  }
  #declare Index = Index + 1;
#end

#declare cameraPosition = ((clock-0.5)*2)*30;


camera {
  location  <0.0, 0, cameraPosition>
  look_at   <0.0, 0.0,  0.0>
  right     x*image_width/image_height
}

sphere{
0
20
  texture{
    pigment{ rgbf 1}
  }
  interior{
   media{
    method 3
    samples 30
    emission <1,0.6,0.1>
    density{ wrinkles
             color_map {
              [0.00 rgb 0]
              [0.50 rgb 0.05]
              [0.65 rgb 0.1]
              [0.75 rgb 0.5]
              [1.00 rgb 0.2]
             }
             turbulence 0.9
             octaves 10
             omega 0.6
             scale  11

           }
    density{  spherical
              color_map {
               [0.0 rgb 0]
               [0.5 rgb 0.5]
               [1.0 rgb 1]
              }
             scale <1,1,1>*20
           }
   }

      media{
    method 3

    samples 30
    emission <0.6,0.7,0.1>
    density{ wrinkles
             color_map {
              [0.00 rgb 0]
              [0.65 rgb 0.0]
              [0.75 rgb 0.2]
              [1.00 rgb 0.1]
             }
             turbulence 0.9
             octaves 10
             omega 0.6
             scale  10

           }
    density{  spherical
              color_map {
               [0.0 rgb 0]
               [0.5 rgb 0.5]
               [1.0 rgb 1]
              }
             scale <1,1,1>*20
           }
   }

   media{
    method 3
    samples 30
    absorption rgb 2
    density{ wrinkles
             color_map {
              [0.00 rgb 0]
              [0.50 rgb 0.05]
              [0.65 rgb 0.1]
              [0.75 rgb 0.5]
              [1.00 rgb 0.2]
             } // end color_map
             turbulence 0.8
             octaves 10
             omega 0.6
             scale  12

           }
    density{  spherical
              color_map {
               [0.0 rgb 0]
               [0.5 rgb 0.5]
               [1.0 rgb 1]
              }
             scale <1,1,1>*20
           }
   }
   media{
    method 3

    samples 30

    emission <0.3,0.6,0.5>
    density{ wrinkles
             color_map {
              [0.00 rgb 0]
              [0.50 rgb 0.01]
              [0.65 rgb 0.05]
              [0.75 rgb 0.25]
              [1.00 rgb 0.1]
             }
             turbulence 2
             scale  50

           }
    density{  spherical
              color_map {
               [0.0 rgb 0]
               [0.5 rgb 0.5]
               [1.0 rgb 1]
              }
             scale <1,1,1>*20
           }
   }
  }
 hollow

}

#declare Amount = 256;
#declare Seed = seed(347);
#declare MinExtent = <-30, -30, -30>;
#declare MaxExtent = <30, 30, 30>;

#declare Index = 0;
#while(Index < Amount)
  object
  { blueStar scale 0.2
    #declare RandVector = <rand(Seed), rand(Seed), rand(Seed)>;
    translate MinExtent + (MaxExtent - MinExtent) * RandVector
  }
  #declare Index = Index + 1;
#end

#declare Amount = 128;
#declare Seed = seed(903248);
#declare MinExtent = <-10, -10, -10>;
#declare MaxExtent = <10, 10, 10>;

#declare Index = 0;
#while(Index < Amount)
  object
  { blueStar scale 0.2
    #declare RandVector = <rand(Seed), rand(Seed), rand(Seed)>;
    translate MinExtent + (MaxExtent - MinExtent) * RandVector
  }
  #declare Index = Index + 1;
#end


Post a reply to this message

From: Kenneth
Subject: Re: Dark spots in media
Date: 26 Feb 2013 06:10:00
Message: <web.512c97527ad9436fc2d977c20@news.povray.org>
"cubicApocalypse" <nomail@nomail> wrote:

> How do I fix these dark spots around the stars?

It's an old media{samples...} situation when using multiple enclosed media
objects. And the problem is two-fold here--but easily remedied.

The dark-looking 'star halos' are basically because a media samples count
somewhere in the scene is too low. But it's more interesting: The real
cause of the problem is that the bigger 'nebula' sphere *encloses* all the star
spheres. The camera ray(s) 'see' this larger sphere first (the rays hit it
first, before they hit the individual star spheres.) In which case,
the NEBULA's media samples override the individual stars. So in your scene it
doesn't matter if the stars have very high sample values, or even very low ones;
they'll all be overridden.

The problem is in the nebula, where you have four medias. The samples values are
all set at 30, which is too low. But here's the interesting thing: the LAST ONE
of the four medias is the one that sets the samples count for all of them. The
other samples/methods/intervals are ignored and can even be left out. Try this
experiment: Put in 500 as samples values for the first three of the medias
there, and 5 for the final one. The render will look really bad!

The overall solution is easy: For the very last media in your nebula, give it
this:
method 3
intervals 1
samples 300 // This looks OK

Also, I think all the stars' 'halo spheres' have an emission value that's too
low. It looks like you're to trying to make them glow, so I would increase those
to maybe rgb 2.5*<0.3,0.7,1>. (Not the color_maps.)

BTW, this is a really nice scene!


Post a reply to this message

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