POV-Ray : Newsgroups : povray.newusers : Is it possible to have color_map values depend on distance from a point ? : Re: Is it possible to have color_map values depend on distance from a point= ? Server Time
2 Nov 2024 17:17:15 EDT (-0400)
  Re: Is it possible to have color_map values depend on distance from a point= ?  
From: Bernard Hatt
Date: 19 Nov 2003 12:35:01
Message: <web.3fbba93a2591b98225bdb9a40@news.povray.org>
Christopher James Huff wrote:
>In article <web.3fba9d39f0c1c7f425bdb9a40[at]news.povray.org>,
> "Bernard Hatt" <bmh### [at] arkadydemoncouk> wrote:
>
>> I'm trying to put a coloured bozo 'splodge' on an object, where the
>> color_map threshold varies from the center to the edge.
>
>There are several options. You could create a pigment map with the
>spherical pattern...basically what you did with layered textures, but
>far more efficient. However, with the example you gave, it would be
>simpler to just use a function pattern. Something like this:
>
>box { <-2,-2,0> <2,2,1 >
>    texture {
>        pigment {
>            function {
>                select(f_noise3d(x/0.025, y/0.025, z/0.025) > f_r(x, y,
>z), 1, 0)
>            }
>            color_map {
>                [0.5 color Green]
>                [0.5 color Red]
>            }
>        }
>    }
>}
>
>If the noise function (which is just what the bozo pattern is) is less
>than the distance, the pattern has a value of 1, otherwise it is 0. You
>may also get good results with something like:
>
>function {f_noise3d(x/0.025, y/0.025, z/0.025)*max(0, 1 - f_r(x, y, z))}
>
>This is essentially the same as multiplying bozo and the spherical
>pattern. The value of the noise gets scaled down to 0 as the distance
>from the origin approaches 1.
>
>Christopher James Huff <cja### [at] earthlinknet>
>http://home.earthlink.net/~cjameshuff/
>POV-Ray TAG: chr### [at] tagpovrayorg
>http://tag.povray.org/
>

Great, I had a feeling there was a simple solution :-)

Your example with the select() seems to need a value that can be +ve or -ve
to work:
eg.
    function {select( f_noise3d(x/0.025, y/0.025, z/0.025) - f_r(x, y,z), 0,
1)}
but the multiplying bozo and the spherical pattern also produced a nice
result:
    function {f_noise3d(x/0.025, y/0.025, z/0.025)*max(0, 1.5 - f_r(x, y,
z))}

Thanks for your help,

Bernard


Post a reply to this message

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