Constructive Solid Geometry Ray Tracing CSG Models

24
CSE 681 Constructive Solid Geometry Ray Tracing CSG Models

description

Constructive Solid Geometry Ray Tracing CSG Models. CSG. Form object as booleans of primitive objects Primitives: sphere, cube, cylinder, cone Boolean operators: union, intersection, difference Tree structure used to manage operations Leaf nodes are primitive objects - PowerPoint PPT Presentation

Transcript of Constructive Solid Geometry Ray Tracing CSG Models

Page 1: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Constructive Solid Geometry

Ray Tracing CSG Models

Page 2: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

CSG

• Form object as booleans of primitive objects– Primitives: sphere, cube, cylinder, cone– Boolean operators: union, intersection, difference

• Tree structure used to manage operations– Leaf nodes are primitive objects– Intermediate nodes specify combination operator

Page 3: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Union

Min (tCmin, tB

min )

B

C +

BC

Ray intersects union: at first intersection

Page 4: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Possible ways for 2 spans to overlap

Page 5: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Intersection

++

If ((tCmin< tB

min ) and (tCmax> tB

min ) ): tBmin

Else If ((tBmin< tC

min ) and (tBmax> tC

min ) ): tCmin

Else: none

BC

B

C

First time in B and in C

Page 6: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Difference

-+

BC

If ((tBmin< tC

min ): tBmin

Else if (tCmax< tB

max ): tCmax

Else: none

B

C

First time in B not in C

Page 7: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Difference

+-

BC

If ((tCmin< tB

min): tCmin

Else if (tBmax< tC

max ): tBmax

Else: none

B

C

First time in C not in B

Page 8: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Primitives

Anything that can be intersected (easily) with a ray

Conics: solve analytically using R(t)Convex polyhedraA plane (a cutting plane is useful)

can be used as a modeling tool (boolean operations) surface model (e.g., polyhedron) computed from CGS

or Can be used as a model representation

keep tree structure and ray trace directly

Page 9: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Controlling the Combinations

-+

+

?

Page 10: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Tree Structure

circlerectangle rectangle

+ +

+ -

T1T2 T3

T4

T5- +

+T1

T2

T3

Page 11: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Tree Structure #1

Page 12: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Tree Structure

circlerectangle rectangle

+ +

- +

T1T2 T3

T4

T5- +

+T1

T2

T3

Page 13: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Tree Structure #2

Page 14: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Tree Structure

• Intersect ray with leaf nodes (primitive objects)• Combine intersection spans according to intermediate nodes

• union• intersection• difference

• Might create multiple spans

Page 15: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Union of Spans

Page 16: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Intersection of Spans

Page 17: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Difference of Spans

Page 18: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Normals of CSG intersections

Normal of some surface (or its negation)

Union or intersection: positive normal of intersected surface

Page 19: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Difference normals• Intersection is one of:

• tmin of positive object – normal of surface• tmax of negative object – negated normal

Page 20: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Add transformations to tree

http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/model/csg.html

Page 21: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Bounding Volumes

circlerectangle rectangle

+ +

+ -

T1T2 T3

T4

T5

Construction•Use bounding volumes at leaf nodes• Union bounding volumes at interior nodes

Traversal•Top-down•Test bounding volume at interior

Page 22: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Examples

Page 23: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Examples

Page 24: Constructive Solid Geometry  Ray Tracing CSG Models

CSE 681

Examples