|
|
I was bored, and the recursive torii post got me thinking of recursion,
so I made a simple macro that draws the Sierpinski Pyramid. Before I
made this, I didn't know POV-Ray allowed macros to call themselves.
This particular image is built from 78,125 pyramids, each made using 6
triangles, for a total of 468,750 triangles, all wrapped up in a single
mesh with some radiosity, sky_sphere, and a plane tacked on.
(NOTE: I did some searching around...some places show the Sierpinski
Pyramid as having 3 sides on the base, others with 4. 4 was easier to
implement, so I used that.)
-DJ
Post a reply to this message
Attachments:
Download 'sierpinksi.png' (239 KB)
Preview of image 'sierpinksi.png'
|
|
|
|
DJ Wiza <Kil### [at] sohcahtoanet> wrote:
> I was bored, and the recursive torii post got me thinking of recursion,
> so I made a simple macro that draws the Sierpinski Pyramid.
Recursion is fun! Here's a similar pyramid in the Menger-Sierpinski family I
did late last year.
// Persistence Of Vision raytracer version 3.5 sample file.
//
// -F -A0.4 +AM2 +R1
// -D +A0.1 +AM2 +R4
// -d +A0.05 +AM2 +R3
//
// Auth: PM 2Ring
//
global_settings {
assumed_gamma 1
//max_trace_level 10
#if(0)
radiosity {
pretrace_end 0.08
always_sample off
}
ambient_light 0
#end
}
#include "textures.inc"
#declare RoomRad = 30;
#declare Do_Room = 1;
#declare Eye=<0, 5.0,-11>/sqrt(410)*RoomRad *.55;
camera {
location Eye
right x*image_width/image_height up y
direction z
angle 40
look_at 1.65*y
}
//light_source {Eye + <1,1,1> * .05 rgb .4}
light_source {<-7, 15, -12>/sqrt(113)*RoomRad * .7 rgb 1}
//---Textures------------------------------------------------------------------
#declare FMetal =
finish {
ambient 0.02
diffuse 0.35 *2
//phong 0.65 phong_size 120
specular .5 roughness 1e-4
//brilliance 3
//metallic
//reflection {0.75 metallic}
reflection {0.2}
}
#declare FShiny =
finish {
ambient 0.05 diffuse 0.75
specular .25 roughness 1e-4
//brilliance .5
reflection 0.175
}
#declare Checker =
texture{
pigment { checker rgb 1 transmit 1, rgb 0.05 transmit .25 rotate 45*y
scale 4 }
finish {FShiny}
}
//---Objects------------------------------------------------------------------
#declare RR = sqrt(.5);
#macro RBox(A,W,C,D)
sphere{A, W*RR pigment{colour C}finish{FMetal}}
//box{A, A+W pigment{colour C}finish{FMetal}}
//box{A, A+W material{M_NB_Glass texture{pigment{colour C filter 1}}}}
#if(D>0)
#local WW=W/2;
#local DD=D-1;
RBox(A+x*W,WW, (C+x)/2,DD)
RBox(A+y*W,WW, (C+y)/2,DD)
RBox(A+z*W,WW, (C+z)/2,DD)
#end
#end
#declare RCrystal =
union {
RBox(0, 2, rgb 1, 5)
rotate <0, -225, 0>
translate z*sqrt(2)
}
//The room
#declare Room =
union{
sphere{
0, RoomRad
pigment {
//rgb .55
gradient y
color_map {
[0 rgb <0, 0, .1>]
[1 rgb <.1,.2,1>*2]
}
scale RoomRad/2
}
finish{ambient .1 diffuse .5}
//normal{granite .1 scale .02}
}
#if(1)
box{
<-1, -1/RoomRad, -1>, <1, 0, 1> scale RoomRad
//texture{White_Marble scale 2}texture{Checker}
pigment{crackle solid} normal{crackle 1} finish{FShiny}
}
#end
hollow
no_shadow
translate -2*y
}
//---The
scene------------------------------------------------------------------
object{RCrystal}
#if(Do_Room)
object{Room}
#else
background {rgb .5}
#end
//---------------------------------------------------------------------
Post a reply to this message
Attachments:
Download 'rblockb2.jpg' (135 KB)
Preview of image 'rblockb2.jpg'
|
|