POV-Ray : Newsgroups : povray.general : Density help : Re: Density help Server Time
2 Aug 2024 10:24:43 EDT (-0400)
  Re: Density help  
From: Slime
Date: 17 Nov 2004 16:09:01
Message: <419bbded$1@news.povray.org>
> noisefunc(x,y,z,sqrt(x*x+y*y+z*z)
>
> The sqrt() part is the distance to the origin.

Right.

> And now you use the noise3d result of the current point, scaled with the
> inverse of that distance? Could you give some more explanation on how
> this works? All this function stuff is pretty new to me :)

Well, when you divide each component (x,y,z) of a vector by the size of that
vector, you get the normalized vector: that is, a vector pointing the same
direction away from the origin, but of length 1. (The exception is when you
try to do this for (0,0,0), which causes a division by zero - this makes
sense because (0,0,0) doesn't really have a direction.) So the end result is
that we're sampling the noise function on a sphere of radius 1. Another way
to think about it is that when you divide out the distance from the origin,
the distance is no longer a factor in where you're sampling the pattern:
only the direction is a factor. This causes directional rays of light which
don't vary according to distance.

If you want a busier pattern, you should change

f_noise3d(x/dist,y/dist,z/dist)

to

f_noise3d(x/dist * scale,y/dist * scale,z/dist * scale)

where scale is the amount to make the pattern busier by. This essentially
increases the radius of the sphere that we're sampling on, so you get more
variation in the pattern.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

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