|
|
We've had the cells pattern since at least v3.5. Underneath, it uses a
hash function on cube locations to generate random-ish values. I've used
it a lot as a pattern. I've used the core code from the approach in
povr's f_repeat function.
Cells is great, but I've had on my list to add a more general inbuilt
f_hash function to the povr branch. You can more or less duplicate the
current cells functionality with it, but the idea is to enable much more.
First up, to be able to create cells with shapes other than cubes. This
the idea explored in the attached image.
//---------
// The code. Uses not yet published povr branch as of Aug 14, 2021.
#declare Seed00 = int(7834.5540283051168444); // int of now
#declare Fn00 = function {
f_hash(
(
f_hash(x,Seed00,0.1,0)+
f_hash(y,Seed00*2,0.1,0)+
f_hash(f_cylinder(x,z,y,0.2),Seed00*4,0.005,0)
),
Seed00,0.00,0)
}
#declare Fn01 = Fn00
#declare Fn02 = function {
f_hash(Fn01(x/1.002,y/1.002,z/1.002) - Fn00(x,y,z),0,0,0)
}
#declare POV_MediumGoldenrod = srgb <0.91765,0.91765,0.67843>;
#declare Pigm00 = pigment {
function { Fn02(x,y,z) }
color_map {
[0.00 Black]
[0.10 POV_MediumGoldenrod]
[0.90 POV_MediumGoldenrod*0.3]
[1.00 Black]
}
}
//---------
At Fn02, with some quick math, and as clipped to the image, there are
~5040 'cells.' Here, arcs in square regions; infinite in z. The output
is used in the above pigment to color a z plane.
Bill P.
Post a reply to this message
Attachments:
Download 'f_hash_story.jpg' (199 KB)
Preview of image 'f_hash_story.jpg'
|
|