POV-Ray : Newsgroups : povray.text.scene-files : tiling to infinity 3d Server Time
8 Jul 2024 10:35:29 EDT (-0400)
  tiling to infinity 3d (Message 1 to 1 of 1)  
From: Pete
Subject: tiling to infinity 3d
Date: 4 Oct 2000 21:55:03
Message: <3941.312T1715T11404800PeterC@nym.alias.net>
Another .pov file using the memory-saving mesh
object for huge tilings.  This creates a very large
rectalinear solid whose opposite corner is lost in the
distant horizon line.  it doesn't go on forever, but
it sure looks like it does.

Pete

-- 

global_settings {
  assumed_gamma 2.4
  number_of_waves 9
}


#declare ntsc = false;
#declare rseed = seed(31892095);


#macro camera_transform()
  rotate x*15
  rotate y*45
  translate <-16, 12, -20>
#end


camera {
  location 0
  direction <0, 0, 1>
  #if (ntsc = true)
    right <(640 / 400) * (10/11), 0, 0>
  #else
    right <(640 / 480), 0, 0>
  #end
  up <0, 1, 0>
  camera_transform()
}


union {
  text {
    ttf "crystal.ttf" "each box is 12 triangles"
    0.01, 0
    scale 0.1
    translate <-1.75, 1.2, 0>
  }
  text {
    ttf "crystal.ttf" concat("each unit is 11 x 11 x 11 boxes (", str(11 * 11
* 11, 0, 0), ")")
    0.01, 0
    scale 0.1
    translate <-1.75, 1.1, 0>
  }
  text {
    ttf "crystal.ttf" concat("40x10x40 units (", str(40 * 10 * 40, 0, 0), ")")
    0.01, 0
    scale 0.1
    translate <-1.75, 1.0, 0>
  }
  #declare t_count = (40 * 40 * 10) * (11 * 11 * 11) * 12;
  text {
    ttf "crystal.ttf" concat("total triangle count is: ", str(t_count, 0, 0))
    0.01, 0
    scale 0.1
    translate <-1.75, 0.9, 0>
  }
  no_shadow
  pigment { color rgbt <0.2, 1, 0, sqrt(0.5)> }
  finish { ambient 1 diffuse 0 }
  translate <0, 0, 3>
  camera_transform()
}


#macro rnd_rotate()
  rotate <360 * rand(rseed), 360 * rand(rseed), 360 * rand(rseed)>
#end


#macro rnd_translate()
  translate <4 - 8 * rand(rseed), 4 - 8 * rand(rseed), 4 - 8 * rand(rseed)>
#end


#macro perturb()
  rnd_translate()
  rnd_rotate()
#end


#macro do_quad(p1, p2, p3, p4) // quadrilateral as two triangles -
counterclockwise order
  triangle { p1, p2, p3 }
  triangle { p1, p3, p4 }
#end


#macro do_box(bc1, bc2) // same parameters as a regular box object
  #local c1 = <0, 0, 0> + bc1;  // convert to vector if not
  #local c2 = <0, 0, 0> + bc2;  // convert to vector if not
  do_quad(<c1.x, c1.y, c1.z>, <c2.x, c1.y, c1.z>, <c2.x, c1.y, c2.z>, <c1.x,
c1.y, c2.z> ) // bottom
  do_quad(<c1.x, c2.y, c1.z>, <c2.x, c2.y, c1.z>, <c2.x, c2.y, c2.z>, <c1.x,
c2.y, c2.z> ) // bottom
  do_quad(<c1.x, c2.y, c1.z>, <c1.x, c1.y, c1.z>, <c1.x, c1.y, c2.z>, <c1.x,
c2.y, c2.z> ) // left side
  do_quad(<c2.x, c2.y, c1.z>, <c2.x, c1.y, c1.z>, <c2.x, c1.y, c2.z>, <c2.x,
c2.y, c2.z> ) // right side
  do_quad(<c1.x, c2.y, c2.z>, <c2.x, c2.y, c2.z>, <c2.x, c1.y, c2.z>, <c1.x,
c1.y, c2.z> ) // front
  do_quad(<c1.x, c2.y, c1.z>, <c2.x, c2.y, c1.z>, <c2.x, c1.y, c1.z>, <c1.x,
c1.y, c1.z> ) // back
#end


sky_sphere {
  pigment {
    bozo
    turbulence 1.1
    perturb()
    scale 1/3
    color_map {
      [ 0.5 color rgb 0 ]
      [ 1.0 color rgb <0.4, 0, 1> * 0.6 ]
    }
  }
  pigment {
    granite
    perturb()
    scale 0.01
    color_map {
      [ 0.8 color rgbt 1 ]
      [ 0.8 color rgb 1 ]
    }
  }
}


#render "\n building mesh ...\n"
#declare cube_unit = mesh {
  #declare xx = -5;
  #while (xx < 6)
    #declare yy = -5;
    #while (yy < 6)
      #declare zz = -5;
      #while (zz < 6)
        do_box(<xx, yy, zz> * 2 - 0.5, <xx, yy, zz> * 2 + 0.5)
        #declare zz = zz + 1;
      #end
      #declare yy = yy + 1;
    #end
    #declare xx = xx + 1;
  #end
}
#render "Done building mesh.  Now to place copies\n"


union {
  #declare xx = 0;
  #while (xx < 40)
    #declare yy = 0;
    #while (yy > -10)
      #declare zz = 0;
      #while (zz < 40)
        object {
          cube_unit
          translate <xx, yy, zz> * 22
        }
        #declare zz = zz + 1;
      #end
      #declare yy = yy - 1;
    #end
    #declare xx = xx + 1;
  #end
  pigment { color rgb 1 }
  finish { ambient 0.4 diffuse 0.6 }
}


light_source {
  <3000, 3000, -2000>
  color rgb <0.5, 0.4, 0.6>
}
light_source {
  <-3000, 1000, -1000>
  color rgb <0.5, 0.6, 0.4>
}


/* actual end of this file */


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.