POV-Ray : Newsgroups : povray.binaries.images : A couple of isosurfaces : Re: A couple of isosurfaces Server Time
2 Nov 2024 16:09:52 EDT (-0400)
  Re: A couple of isosurfaces  
From: Tek
Date: 9 Jul 2010 04:45:01
Message: <web.4c36e0afe5fe6399caa39c860@news.povray.org>
Ok the source for both objects is pretty small, so I'll just drop it in
here:

//------Greebelium------

isosurface {
 #declare Funches =
  function { pigment {
   average
   pigment_map {
    #local a = 1;
    #local i=0; #while ( i < 3 )
     [a crackle metric 1 pigment_map { [0 rgb .5][.1 crackle metric 1 solid
colour_map { [.5 rgb 0][.5 rgb 1] }] } scale a]
    #local a=a/4; #local i=i+1; #end
   }
  } }

 // trap the pattern between low & high levels...
 function {
  max( y-.5+.5 - Funches(x,y,z).x, min( y+.5/*+.5 - Funches(x,y,z).x*/,
   .5 - Funches(x,y,z).x
  ) )
 }
 max_gradient 20
 contained_by { box { -<5,1,5>, <5,1,5> } }
}


//------Concrete with Rebar------

#macro DecayBlob(Pos)
 isosurface {
  #local Off = VRand(rs)*100;
  #local f_Hole =
   function { pigment {
    average
    pigment_map {
     [1 spherical scale 2 cubic_wave translate Off warp { turbulence .5 octaves
3 } translate -Off]
     [1 pigment_pattern { granite translate Off scale 5 Flip() } poly_wave 2]
     [.4
      pigment_pattern {
       #local f = function { 1-sqrt(min(min(x*x+y*y,x*x+z*z),y*y+z*z))/sqrt(2) }
       function { min(1,max(0,f(sin(x)*4,sin(y)*4,sin(z*4))*5-3)) }
       cubic_wave
       scale 1/pi
       translate .5
       scale .8
       warp { turbulence .2 octaves 3 }
      }
      Flip()
      translate -Pos // so they line up in different holes
     ]
    }
   } }
  function {
   1-2*f_Hole(x,y,z).x
  }
  max_gradient 8
  all_intersections
  contained_by { sphere { 0, 2 } }
  scale .5
  translate Pos
 }
#end

difference {
 superellipsoid { <.1,.1> normal { granite .2 accuracy 1/1000 } }
 #local rs = seed(7);
 #local i=0; #while ( i < 5 )
  #local Norm = <0,0,0>;
  #local Pos = SphereRand(rs);
  #local Pos = trace( Thobject, Pos*2,-Pos, Norm );
  #if ( vlength(Norm) > 0 )
   DecayBlob(Pos)
   #local i=i+1;
  #end
 #end
}


Post a reply to this message

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