0% found this document useful (0 votes)
31 views15 pages

Constructive Solid Geometry

1) Constructive solid geometry (CSG) allows complex 3D models to be built by performing set operations like union, intersection, and difference on simple 3D primitives like cubes, spheres, and cylinders. 2) CSG expressions can be represented as trees where the internal nodes are operations and the leaf nodes are primitives. 3) To render CSG models, ray tracing is used to test ray-primitive intersections and traverse the CSG tree to determine the identity of the hit object based on the operations. Bounding volumes and spatial partitioning are used to accelerate the ray tracing.

Uploaded by

Mohammed Aliraqi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views15 pages

Constructive Solid Geometry

1) Constructive solid geometry (CSG) allows complex 3D models to be built by performing set operations like union, intersection, and difference on simple 3D primitives like cubes, spheres, and cylinders. 2) CSG expressions can be represented as trees where the internal nodes are operations and the leaf nodes are primitives. 3) To render CSG models, ray tracing is used to test ray-primitive intersections and traverse the CSG tree to determine the identity of the hit object based on the operations. Bounding volumes and spatial partitioning are used to accelerate the ray tracing.

Uploaded by

Mohammed Aliraqi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Constructive Solid Geometry

CSG
You can do a lot of things with simple
primitives (e.g., cube, sphere, cylinder, etc.)
 The power is in the operations that can be
performed on them


Computer Graphics

Wireframe Model
The simplest way of representing solids
 Data structures:

A

vertex table
 An edge table
 A face table (optional): faces are not displayed

Fast
 Ambiguity (is a face there or not)


Computer Graphics

Example
1, 2, 3, 4, 5, 6, 7, 8
1

2 a

c
3

b
e

5
i

4
a, b, c, d, e, f, g, h, i, j, k, l
h

g
l

k 8

A, B, C, D, E, F

Computer Graphics

True Solids


A few primitives
 Cube,

sphere, cylinder

A few operations
 Singleton
 Translate,

rotate, scale

 Binary
 Union

(merge), intersection, difference, invert

Computer Graphics

Examples

Computer Graphics

Example

A B

A B

A B B A

Computer Graphics

Example

Difference

Union
Union

Union

T,R,S
T,R,S

T,R,S

T,R,S
T,R,S

T,R,S

Computer Graphics

CSG Expression and CSG Tree


Difference(
Union(
Trans(cylinder),
Trans(cube)
),

Trans(sphere)

)


Each CSG expression has a


tree representation
The construction is not
unique (there can be two trees
that represent the same
results)
Computer Graphics

How to Realize Those Operations?




CSG operations are difficult to represent


mathematically (no closed-form solutions in
general)
However, for rendering (ray tracing), closed-form
solutions are not needed
Union A,D
Intersection C,B
Difference (obj2-obj1) B,D
Difference (obj1-obj2) A,C

Computer Graphics

Procedures


For each ray


 For

each object

 Use

bounding box to avoid intersection test


 If needed, use inside-outside function to determine
whether ray-object intersection occurs
 Traverse the CSG tree bottom-up and apply
operations to find identity of extremal objects

Computer Graphics

Bounding Volume

Slab : aX + bY + cZ + d = 0
X = X o + tX

ray : Y = Yo + tY
Z = Z + tZ
o

A: per ray per slab set

aX + bYo + cZ o + d A + D
t= o
=
aX + bY + cZ
B

D: per slab

B: per ray per slab set

Computer Graphics

Bounding Volume (cont.)




All the maximum (circle) intersections must be after all the minimum
(square) intersections

Computer Graphics

Spatial Partitioning



Ray can be advanced from cell to cell


Only those objects in the cells lying on the path of
the ray need be considered
First intersection terminates the search

Computer Graphics

Packages


A number of them built on top of povray


 http://www.povray.org

With simple VRML like languages to


specify operations and appearance (texture
mapping)

Computer Graphics

You might also like