|
|
Hey guys,
As I've said in other posts, math is not my strong point. As such, the
concept of marcos gives me headaches. :{P
But, I'm willing to learn. Most examples I've seen don't seem to be
simple enough for me to grasp how I could put them to good use. So, when
I was working on my first attempt at creating a bush on my own, I
thought, "This may be a good way to get suggestions on using macros to
make things easier."
Can anyone take a peek at the following code and give me any suggestions
as to how/if macros might help make things run more smoothly/compactly?
BTW, I've posted an image of the bush on p.b.i.
//=============================================
global_settings {assumed_gamma 2.2}
global_settings { max_trace_level 20}
#include "colors.inc"
#declare Cm5=
camera {
location <30, 25, -45>
direction <0, 0, 1>
up <0, 1, 0>
right <4/3, 0, 0>
look_at <0, 5, 10>
}
camera {Cm5}
light_source { <35, 30, -40> color rgb <0.9,0.3,0.3>
area_light <32, 27, -37>, <38, 33, -43>, 2, 2
fade_distance 75
fade_power 30
}
light_source { <32, 33, -40> color rgb <0.3,0.9,0.3>
area_light <29, 30, -37>, <35, 36, -43>, 2, 2
fade_distance 75
fade_power 30
}
light_source { <38, 33, -40> color rgb <0.3,0.3,0.9>
area_light <35, 30, -37>, <41, 36, -43>, 2, 2
fade_distance 75
fade_power 30
}
#declare Rot1=0;
#declare Ytran1=0;
#declare Scaler1=1;
#declare R1=seed(8732);
#declare BR1=
blob {
threshold 0.65
#while (Rot1 <=720)
cylinder {<-0.5,0,0>,<0.5,0,0>,1,1
translate rand(R1)*0.5
scale Scaler1
translate -0.5*z
translate Ytran1*y
rotate Rot1*y
}
#declare Rot1=Rot1+10;
#declare Ytran1=Ytran1+0.3;
#declare Scaler1=Scaler1-(1/100);
#end
pigment {rgb<0.8,0.6,0.2>}
finish {specular 0.4 roughness 0.007}
}
#declare BR2=
union {
blob {
threshold 0.65
#declare Rot1=0;
#declare Ytran1=0;
#declare Scaler1=1;
#declare R1=seed(8732);
#declare Counter1=1;
#declare Ytran2=2;
#while (Rot1 <=720)
cylinder {<-0.5,0,0>,<0.5,0,0>,1,1
translate rand(R1)*0.5
scale Scaler1
translate -0.5*z
translate Ytran1*y
rotate Rot1*y
}
#declare Rot1=Rot1+10;
#declare Ytran1=Ytran1+0.3;
#declare Scaler1=Scaler1-(1/100);
#end
pigment {rgb<0.8,0.6,0.2>}
finish {specular 0.4 roughness 0.007}
}
#declare Rot1=0;
#declare Rot2=0;
#declare Ytran1=3;
#declare Scaler1=1;
#declare R1=seed(8732);
#while (Rot1 <=720)
triangle {<1,0.6,0>,<1,-0.6,0>,<3,0,0>
pigment {green 1}
rotate Rot2*x
translate rand(R1)*0.5
scale Scaler1
translate -0.5*z
translate Ytran1*y
rotate Rot1*y
}
triangle {<1,0.6,0>,<1,-0.6,0>,<3,0,0>
pigment {green 1}
rotate Rot2*x
translate rand(R1)*0.5
scale Scaler1
translate -0.5*z
translate Ytran1*y
rotate -Rot1*y
}
#declare Rot1=Rot1+30;
#declare Rot2=Rot2+30;
#declare Ytran1=Ytran1+0.65;
#declare Scaler1=Scaler1-(1/100);
#end
}
#declare Counter1=1;
#declare Ytran2=5;
#declare Scaler2=0.75;
#declare Rotater1=55;
#declare Rotater2=0;
#declare BR3=
union {
object {BR1 rotate 90*y}
#while (Counter1 <= 4)
object {BR2 scale Scaler2 rotate Rotater1*x translate Ytran2*y rotate
(45+Rotater2)*y}
object {BR2 scale Scaler2 rotate Rotater1*x translate Ytran2*y rotate
(165+Rotater2)*y}
object {BR2 scale Scaler2 rotate Rotater1*x translate Ytran2*y rotate
(275+Rotater2)*y}
#declare Counter1=Counter1+1;
#declare Ytran2=Ytran2+4;
#declare Scaler2=Scaler2-0.2;
#declare Rotater1=Rotater1-7;
#declare Rotater2=Rotater2-15;
#end
}
#declare Counter1=1;
#declare Ytran2=5;
#declare Scaler2=0.75;
#declare Rotater1=55;
#declare Rotater2=0;
#declare BR4=
union {
object {BR1 rotate 90*y}
#while (Counter1 <= 4)
object {BR3 scale Scaler2 rotate Rotater1*x translate Ytran2*y rotate
(45+Rotater2)*y}
object {BR3 scale Scaler2 rotate Rotater1*x translate Ytran2*y rotate
(165+Rotater2)*y}
object {BR3 scale Scaler2 rotate Rotater1*x translate Ytran2*y rotate
(275+Rotater2)*y}
#declare Counter1=Counter1+1;
#declare Ytran2=Ytran2+4;
#declare Scaler2=Scaler2-0.2;
#declare Rotater1=Rotater1-7;
#declare Rotater2=Rotater2-15;
#end
}
// bush
object {BR4 scale 1.5}
// floor
plane {y,0
pigment {
marble
color_map {
[0.00 rgb<0.8,0.76,0.6>]
[0.35 rgb<0.8,0.76,0.6>]
[0.50 rgb<0.45,0.45,0.45>]
[0.65 rgb<0.8,0.76,0.6>]
[1.00 rgb<0.8,0.76,0.6>]
}
scale 15
}
}
// mirrored backdrop
cylinder {<0,-10,0>,<0,500,0>,60
clipped_by {box{<-80,-20,80>,<80,600,0>}}
scale <2,1,1>
texture {
pigment {rgb 0}
finish {specular 0.3 roughness 0.003 reflection 0.995}
}
}
// floor molding at edge of backdrop
torus {60,5
clipped_by {box{<-80,-20,80>,<80,600,0>}}
scale <2,1,1>
texture {
pigment {rgb<0.8,0.49,0.19>}
normal {granite 0.3 turbulence 0.7 scale 10}
finish {specular 0.8 roughness 0.003 brilliance 32 ambient 0.2 diffuse
0.9 reflection 0.8}
}
}
// black cylinder behind camera
cylinder {<0,-10,0>,<0,500,0>,60
clipped_by {box{<-80,-20,-80>,<80,600,0>}}
scale <2,1,1>
pigment {rgb 0}
}
//=========================================
Post a reply to this message
|
|