|
|
Hello i am a high school student and i am fairly new to pov-ray. I was given an
assignment to create an office and i would like to get your opnion on it and
what improvements can be made. the following code is the code for my work in
progress.
camera { location <0,20,-32> look_at <0,5,-5>}
light_source {<10,25, -25> color rgb <1,1,1>}
#include "colors.inc"
# include "textures.inc."
# include "woods.inc"
# declare table=
union {
box { <-5,0,0> <5,.5,8>
translate <2.5,0,0>
texture {Glass}}
box {<-5,0,0> <-4.1,-4,1>
translate <2.5,0,0>
texture {pigment{ color White}}}
box {<5,0,0> <4.1,-4,1>
translate <2.5,0,0>
texture {pigment { color White}}}
box {<-5,0,5> <-4.1,-5,6>
translate <2.5,0,0>
texture {pigment{ color White}}}
box {<5,0,5> <4.1,-5,6>
translate <2.5,0,0>
texture {pigment { color White}}}
}
object {table
translate <11,0,-6>}
plane { <0,1,0>,-5
texture {T_Wood14}}
object {table
translate <-15,0,-6>}
object {table
translate <20,0,10> }
object {table
translate <-23,0,10>}
plane { <0,0,1>,45 texture {pigment{color Black}}}
plane {<1,0,0>,-32 texture {Green_Glass} }
plane {<1,0,0>30 texture {Green_Glass} }
//background {color Turquoise}
//camera { location <0,15,-29> look_at <0,5,-5>}
light_source {<10,25, -18> color rgb <1,1,1>}
#include "colors.inc"
# include "textures.inc."
# include "woods.inc"
#declare desk=
union {
box {<5,0,0> <-15.2,-7,1>
translate <11.6,0,0>
texture {pigment { color White}}}
box { <-5,0,0> <18,.5,8>
translate <0,0,1>
texture {Glass}} }
object {desk
translate <-3,0,25>}
//camera { location <0,15,-29> look_at <0,5,-5>}
light_source {<10,25, -18> color rgb <1,1,1>}
#include "colors.inc"
# include "textures.inc."
# include "woods.inc"
box {<-3,0,0><0,.5,2>
translate <-10,1,-2>
texture{pigment{color Red}}}
#declare vase=
lathe{ cubic_spline 13,<0,0><.75,0><.75,.2><.3,.6><.4,.8><.5,1><.7,1.3>
<.8,1.4><1,1.5><.8,1.8><.6,2><.5,2.2><3,2.7>
texture {pigment{color Violet}}}
object {vase
translate <2,1,8.5>
scale<2,2,3>}
declare chair=
union{
box { <-3,1.8,0>, <-2,2,1>
texture {pigment { color rgb <1,1,1>}}}
box {<-3,1,0>, <-2.9,1,1>
translate <0,-1,0>
texture {pigment {color rgb <1,1,1>}}}
box {<-3.1,-1.5,0>, <-2.9,5,.2>
texture {pigment {color rgb <1,1,1>}}}
box {<-2,-1.5,0>, <-2.2,2,.2>
texture {pigment {color rgb <1,1,1>}}}
box {<-3,0,0>, <-2.9,5,1>
texture {pigment {color rgb <1,1,1>}}}
box {<-3.1,-1.5,1>, <-2.9,5,1>
texture {pigment {color rgb <1,1,1>}}}
box {<-2,-1.5,1>, <-2.2,2,1>
texture {pigment{color rgb <1,1,1>}}}
}
object {chair
scale <2.5,.8,2>
translate <-11,0,-9.8>}
object {chair scale <2.5,.8,2>
translate <19,0,6>
}
object{chair
scale <3,.8,2>
translate <13,0,0>
rotate y*45}
object{chair scale <3,.8,2>
translate <8,0,-21>
rotate y*135 }
merge{
object {chair scale <3,.8,3>
rotate y*90
translate <0,0,25>
texture {pigment{color Black}}} object {desk translate <-3,0,25>}}
//the merge didn't seem to work :-(
//Thank You
Post a reply to this message
|
|
|
|
"babybri11g" <bab### [at] gmailcom> wrote:
> Hello i am a high school student and i am fairly new to pov-ray. I was given an
> assignment to create an office and i would like to get your opnion on it and
> what improvements can be made. the following code is the code for my work in
> progress.
>
..
..
..
> //Thank You
It looks like things are off to a good start. Some good points were made above
already, most of what I have to add are a few recommendations for code
organization.
Consider putting certain similar code blocks together. For instance, all of
your object definitions could be put together, and all of your light_sources
could be put together. Objects that are near each other within the scene may
be placed next to each other in code, or they may be grouped with similar
objects. Whichever way you choose, I recommend that you use whitespace,
comments, and indentation liberally.
For example:
object // chair on right in foreground
{
chair
scale <3,.8,2>
translate <13,0,0>
rotate y*45
}
object // chair on left in background
{
chair
scale <3,.8,2>
translate <8,0,-21>
rotate y*135
}
is easier to read than
object{chair
scale <3,.8,2>
translate <13,0,0>
rotate y*45}
object{chair scale <3,.8,2>
translate <8,0,-21>
rotate y*135 }
When going through your code, I also wondered whether or not your translate and
rotate statements were working as you expected. If not, you should be aware
that the order in which transformations are applied is very important.
object{
chair
scale <2,1,2>
rotate <45,0,0>
translate <2,0,0>
}
is very different from
object{
chair
translate <2,0,0>
scale <2,1,2>
rotate <45,0,0>
}
which is still different from
object{
chair
rotate <45,0,0>
translate <2,0,0>
scale <2,1,2>
}
Your transformations are applied in consistent order, but in such a way that
makes the object placement a bit hard to follow. I personally find it easier
to visualize scaling, rotating, then translating, because I think of it as
selecting the appropriate size, orientations, then placing the object into its
location.
HTH,
-Reactor
Post a reply to this message
|
|