POV-Ray : Newsgroups : povray.binaries.images : Isosurface woes : Re: Isosurface woes Server Time
2 Aug 2024 10:27:52 EDT (-0400)
  Re: Isosurface woes  
From: s day
Date: 12 Jul 2013 17:25:02
Message: <web.51e073eeb644a79d5bfe13270@news.povray.org>
"jceddy" <jce### [at] gmailcom> wrote:

> Any ideas?
>

I adjusted the crackle function (reversed the colours) then subtracted this from
the cylinder instead of adding it (see below) does the attached look like what
you were after?

Sean

#declare fn_CracklePigment = function {
    pigment {
        crackle
        pigment_map {
          [0.1 color rgb 0]
          [0.2 color rgb 1]
        }
    }
}

#declare fn_Cylinder = function(_x, _y, _z, _rad, _len) {
  max(sqrt(pow(_x,2) + pow(_z,2)) - _rad, f_rounded_box(_x, _y, _z, 0, _rad,
_len/2, _rad))
}

#macro RoundCylinder(inner, outer, length)
  #if(use_iso)
    isosurface {
      function {
        min(
          min(
            f_torus(x, y - (length/2-outer), z, inner-outer, outer),
            fn_Cylinder(x, y, z, inner, length-2*outer)
          ),
          min(
            fn_Cylinder(x, y, z, inner-outer, length),
            f_torus(x, y + (length/2-outer), z, inner-outer, outer)
          )
        ) - fn_CracklePigment(x, y, z).gray/10
      }
      contained_by { box { <-10, -length/2, -10>, <10, length/2, 10> } }
//container shape
      accuracy 0.001                      // accuracy of calculation [0.001]
      max_gradient 4                      // maximum gradient the function
canhave [1.1]

      texture {
        crackle
        texture_map {
          [0.1 pigment { color rgb <1, 0, 0> } finish { ambient 1.0 }]
          [0.2 pigment { color rgb <0, 0, 0> } ]
        }
      }
    }
  #else
    union {
      torus { inner-outer, outer translate <0, length/2-outer, 0> }
      cylinder { <0, -length/2+outer, 0>, <0, length/2-outer, 0>, inner }
      cylinder { <0, -length/2, 0>, <0, length/2, 0>, inner-outer }
      torus { inner-outer, outer translate <0, -(length/2)+outer, 0> }

      texture {
        crackle
        texture_map {
          [0.1 pigment { color rgb <1, 0, 0> } finish { ambient 1.0 }]
          [0.2 pigment { color rgb <0, 1, 0> } finish { ambient 1 }]
        }
      }
    }
  #end
#end

object { RoundCylinder(3, 0.2, 5) }


Post a reply to this message


Attachments:
Download 'c.png' (36 KB)

Preview of image 'c.png'
c.png


 

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