POV-Ray : Newsgroups : povray.general : Spherical density map : Re: Spherical density map Server Time
15 May 2024 15:58:32 EDT (-0400)
  Re: Spherical density map  
From: Alain
Date: 7 Jan 2016 21:37:29
Message: <568f20e9$1@news.povray.org>
Le 16-01-07 17:01, Mike Horvath a écrit :
> I'm confused about how to set up a spherical density map.
>
> I want a density map that is dense at the origin, and stays dense until
> it gets close to 1 unit away, then fall off sharply.
>
> How would I set this up?
>
> Thanks.
>
>
> Mike

Knowing that the spherical evaluate to 1 at <0,0,0> and drop to zero at 
radius 1.

Like this:

density {
         spherical
         color_map {
                 [0     rgb 0]
                 [0.8   rgb 10]
         }
}

This gives full density for 80% of the radius, that will sharply drop to 
zero in the last 20% of the radius.
You don't need to drop to zero before the pattern actualy drop to zero, 
so, using 0.05 as a controll value is just wastefull.

Using two densities and averaging them don't offer any real advantage 
and take about twice as long to render. You need to evaluate both 
density, add them and divide the result.

The patterns cylindrical, planar and boxed work the same.
cylindrical evaluate to 1 along the Y axis and drop to zero at radius 1.
planar evaluate at 1 on the X-Z plane and drop to zero at -1 and +1.
boxed conform to box{-1, 1} with a value of zero at the surface.

I can't recoment to ever use stdinc.inc. It include a large number of 
other inc files that you may not need. In Norbert's example, NOT a 
single bit from those includes are ever used.



Alain


Post a reply to this message

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