Created
August 9, 2011 15:45
-
-
Save eiszfuchs/1134397 to your computer and use it in GitHub Desktop.
menger sponge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 3.6; | |
// menger sponge | |
// -W1024 -H1024 +A0.6 +UF +FN +THFS +GAmenger.txt | |
global_settings { | |
// ambient_light rgb <1, 1, 1> | |
radiosity { | |
pretrace_start 0.1 | |
pretrace_end 0.005 | |
count 128 | |
nearest_count 16 | |
error_bound 0.5 | |
recursion_limit 2 | |
low_error_factor 0.05 | |
gray_threshold 0.0 | |
minimum_reuse 0.2 | |
maximum_reuse 0.5 | |
brightness 0.9 | |
adc_bailout 0.01/2 | |
} | |
} | |
sky_sphere { | |
pigment { color rgb <0.8, 0.8, 0.8> } | |
scale 2 | |
// translate -1 | |
} | |
light_source { | |
<3.5, 6, 1.5>, | |
color rgb <0.5, 0.5, 0.5> | |
area_light <2, 0, 0>, <0, 0, 2>, 4, 4 | |
adaptive 1 | |
jitter | |
} | |
camera { | |
right x*1/1 | |
// 1:1 ratio | |
location <3, 2.7, 5.2> | |
look_at <0, -0.5, 0> | |
focal_point <1, 1, 1> | |
// aperture 0.4 | |
// blur_samples 256 | |
// variance 1/10000 | |
} | |
plane { | |
y, -1.5 | |
texture { | |
pigment { color rgb <1, 1, 1> } | |
// finish { reflection { 0.1 } ambient 0.5 diffuse 0.1 } | |
} | |
} | |
#macro Construction(Size, Iteration, PX, PY, PZ) | |
#if(Iteration > 0) | |
#local StepX = -1; | |
#while(StepX < 2) | |
#local StepY = -1; | |
#while(StepY < 2) | |
#local StepZ = -1; | |
#while(StepZ < 2) | |
#local cond1 = 0; | |
#local cond2 = 0; | |
#local cond3 = 0; | |
#if((StepX = 0)&(StepY = 0)) | |
#local cond1 = 1; | |
#end | |
#if((StepX = 0)&(StepZ = 0)) | |
#local cond2 = 1; | |
#end | |
#if((StepY = 0)&(StepZ = 0)) | |
#local cond3 = 1; | |
#end | |
#if(cond1+cond2+cond3 > 0) | |
#else | |
#local _x = PX+(StepX*(Size)); | |
#local _y = PY+(StepY*(Size)); | |
#local _z = PZ+(StepZ*(Size)); | |
Construction(Size/3, Iteration-1, _x, _y, _z) | |
#end | |
#local StepZ = StepZ + 1; | |
#end | |
#local StepY = StepY + 1; | |
#end | |
#local StepX = StepX + 1; | |
#end | |
#else | |
#local Size = Size*3; | |
box { | |
<PX-(Size/2), PY-(Size/2), PZ-(Size/2)> | |
<PX+(Size/2), PY+(Size/2), PZ+(Size/2)> | |
texture { | |
pigment { color rgb <1.0, 1.0, 1.0> } | |
finish { reflection { 0.1 } ambient 0.07 diffuse 0.9 } | |
} | |
} | |
#end | |
#end | |
// Construction(1, 0, 0.0, 0.0, 0.0) | |
// Construction(1, 1, 0.0, 0.0, 0.0) | |
// Construction(1, 2, 0.0, 0.0, 0.0) | |
// Construction(1, 3, 0.0, 0.0, 0.0) | |
// Construction(1, 4, 0.0, 0.0, 0.0) | |
Construction(1, 5, 0.0, 0.0, 0.0) | |
// Construction(1, 6, 0.0, 0.0, 0.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment