POV-Ray : Newsgroups : povray.newusers : Sponge Server Time
28 Jul 2024 22:24:21 EDT (-0400)
  Sponge (Message 11 to 12 of 12)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Trevor G Quayle
Subject: Re: Sponge
Date: 24 Dec 2007 10:05:00
Message: <web.476fc9ded68f7f9fc150d4c10@news.povray.org>
Your best bet is the crackle pattern.  Try the following function:

//START
#declare PP=
function{pattern{
  crackle
  form <-1.5,0.9,0.3>
    scale 1/10
    warp{
      turbulence 0.2
    }
    scale 1/10
    warp{
      turbulence 0.1
    }
    scale 100

    scale 1/20
    scale <1,0.75,1>
}
}

isosurface {
  function {PP(x,y,z)}
  contained_by { box { -1.2, 1.2 } }
  threshold 0.1
  accuracy 0.001
  evaluate 100,1.5,0.7
  pigment{rgb <1,0,0>}
  scale 1/2
}
//END

You can twickle the values a bit.  The form values tend to be very sensitive.
Also play with threshold and the warps (feel free to add more or less warps if
required.  As it can render quite slow, try using it as a pigment first to get
a quick feel for the overall look before running the isosurface.

-tgq


Post a reply to this message

From: Archpawn
Subject: Re: Sponge
Date: 24 Dec 2007 18:35:00
Message: <web.477040abd68f7f9f9c37dbc40@news.povray.org>
If you're interested about my second method of making a sponge, here it is:



#declare S=seed(0);
light_source
{
   <3,5,10>
   rgb 2
}
camera
{
   location <3,5,10>
   look_at 0
   angle 30
}
#declare bubtotal=1000;
#declare bubsize=function(bub){exp(bub/bubtotal)/10}  //bubsize is radius
#declare bubble=0;
#declare bubpos=array[bubtotal]
#declare bubgrid=array[bubtotal][bubtotal]
#while(bubble<bubtotal)
   #declare xarea=(1+2*bubsize(bubble))*(4+2*bubsize(bubble));
   #declare yarea=(2)*(4+2*bubsize(bubble));
   #declare zarea=2;
   #switch(rand(S)*(xarea+yarea+zarea))
      #range(0,xarea)
         #declare
bubpos[bubble]=<1+(2*rand(S)-1)*bubsize(bubble),(2*rand(S)-1)*(.5+bubsize(bubble)),(2*rand(S)-1)*(2+bubsize(bubble))>;
      #break
      #range(xarea,xarea+yarea)
         #declare
bubpos[bubble]=<(2*rand(S)-1)*1-bubsize(bubble),.5+(2*rand(S)-1)*bubsize(bubble),(2*rand(S)-1)*(2+bubsize(bubble))>;
      #break
      #range(xarea+yarea,xarea+yarea+zarea)
         #declare
bubpos[bubble]=<(2*rand(S)-1)*1-bubsize(bubble),(2*rand(S)-1)*.5-bubsize(bubble),2+(2*rand(S)-1)*bubsize(bubble)>;
      #break
   #end
   #declare bubble=bubble+1;
#end
union{
#declare bubble=0;
#while(bubble<bubtotal)
   sphere{bubpos[bubble],bubsize(bubble)
   #declare bubble2=bubble+1;
   #while(bubble2<bubtotal)

#if(vlength(bubpos[bubble]-bubpos[bubble2])<bubsize(bubble)+bubsize(bubble2))
         clipped_by{sphere{bubpos[bubble2],bubsize(bubble2) inverse}}
      #end
      #declare bubble2=bubble2+1;
   #end
   }
   #declare bubble=bubble+1;
#end
pigment{color rgb <1,.9,.2>}
clipped_by{box{<1,.5,2>,-<1,.5,2>}}
}



If you're going to make something based on taking spheres out of a box, I'd
recommend using a modified version of this, as on of the things I did to speed
up render time was to make it only draw spheres along the surface. By the way,
despite the speeding up thing there are tens of millions of tokens, so don't
think it doesn't work.

I think I got it to work with the crackle pattern. How's this one?



light_source
{
   <3,5,10>
   rgb 2
}
camera
{
   location <3,5,10>
   look_at 0
   angle 30
}
#declare F=function{pigment{
  crackle
  turbulence 0
  color_map { [0 rgb .2] [1 rgb 0] }
  scale 0.02
  }
}
intersection{
   isosurface
   {
      #declare asdf = 25;

function{max(f_noise3d(asdf*x,asdf*y,asdf*z),f_noise3d(asdf*(x+1),asdf*y,asdf*z),f_noise3d(asdf*(x+4)/2,asdf*y/2,asdf*z
/2))-.7}
      contained_by{box{<1,.5,2>*1.00001,-<1,.5,2>*1.00001}}
      max_gradient 4.631
   }
   box{
      <1,.5,2>,-<1,.5,2>
      texture{
         pigment{color rgb <1,1,.5>}
         normal{function{F(x,y,z).red}}
      }
   }
   pigment{color rgb <1,1,.5>}}
}


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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