POV-Ray : Newsgroups : povray.newusers : isosurfaces? : Re: isosurfaces? Server Time
30 Jul 2024 18:18:14 EDT (-0400)
  Re: isosurfaces?  
From: Tom Melly
Date: 4 Nov 2003 05:05:55
Message: <3fa77a03$1@news.povray.org>
"Matthew Pace" <mat### [at] lycoscom> wrote in message
news:mat### [at] netplexaussieorg...
> Holy Jumping Mother of God!  It worked!  Sorta, anyways.  It rendered,
> yes, but there was nothing there.  My guess is because I messed up
> somewhere along with placing the objects and camera.
>
> in case anyone was interested still, this is the fixed code:

> #declare Sphere=function (x,y,z,R) {x*x+y*y+z*z}
>
> isosurface
> {
>    function{Sphere(2,2,2,4)}
>    threshold 0
>    contained_by {box {-5,5}}
>    texture
>    {
>       pigment
>       {
>          color rgb .6
>       }
>    }

Close - you specify the R param, but then don't do anything with it.
Consequently, with a threshold of 0, you have a 0-width sphere (i.e. the only
points where your equation evaluates to =< 0 is at <0,0,0>).

Next, you correctly specify (x,y,z,R) as params to the function, but then pass
the constant (2,2,2,4), instead of (x,y,z,4). You want the isosurface to be
evaluated for all points of (x,y,z) within the contained_by box, not just for
<2,2,2>.

Also, and less importantly, you probably want {pow(x*x+y*y+z*z,0.5)-R}, since
otherwise you sphere is going to have a radius of the square-root of R, rather
than R (which is fine, but breaks the doctrine of least surprise ;)

Finally, once you sort these problems out, you're still going to have trouble
because you haven't specified a max_gradient, and the default (1.1 iirc) is too
low. So...

Try:

#declare FSphere=function (x,y,z,R) {pow(x*x+y*y+z*z,0.5) - R}
isosurface
{
  function{FSphere(x,y,z,2)}
  threshold 0
  contained_by {box {-5,5}}
  max_gradient 13
  texture{
    pigment{color rgb .6}
  }
}

One final point - your texture is wrong. You should specify a perfect reflective
texture for all spheres on checked planes, otherwise you are breaking the terms
of the pov-licence.


Post a reply to this message

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