POV-Ray : Newsgroups : povray.newusers : cant get density{sphereical} to work Server Time
4 Jul 2024 13:46:30 EDT (-0400)
  cant get density{sphereical} to work (Message 1 to 4 of 4)  
From: james dublin
Subject: cant get density{sphereical} to work
Date: 5 Mar 2010 19:55:01
Message: <web.4b91a74df131dde7a6facfae0@news.povray.org>
hello all

I'm just playing about with povray getting used to what going on ...BUT...

i either don't understand something or haven't turned something on as a simple
scene  will not render a sphere with a spherical density modifier for the
containing medium i was expecting to see a sphere with a decreasing radial
colour density, instead its just not there. a variation on this is  if i use a
density_map in which case only the outer most layer is viable.... WHY is this
happening? as it doesn't seem to be a very complicated thing to get to work,
even the example in the povray tutorial wont work.

I'm working in Linux (ubuntu 9.04 64 bit) Persistence of Vision(tm) Ray Tracer
Version 3.6.1 (Debian  (x86_64-linux-gnu-g+
+ 4.3.3 @ x86_64-pc-Linux-gnu))
though the problem also happens in windows version

what do i change please thanks

James

code follows:

#include "colors.inc"
#include "textures.inc"
global_settings{ambient_light 0
max_trace_level 10
}


camera {
    location <0, 0, 0>
    look_at  <0, 0,  10>
  }

plane{<0, 1, 0>, -2
    pigment {
      checker color Red, color Blue
    }


}

sphere {
    <0, 0, 10>, 2
texture {pigment{ Clear}}

    interior{
media{method 3

scattering{4,White}
density {spherical density_map
         { [0 rgb .01]
           [0.4 rgb <1,0,0>]
           [0.8 rgb <1,1,0>]
           [1 rgb 1]
         }

}
}
}
    hollow
  }

light_source { <0, 100, 0> <2,2,2>
 fade_distance 75
 fade_power 2

 }


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: cant get density{sphereical} to work
Date: 6 Mar 2010 03:13:30
Message: <4b920eaa@news.povray.org>
Hi James:

   The problem is that you are creating the sphere at your desired location
<0,0,10>, but the spherical pattern is at <0,0,0>. Just change the sphere
like the following and it will work:

//-----------------------------------
sphere {
     <0, 0, 0>, 1
texture {pigment{ Clear}}

     interior{
media{method 3

scattering{4,White}
density {spherical density_map
          { [0 rgb .01]
            [0.4 rgb <1,0,0>]
            [0.8 rgb <1,1,0>]
            [1 rgb 1]
          }

}
}
}
     hollow
     scale 2
     translate <0,0,10>
   }
//-----------------------------------


   Regards,


-- 
Jaime Vives Piqueres

http://www.ignorancia.org


Post a reply to this message

From: Alain
Subject: Re: cant get density{sphereical} to work
Date: 6 Mar 2010 13:13:17
Message: <4b929b3d@news.povray.org>

> hello all
>
> I'm just playing about with povray getting used to what going on ...BUT...
>
> i either don't understand something or haven't turned something on as a simple
> scene  will not render a sphere with a spherical density modifier for the
> containing medium i was expecting to see a sphere with a decreasing radial
> colour density, instead its just not there. a variation on this is  if i use a
> density_map in which case only the outer most layer is viable.... WHY is this
> happening? as it doesn't seem to be a very complicated thing to get to work,
> even the example in the povray tutorial wont work.
>
> I'm working in Linux (ubuntu 9.04 64 bit) Persistence of Vision(tm) Ray Tracer
> Version 3.6.1 (Debian  (x86_64-linux-gnu-g+
> + 4.3.3 @ x86_64-pc-Linux-gnu))
> though the problem also happens in windows version
>
> what do i change please thanks
>
> James
>
> code follows:
>
> #include "colors.inc"
> #include "textures.inc"
> global_settings{ambient_light 0
> max_trace_level 10
> }
>
>
> camera {
>      location<0, 0, 0>
>      look_at<0, 0,  10>
>    }
>
> plane{<0, 1, 0>, -2
>      pigment {
>        checker color Red, color Blue
>      }
>
>
> }
>
> sphere {
>      <0, 0, 10>, 2
> texture {pigment{ Clear}}
>
>      interior{
> media{method 3
>
> scattering{4,White}
> density {spherical density_map
>           { [0 rgb .01]
>             [0.4 rgb<1,0,0>]
>             [0.8 rgb<1,1,0>]
>             [1 rgb 1]
>           }
>
> }
> }
> }
>      hollow
>    }
>
> light_source {<0, 100, 0>  <2,2,2>
>   fade_distance 75
>   fade_power 2
>
>   }
>
>
>
>
The spherical pattern is defined at the origin. It evaluate to 1 at 
ABSOLUTE coordinate <0,0,0> and to 0 everywhere where the distance from 
there is 1 or more.

Your sphere center is situated at 10 units from the origin and, given 
it's radius, no point is closer that 8 units.

You have 2 solutions:
First and best: Define your sphere at the origin, then translate if 
where you want it.
sphere {
     <0, 0, 0>, 2
texture {pigment{ Clear}}
     interior{media{method 3
scattering{4,White}
density {spherical density_map
          { [0 rgb .01]
            [0.4 rgb <1,0,0>]
            [0.8 rgb <1,1,0>]
            [1 rgb 1]
          }
}
}
}
     hollow
translate<0,0,10>  }

Alternatively, you can translate the medis itself:
sphere {
     <0, 0, 10>, 2
texture {pigment{ Clear}}
     interior{media{method 3
scattering{4,White}
density {spherical density_map
          { [0 rgb .01]
            [0.4 rgb <1,0,0>]
            [0.8 rgb <1,1,0>]
            [1 rgb 1]
          }translate <0,0,10>
}
}
}
     hollow
   }

The first is beter. If you ever want, or need, to change the sphere's 
location, you only need to change the translate at the end.

Using the second solution, you need to change the location of the sphere 
and the translate of the media. Also, if you ever scale or rotate the 
sphere, with the first method, the media will get scaled/rotated with 
the sphere.

It's generaly considered a good practice to define all objects at the 
origin. Then to apply any scaling and rotation, then to translate the 
objects to there desired location.
scale and rotate are always performed relative the world's origin, never 
relative to the center of the objects.

Alain


Post a reply to this message

From: james dublin
Subject: Re: cant get density{sphereical} to work
Date: 6 Mar 2010 17:25:01
Message: <web.4b92d550d6be1c6fd6903b210@news.povray.org>
AHH I see.... I remember, now read that somewhere in documentation but hadn't
got on to translating objects and got stuck on thinking about media problems

thanks for your patience all


Post a reply to this message

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