Computer Graphics involves technology to access. The Process transforms and presents information in a visual form. The role of computer graphics insensible.

ErNandiniDharne 11 views 41 slides Jun 27, 2024
Slide 1
Slide 1 of 41
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41

About This Presentation

Computer Graphics involves technology to access. The Process transforms and presents information in a visual form. The role of computer graphics insensible. In today life, computer graphics has now become a common element in user interfaces, T.V. commercial motion pictures.

Computer Graphics is the...


Slide Content

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Chapter 7:
Graphical Primitives

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
This Chapter: we will learn
Types of primitives:
Points, Lines, and Triangles
Attributes of primitives:
Per-primitive and Per-Vertex attributes
E.g., colors, size, style, etc.
Programming with primitives
Abstraction + integration into UWBGL

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Point Primitives
Important because of:
Particles! –approximation
fire, water, explosions
Attributes:
Color, size, and
texture coordinates
Drawing commands:
DrawPoint
DrawPointList
Efficiency! Particles are lots of points

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Line Primitives
Important for:
Hairs, rains, etc.
Types:
One Line Segment
Line Segments or Line Lists
Collection of lines (not connected)
Line Strips or Polylines
Collection of connected lines
Line lists/strips
Efficient to specify large number

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Line: Attributes
Per-Vertex Attributes
Color
Gouraud Shading: linearly change colors from one vertex
to the next
Texture Coordinate
Normal Vector
Important for shading hair/rain
Per-Primitive Attributes
Material properties
Line Style/Width

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Triangle Primitive
Only drawing primitive
with area.
Geometries/objects
in most graphics applications are
approximated with triangles.

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Types of Triangles
Triangle (Lists)
Individual vertices
Triangle Fan
n+2 vertices specify n
connected triangles
Triangle Strip
n+2 vertices specify n
connected triangles

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Triangle: Attributes
Per-Vertex attribute
similar as per-vertex attribute of lines:
Color, normal, texture coordinates
Per-Edge attributes
Similar to per-line attributes:
Width, style, etc.
Per Triangle attribute
Material properties
Fill style: e.g., wire frame

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Color:
Usually expressed as:
(Red, Green, Blue) or (r, g, b)
Usually:
Normalized float: 0.0 ≤ r,g,b ≥1.0
Integer: 0.0 ≤ r,g,b ≥255
255: 8-bit per channel ( )

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
UWBGL_Lib4: Geometries
Common Files/
DrawHelper/
API independent drawing support
Geoms/
Geometries (attributes + drawing)
E.g., color, shadeMode, FillMode, etc.
D3D Files/
D3D_DrawHelper
D3D specific drawing support
D3D_GraphicsSystem/
D3D API support (GHC, RC, and swap chain)
D3D_WindowHandler
D3D View/Controller pair support

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
UWBGL_Lib4: New classes

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
DrawHelper:
Interface for drawing

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
D3DDrawHelper: class + attributes setting

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
D3DDrawHelper: Draw functions

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Geometry class: Point

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Tutorial 7.1: Drawing Geometries

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Tut 7.1: Model Implementation

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Tut 7.1: DrawAndMouseHandler

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Tut 7.1: The Dialog Window

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
UWBGL_Lib5: Primitive Hierarchy

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
UWBGL_Lib5: Primitive Hierarchy

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
UWB_Primitive base class

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
UWB_PrimitivePoint class

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
UWB_PrimitiveLine class

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
UWB_PrimitiveCircle class

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Tutorial 7.2:

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Tut 7.2: DrawAndMouseHandler

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Primitive: Collisions
Attributes of primitive:
Appearance (color) vs. Physical (velocity)
Graphics: mainly concern with
appearance
Learn some physical attributes
Collision: mathematic intersection

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Collision with intersection
With n different primitive types
Need O(n
2
) different intersection routines!
E.g., line, circle, point: needs
Line-Line, Line-Circle, Line-Point, Circle-Circle,
Circle-Point, Point-Point
In general: n+(n-1)+(n-2)
Intersection Math is tedious
Complex Invocation
logic to determine which of the routines to invoke

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Collision with: Bounding volumes
Bounds primitive with
simple volumes
E.g. x/y/z bounds
E.g., circle/spheres
Collide with the
bounding volumes
instead!

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Bounding Volume considerations
Simplicity in math
circle/sphere and axes aligned bounding boxes
Tightness in bound
Void space
Approximation
False collision and
Failed detection
Colliding position
On bounding circle is different from on object

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
UWBGL_Lib6: Bounding Volume
Intersects() collide two volumes
Returns True/False (no colliding position)
Add()
Inserts and expends the volume

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
UWBGL_Lib6: BoundingBox Class

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
UWB_BoundingBox

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Primitive: CollisionResponse
Primitive class:
has a bounding volume
CollisionResponse(): collision detected
other_location –location of other primitive
Change primitive behavior accordingly
Knows how to draw bounding volume

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Using BoundingVolume
Three steps:
1. Get the volume from each primitives
2. Collide the volumes
3. If volumes collide
Each primitive must response: CollisionResponse()

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Default collision response …
Change velocity to repulse away
Looks like bouncing away
Very rough approximation of
elastic collision

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Tutorial 7.3: Collision

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Lib7: Collection of Primitives
PrimitiveList class Subclass of Primitive
Behave just like a primitive

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Lib7: PrimitiveList Class

Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Chapter 7
Tutorial 7.4: Many primitives
Tags