|
|
"Leroy" <whe### [at] gmailcom> wrote:
Don't know whether it fits your use, several years ago I made a test scene for
creating a single voronoi cell. These are rather random, but with regular data
you can create all kind of diamond like shapes. There are several versions and I
like the intersection of planes the most.
---%<------%<-----%<---
# Single Voronoi Cell
# various methods
#version 3.7;
global_settings{ assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 }}
#include "math.inc"
#include "rand.inc"
#include "functions.inc"
#include "transforms.inc"
camera {
perspective angle 11
location <0,0,-25>
look_at <0,0, 0>
}
light_source{< -300, 3000, 0> rgb <0.3,0.3,0.2>}
light_source{< 3000, 300,-500> rgb .5}
light_source{< 300,-3000, 0> rgb <0.2,0.2,0.4>}
#declare Point = <0,0,0>;
#declare Stream = seed(7);
#declare N=22;
#declare arrNeighbours = array[N];
#for(I,0,N-1)
#declare arrNeighbours[I] = VRand_On_Sphere(Stream)/2;
#end
//intersection of planes
intersection{
#for(I,0,N-1)
#declare Neighbour=arrNeighbours[I];
#declare Distance = vlength(Neighbour);
#declare Normal = vnormalize(Neighbour);
plane{Normal, Distance pigment{rgb 1}}
#end
translate <-1,1,0>
}
// intersection of planes as isosurface
#declare fnNeighbours = array[N];
#for(I,0,N-1)
#declare Neighbour = arrNeighbours[I];
#declare Distance = vlength(Neighbour);
#declare Normal = vnormalize(Neighbour);
#declare nX = Normal.x;
#declare nY = Normal.y;
#declare nZ = Normal.z;
#declare fnNeighbours[I]=function{(nX*x+nY*y+nZ*z)-Distance};
#end
#declare fnIntersection = function{
max(
#for(I,0,N-1,1)
#if(I>0)
, fnNeighbours[I](x,y,z)
#else
fnNeighbours[I](x,y,z)
#end
#end
)
}
isosurface {
function{
fnIntersection(x,y,z)
}
contained_by {sphere{0,1.5}}
max_gradient 2
pigment{rgb 1}
translate <1,1,0>
}
// as iso surface planes with "displacement"
isosurface {
function{
fnIntersection(x,y,z)-(f_noise3d(x*10, y*10, z*10)*0.1)
}
contained_by {sphere{0,1.5}}
max_gradient 2
pigment{rgb 1}
translate <-1,-1,0>
}
// as blobs
blob{
threshold .40
sphere{Point,1,1}
#for(I,0,N-1)
#declare Neighbour = arrNeighbours[I];
#declare Distance = vlength(Neighbour);
#declare Normal = vnormalize(Neighbour);
sphere{0,1,-0.8 scale <1,0.2,1> Point_At_Trans(Normal) translate
Normal*Distance*1.2}
#end
pigment{rgb 1}
translate<1,-1,0>
}
#for(I,0,N-1,1)
sphere{arrNeighbours[I],0.01 pigment{rgb x} translate<-1, 1,0>}
sphere{arrNeighbours[I],0.01 pigment{rgb x} translate< 1,-1,0>}
sphere{arrNeighbours[I],0.01 pigment{rgb x} translate< 1, 1,0>}
#end
---%<------%<-----%<---
ingo
Post a reply to this message
|
|