Advertisement
Guest User

menger sponge!

a guest
Oct 26th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Menger Sponge!
  3. */
  4. #include "colors.inc"
  5. camera {
  6.     location <2, 2, -1>
  7.     look_at  <0, 1,  2>
  8. }
  9. #declare unitbox = box {
  10.     <0, 0, 0>, <1, 1, 1>
  11.     pigment { BrightGold }
  12.     finish { reflection .6 }
  13. }
  14. #macro mengersquare(ubox)
  15. union {
  16.     object { ubox translate 2*x }
  17.     object { ubox translate 2*z }
  18.     object { ubox translate 2*x + 2*z }
  19.     object { ubox }
  20. }
  21. #end
  22. #macro mcube(ubox)
  23. union {
  24.     object { mengersquare(ubox) }
  25.     object { mengersquare(ubox) rotate 90*z translate 2*x }
  26.     object { mengersquare(ubox) rotate 90*x translate 3*y + z }
  27.     object { mengersquare(ubox) translate y }
  28.     object { mengersquare(ubox) translate 2*y }
  29. }
  30. scale 1/3
  31. #end
  32. #declare msp1 = union { mcube(unitbox) }
  33. #declare msp2 = union { mcube(msp1) }
  34. #declare msp3 = union { mcube(msp2) }
  35. #declare msp4 = union { mcube(msp3) }
  36. #declare msp5 = union { mcube(msp4) }
  37. object { msp5 scale 3 }
  38. plane {
  39.     y, -1
  40.     pigment { hexagon color Gray05, color Gray10, color Gray15 }
  41. }
  42. light_source { <2, 2, 2> color Red }
  43. light_source { <0, 2, 2> color Blue }
  44. light_source { <2, 2, 0> color Green }
  45. light_source { <2, 0, 2> color Magenta }
  46. light_source { <2, 4, -3> color White }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement