pov-ray/tuts/chain.pov
2016-03-11 19:46:23 -06:00

69 lines
2.0 KiB
POVRay

#version 3.7;
#include "colors.inc"
global_settings {
assumed_gamma 1.8
}
camera {
right x*1280/720
location <-25, -75.1, -60>
look_at 0.1
angle 30
}
background { color rgb <.46, .09, .06> }
light_source { <300, 300, -1000> White }
#declare half_torus = difference {
torus {
4,1
sturm
rotate x*-90 // so we can see it from the top
}
box { <-5, -5, -1>, <5, 0, 1> }
}
#declare chain_segment = cylinder { <0,4,0>, <0,-4,0>, 1 }
#declare flip_it = x*180;
#declare torus_trans = 8;
#declare link_trans = torus_trans*2-2*y;
#declare chain_texture = texture {
pigment { color rgb <.49, .56, .59> }
finish {
ambient .1
diffuse .4
reflection .35
specular 1
metallic
}
}
#declare chain_link = union {
object { half_torus translate y*torus_trans/2 }
object { half_torus rotate flip_it translate -y*torus_trans/2 }
object { chain_segment translate x*torus_trans/2 }
object { chain_segment translate -x*torus_trans/2 }
translate y*60
}
#declare chain = union { // needs loop with random range
object { chain_link } // 0
object { chain_link translate -y*link_trans rotate y*78 } // 90
object { chain_link translate -y*link_trans*2 rotate y*8 } // 0
object { chain_link translate -y*link_trans*3 rotate y*112 } // 90
object { chain_link translate -y*link_trans*4 rotate y*-10 } // 0
object { chain_link translate -y*link_trans*5 rotate y*90 } // 90
object { chain_link translate -y*link_trans*6 rotate y*18 } // 0
object { chain_link translate -y*link_trans*7 rotate y*72 } // 90
texture { chain_texture }
}
//======= RENDER
object { chain scale .45 }
object { chain scale .45 translate < 10, -10, -20 > rotate y*20 }
object { chain scale .45 translate < 10, 30, 20 > rotate y*30 }