POV-Ray : Newsgroups : povray.newusers : Need Help: Isosurface, cosinus and inverted textures : Re: Need Help: Isosurface, cosinus and inverted textures Server Time
28 Jul 2024 22:31:09 EDT (-0400)
  Re: Need Help: Isosurface, cosinus and inverted textures  
From: Samuel Benge
Date: 26 Jun 2007 01:39:04
Message: <4680a678@news.povray.org>
kaneda wrote:
> As you can see, the texture-pattern changes depending on the cosinus. Does
> anyone have an idea how to prevent that? I really don't get why it does
> that :<
> 
> Any solution would truly be great so thanks a lot in advance! :D

Hi Kaneda,

I'm going to assume you want the checker to follow the contour of the 
isosurface. There is a way to do this.

To make it work, you will need to turn the pigment into a function and 
then distort it with the same function you use to distort the 
isosurface. I modified your code to show how this is done:

#declare chckr= // a pigment encased in function{...} brackets
function{
  pigment {
   checker
   rgb .05, rgb 1
   translate 0.5 // offset to prevent coincident surface artifacts
  }
}

#declare f= // the ripple
function{
  cos(sqrt(x*x+z*z))
}

isosurface {
  function {
   f(x,y,z) // the ripple
   + y      // the y-facing surface
  }
  threshold   1
  max_gradient  1.5
  contained_by {box {<-4,-2,-4>,<4,2,4>}}
  pigment{
   function{
    // note the ripple's function added to the
    // y axis of the chckr function
    chckr(
     x,
     y+f(x,y,z),
     z
    ).grey
    // all pigment functions must end in .grey,
    // .x, .y or .z (r, g, b, respectively)
   }
  }
}

I hope this helps!

~Sam


Post a reply to this message

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