|
|
There are any number of ways to do this, coding the macro for readability,
flexibility, or compactness of code.
Here are just a few quick examples:
#version 3.7;
global_settings {
assumed_gamma 1.0
}
#include "colors.inc"
sky_sphere {pigment {rgb <1, 1, 1>*0.2}}
camera {
location <50, 90, -80> // position & direction of view
look_at <0, 0, 0>
right x*image_width/image_height // horizontal size of view
up y // vertical size of view
}
light_source {<25, 25, -50> color White}
/*
3.6.2.1.30 Wood Pattern
The wood pattern consists of concentric cylinders centered on the z-axis.
When appropriately colored, the bands look like the growth rings and veins
in real wood. Small amounts of turbulence should be added to make it look
more realistic. By default, wood has no turbulence.
Unlike most patterns, the wood pattern uses the triangle_wave wave type by
default.
This means that like marble, wood uses color map values 0.0 to 1.0 then repeats
the
colors in reverse order from 1.0 to 0.0. However you may use any wave type.
The wood pattern has a default color_map built in that results in a light and
dark brown pattern with sharp transitions.
*/
#declare Size = 10;
#declare Box = box {<1,1,1>*(-Size), <1,1,1>*Size}
#declare WoodZ = texture {pigment{wood}}
#declare WoodY = texture {WoodZ rotate x*90}
#declare WoodX = texture {WoodZ rotate y*90}
#declare Woods = array [3] {WoodX, WoodY, WoodZ}
#for (N, -1, 1)
object {Box texture {Woods[N+1]} translate x*N*Size*3}
#end
#macro Assign_Wood_Texture (Orientation)
#declare A = Orientation*<1, 2, 3>;
#declare Alignment = A.x + A.y + A.z;
#switch (Alignment)
#case (1)
texture {WoodX}
#break
#case (2)
texture {WoodY}
#break
#case (3)
texture {WoodZ}
#break
#else
#debug "Not a valid orientation vector \n\n"
#end // end switch - case/range - break
#end
#macro Assign_Wood_Texture2 (Orientation)
#declare A = Orientation*<1, 2, 3>;
#declare Alignment = A.x + A.y + A.z;
texture {Woods[Alignment-1]}
#end
object {Box Assign_Wood_Texture (x) translate x*(-1)*Size*3 translate z*40}
object {Box Assign_Wood_Texture (y) translate x*( 0)*Size*3 translate z*40}
object {Box Assign_Wood_Texture (z) translate x*( 1)*Size*3 translate z*40}
object {Box Assign_Wood_Texture2 (x) translate x*(-1)*Size*3 translate z*90}
object {Box Assign_Wood_Texture2 (y) translate x*( 0)*Size*3 translate z*90}
object {Box Assign_Wood_Texture2 (z) translate x*( 1)*Size*3 translate z*90}
Post a reply to this message
|
|