|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Well, here it is. I don't see any need for this. It seems simple, at least
it did to me after Samuel's explanation. I'll break it down for you,
nonetheless.
/*
05-10-1999
"BoxBlob" by Anthony Bennett
Feel free to use it, all I want
is credit and/or notification
Notes:
* blob
| union
& intersection
% difference
min(a,b) union
max(a,b) intersection
*/
//lights!
light_source {< 1,1,-1>*10 rgb <1.00,1.00,0>*2/3}
light_source {< 0,1,-1>*10 rgb <1.00,0.75,0>*2/3}
light_source {<-1,1,-1>*10 rgb <1.00,0.50,0>*2/3}
//camera!
camera {location <1,2,-3>*2.8 look_at 0}
//action!
//Following are the definitions for
//the boxes used in the function of
//the isosurface.
#declare c1 = < 1,4, 1>;
#declare c2 = <-1,2,-1>;
#declare x1 = c1.x;
#declare y1 = c1.y;
#declare z1 = c1.z;
#declare x2 = c2.x;
#declare y2 = c2.y;
#declare z2 = c2.z;
#declare d1 = <1,-2,1>;
#declare d2 =-<1, 4,1>;
#declare u1 = d1.x;
#declare v1 = d1.y;
#declare w1 = d1.z;
#declare u2 = d2.x;
#declare v2 = d2.y;
#declare w2 = d2.z;
#declare e1 = <2, 1, 1>;
#declare e2 = <4,-1,-1>;
#declare i1 = e1.x;
#declare j1 = e1.y;
#declare k1 = e1.z;
#declare i2 = e2.x;
#declare j2 = e2.y;
#declare k2 = e2.z;
#declare f1 = <-2, 1, 1>;
#declare f2 = <-4,-1,-1>;
#declare l1 = f1.x;
#declare m1 = f1.y;
#declare n1 = f1.z;
#declare l2 = f2.x;
#declare m2 = f2.y;
#declare n2 = f2.z;
#declare r0 = 3;
#declare r1 = 1;
isosurface
{
function
//torus, modified and shortened formula from quartic in pov-docs
(x^2*(x^2+2*z^2+2*y^2) + y^2*(y^2+2*z^2-2*(r0^2+r1^2)) + z^4 +
(r0^2-r^2)*(2*z^2-2*x^2+(r0^2-r^2)))
*
//top box
((x-x1)*(x-x2) & (z-z1)*(z-z2) & (y-y1)*(y-y2))// +
(sqrt(x^2+(y-3)^2+z^2)-1))
*
//bottom box
((x-u1)*(x-u2) & (z-w1)*(z-w2) & (y-v1)*(y-v2))// +
(sqrt(x^2+(y+3)^2+z^2)-1))
*
//side box 1 (sorry, i forget which side...)
((x-i1)*(x-i2) & (z-k1)*(z-k2) & (y-j1)*(y-j2))// +
(sqrt((x-3)^2+y^2+z^2)-1))
*
//side box 2 (sorry, i forget which side...)
((x-l1)*(x-l2) & (z-n1)*(z-n2) & (y-m1)*(y-m2))// +
(sqrt((x+3)^2+y^2+z^2)-1))
//perhaps threshold is a bit high, it doesn't seem to affect the boxblob
much
threshold 100 sign 1 bounded_by {sphere {0,4.5}}
//simplicity
pigment {rgb 1} finish {phong 1}
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
/* Isosurface blob */
#include "colors.inc"
global_settings { assumed_gamma 1.0 max_trace_level 10 }
background { color rgb <1/15,1/sqrt(15),1>*0.5 }
// Light constants.
#declare lightDir = vnormalize(<-0.5,2.1,-2>);
#declare lightLen = 1.5e6;
#declare lightRad = lightLen*sin(radians(0.25));
#declare lightCol = <1,.97,.95>;
// Camera constants.
#declare camPos = <-0.25, 0.5, -0.75>*30;
#declare camLookAt = <0,0,0>;
#declare camAngle = 40;
camera {
up <0, 1, 0>
right <4/3, 0, 0>
location camPos
direction <0.0, 0.0, 1>
angle camAngle
look_at camLookAt
}
light_source {
0*x
colour rgb lightCol
translate lightDir*lightLen
parallel
point_at 0
media_attenuation on
}
#declare r0 = 3;
#declare r1 = 0.5;
#declare fnTor = function { "Torus", <r0,r1> }
#declare fnSph = function { "Sphere", <1> }
#declare fnBox = function {
sqr(max(0,(max(abs(x),max(abs(y),abs(z))))-1)) }
#declare fnTorB = function { sqr(max(0,1-sqr(1+fnTor(x,y,z)))) }
#declare fnSphB = function { sqr(max(0,1-sqr(1+fnSph(x,y,z)))) }
#declare fnBoxB = function { sqr(max(0,1-sqr(1+fnBox(x,y,z)))) }
#declare fnLongFunc = function {
0.1 - (
fnTorB(x,z,y)
+ fnSphB(x*2,0,z*2)
+ fnSphB(0,y*2,z*2)
+ fnBoxB(x,y+3,z)
+ fnBoxB(x,y-3,z)
+ fnBoxB(x+3,y,z)
+ fnBoxB(x-3,y,z)
)
}
isosurface {
function { fnLongFunc(x,y,z) }
bounded_by { box { -10, 10 } }
eval
sign 1
pigment { rgb <.9,.85,.7> }
}
/*
Bye for now,
Mike Andrews.
*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
What the hell did you do here? How did you come up with all those max, etc.
etc. formulas?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
The formula I used is the way that PoV combines blob components.
The maxs limit the effect of each component so they don't add negative
potential outside their nominal 'surface' (ie where the potential is
zero).
The '0.1 - ( ... )' sets the threshold, 0.1 in this case, and you can
multiply each individual component by a value to set its strength, all 1
in the example.
Hope this helps,
Mike Andrews.
TonyB wrote:
>
> What the hell did you do here? How did you come up with all those max, etc.
> etc. formulas?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|