Game Development Reference
In-Depth Information
union
cylinder
difference
box
union
cylinder
cylinder
Figure 14.8 Example of CSG tree
cylinder {
<0,-4,0>
<0,4,0>
0.2
pigment { Yellow }
}
difference {
box {
<-1.5,-0.5,-0.5>
<1.5,0.5,0.>
}
cylinder {
<-0.8,0,-3>
<-0.8,0,3>
0.1
}
cylinder {
<0.8,0,-3>
<0.8,0,3>
0.1
}
pigment { Red }
}
The image shown in figure 14.9 can be obtained by adding a camera and a light
source to it.
In computer terms, the representation of a CSG tree is a simple tree structure where
the leaves are geometric primitives and the nodes are Boolean operators. Some pro-
cessing algorithms are extremely simple to implement, while others are not provided
for by the structure (for example, in general, it is impossible to calculate the vol-
ume). The fundamental problem inherent to CSG representation is that of the visual
Search Nedrilad ::




Custom Search