POV-Ray : Newsgroups : povray.binaries.images : Isosurface woes : Isosurface woes Server Time
2 Aug 2024 10:25:21 EDT (-0400)
  Isosurface woes  
From: jceddy
Date: 12 Jul 2013 09:20:01
Message: <web.51e002288eb11ad2314aa6840@news.povray.org>
So, I have the following macro that generates a rounded cylinder isosurface with
a noise/pigment subtracted from it:

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

#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 can
have [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, 0, 0> } ]
        }
      }
    }
  #end
#end

The issue is that as soon as I add in the "+ fn_CracklePigment(x, y, z).gray/10"
to the isosurface function, the generated image gets all funky...basically it
goes from being a rounded cylinder to two cool-looking crackle torii with some
black junk between...when I'm expecting a cool looking crackle rounded cylinder.

Any ideas?

I'm trying to create some shapes that kind look like cracked volcanic rock
glowing from within that I will then compose together into a kind of golem
creature.

On the left is an image generated without the crackle pigment modifier to the
isosurface function. On the right is the image generated from the code above
as-is.


Post a reply to this message


Attachments:
Download 'golem01a.jpg' (95 KB)

Preview of image 'golem01a.jpg'
golem01a.jpg


 

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