|
|
// Hi Stephen,
//
// for texturing of the individual faces of a polyhedron you don't need
// any alignment, just give each plane of the intersection it's own pigment
// or texture and rotate it together with the plane. In the following
// declaration of a RhombicDodecahedron, replace the texture statements
// by your textures for the faces. For each of these textures, the area
// in the xy-plane with corners
//
// sqrt(.5)*y
// -x x
// -sqrt(.5)*y
//
// is transferred to the face to which this texture belongs.
//
// I've added spheres in the corners; it's easy to calculate midpoints
// and face normals from their coordinates.
//
// Sputnik
//
//
// ----------------------------
// fr### [at] computermuseumfh-kielde
// ----------------------------
// finish, textures =====================================================
#declare Fin = finish { ambient .4 diffuse .6 }
#declare Wood = texture {
pigment { wood scale 0.05 rotate 87*y translate -0.3*z }
finish { Fin }
}
#declare Test = texture {
pigment { image_map { png "test" } // test.png is in include directory
translate <-0.5, -0.5, 0>
scale <2, sqrt(2), 1>
}
finish { Fin }
}
// declaration of rhombic dodecahedron ==================================
#declare RhombicDodecahedron =
intersection {
plane { -z, 0 texture { Wood } translate -z rotate < 0, 45, 45> }
plane { -z, 0 texture { Test } translate -z rotate < 0, 45,-45> }
plane { -z, 0 texture { Test } translate -z rotate < 0,-45, 45> }
plane { -z, 0 texture { Test } translate -z rotate < 0,-45,-45> }
plane { -z, 0 texture { Test } translate -z rotate < 0,225,-45> }
plane { -z, 0 texture { Test } translate -z rotate < 0,225, 45> }
plane { -z, 0 texture { Test } translate -z rotate < 0,135,-45> }
plane { -z, 0 texture { Test } translate -z rotate < 0,135, 45> }
plane { -z, 0 texture { Wood } translate -z rotate < 90, 0, 0> }
plane { -z, 0 texture { Test } translate -z rotate < 90, 0, 90> }
plane { -z, 0 texture { Test } translate -z rotate < 90, 0,180> }
plane { -z, 0 texture { Test } translate -z rotate < 90, 0,-90> }
bounded_by { sphere { 0, 1.42 } }
}//intersection
// declaration of corners of rhombic dodecahedron =======================
#declare S = sqrt(.5);
#declare R = .05;
#declare Corners =
union {
union {
sphere { < 0, 1, S>, R }
sphere { < 0, 1, -S>, R }
sphere { < 0, -1, S>, R }
sphere { < 0, -1, -S>, R }
sphere { < 1, 0, S>, R }
sphere { < 1, 0, -S>, R }
sphere { <-1, 0, S>, R }
sphere { <-1, 0, -S>, R }
texture { pigment { color blue 1 } finish { Fin } }
}
union {
sphere { < 1, 1, 0>, R }
sphere { < 1, -1, 0>, R }
sphere { <-1, 1, 0>, R }
sphere { <-1, -1, 0>, R }
sphere { < 0, 0, 2*S>, R }
sphere { < 0, 0, -2*S>, R }
texture { pigment { color red 1 } finish { Fin } }
}
}
// calculate an midpoint, here normal vector = midpoint vector ==========
#declare Mid = ( <0, 1, -S> + <1, 0, -S> ) / 2; // =<0.5, 0.5, S>
// midpoints: <+/- 0.5, +/- 0.5, +/- S>; x; -x; y; -y
// simple scene with textured rhombic dodecahedron etc. on plane ========
union {
object { RhombicDodecahedron }
object { Corners }
cone { 0, 0.05, -0.8*z, 0
texture { pigment { color green 1 } finish { Fin } }
rotate <0, -45, 45> //or: transform { Reorient_Trans (-x, Mid) }
translate Mid
}
scale 1 rotate 0*y translate <0, 0, 0>
}
plane { y, -1-R
texture {
pigment { checker rgb <1, .9, .8>, rgb <.8, .7, .6> }
finish { Fin }
}
}
light_source { <-1500, 2500, -2000>, color rgb 1 }
camera { location -10*z look_at 0 angle 20
rotate <25, 20, 0> translate <0, 0, 0> }
// END ==================================================================
Post a reply to this message
|
|