|
|
Go to povray.binaries.images to see some rendered examples:
'Isosurfaces: smooth dividing' Nov. 25, 2003
'Another organic isosurface modeling example" Nov 25, 2003
I hope Netscape doesn't make this too hard to read.
The beginning isosurface:
*** CODE ***
#declare th1 = .01; // threshold value
isosurface{
function{
( sqrt( x*x+y*y+z*z )-1 )
*abs( 1 )
+th1
}
accuracy .01
max_gradient 10
//evaluate 5,1.9,.975 //use if necessary
contained_by{box{-1,1}}
pigment{rgb .7}
finish{specular .5 roughness .01}
}
*** END CODE ***
The function structure I use for smooth dividing is based on the first
blobbing structure described in POV-Ray's documentation, entitled
'Functions, Blob', section 6.5.4.4.4.
The first item in the above function is a basic sphere, where '-1' is
the diameter. It fits inside the contained_by box. The second item is a
null smooth dividing function. It's only purpose for now is to
illustrate the function structure. The third item should be obvious,
it's our threshold value.
Sometimes it is necessary to use evaluate instead of max_gradient. If
unwanted holes open up try using it.
I will replace the null function with a simple function resembling our
favorite ^hat operator:
*** CODE ***
function{
( sqrt( x*x+y*y+z*z )-1 )
*abs( abs(x)+y ) // looks like this ^
+th
}
*** END CODE ***
Notice how the smooth dividing function is placed inside an abs
function. To crease a surface correctly, the function used must always
be encased in something that mirrors it, for simplicity's sake I use 'abs'.
The next bit of code also works, and will produce a smooth division with
a slightly different quality:
*** CODE ***
function{
( sqrt( x*x+z*z+y*y )-1 )
*pow( abs(x)+y,2 )
+.01
}
*** END CODE ***
And another example using a cylinder to cut a circle through the y-azis
of the sphere:
*** CODE ***
function{
(sqrt(x*x+z*z+y*y)-1)
*abs( sqrt(x*x+z*z)-.5 ) //-.5 is the cylinder's diameter
+.01
}
*** END CODE ***
So far the functions have been divided quite severely. There is a way to
'tone down' the effect, and it only adds a little to the code:
*** CODE ***
#declare th2=.1;
function{
sqrt(x*x+z*z+y*y)-1)
*( abs( sqrt(x*x+z*z)-.5 )+th2 )
+.01
}
*** END CODE ***
Th2 values range between 0 and 1, where 0 is strong smooth dividing, and
1 is no smooth dividing.
Hope all of this helps :)
--
Nov. 25, 2003
Samuel Benge
stb### [at] hotmailcom
See my website@: http://www.goldrush.com/~abenge/Top/index.html
Post a reply to this message
|
|