Title: Proseminar Web3D 3D Computer Fundamentals Part I
1Proseminar Web3D3-D Computer
Fundamentals (Part I)
Naoufel Boulila
TUM 2002
2Content
- 2-D/3-D Transformations
- Rasterization of 2-D Primitives
- 2-D/3-D Clipping
32-D/3-D Transformations
- What is a transformation?
- What kind of transformations are there?
- How can I compute them?
4Rasterization of 2-D Primitives
- What is rasterization?
- What are the difficulties?
52-D/3-D Clipping
- Clipping sounds simple
- But usually it isnt
- Problems with convexe polygons
- 3-D clipping
6Transformations
- 2-D Translation
- Scaling
- Rotation
- 3-D Basics
- 3-D Rotation
- Characteristics of the 3-D Space
- Optimizations
- Projection Transformation
- Perspective Projection
- Fixed Point Arithmetics
2-D/3-D Transformations
7Translation in 2-D
Figure Translation of a set of points,
translation of space.
Point-Vector /- Translation-Vector new
Point-Vector
2-D/3-D Transformations
82-D Scaling
Figure Scaling transformation.
- Computation
- Scalar Vector Vector
2-D/3-D Transformations
9Rotation in the Plane
With 2-D Rotation Matrix Rotation-Matrix
Point-Vector Point-Vector
Figure 2.8 Rotating the coordinate system.
2-D/3-D Transformations
103-D Basics
- Spaces and Angles
- Roll (alpha, Z-axis), pitch (beta, X) and yaw
(gamma, Y)
Figure 3-D Coordinates
2-D/3-D Transformations
113-D Rotations
- Mathematical representation by a special kind of
3-by-3 matrix - A point (array or vector) is multiplied by a
rotation matrix in order to get the new
coordinates - Multiplication of matrixes equals combined
rotations - Associative but not commutative
2-D/3-D Transformations
12Characteristics of the 3-D Space
- Different mathematical representation
- Representation of translation with addition of a
vector - Scaling by multiplying scalar
- Rotate with multiplication of matrixes
- What we want uniform behaviour of all those
transformations - Problem 3 by 3 matrix not possible, because
translation requires affine, not linear
transformation - Solution 4 by 4 matrix
2-D/3-D Transformations
13Optimizations
- Sums instead of multiplications
- Frequent computation of sin, cos
- Matrix elements contain lots of trig. Functions
- Taylor Power Series, first two summands
- Precomputation of values
- Iterative algorithms
2-D/3-D Transformations
14Projection Transformation
- Mapping 3-D coordinates into 2-D screen
- Parallel projection
Figure Parallel projection.
2-D/3-D Transformations
15Perspective Projection
- Perspective Projection
- - xxfocus/z
Figure Perspective projection.
Figure Geometry of perspective projection.
- Problems
- Singularity at z0
- Division is costly
- Visibility changes after perspective
transformation
2-D/3-D Transformations
16Fixed Point Arithmetics
- Good fast additions and subtractions esp. when
no floating point unit - Bad overflow more likely
2-D/3-D Transformations
17Rasterization
- Rasterizing Points
- Rasterizing Line Segments
- Rasterizing Polygons
- Rendering Interpolatively Shaded Polygons
- Rendering Textured Polygons
- Anti-Aliasing
Rasterization of 2-D Primitives
18Rasterizing Points
- Points and pixels
- Discrete nature of pixels
- Address of pixel (x,y) is ysize(X)x
Figure Image bitmap layout.
Rasterization of 2-D Primitives
19Rasterizing Line Segments
- Finding points on a line
- Computation of the y-coordinate for every
discrete x-value - Problems
- - Which pixel(s) should be drawn
- - Degeneration of vertical lines
- - Computing every pixel necessary?
- Iterative computing of lines
Figure 3.3 Calculating Y function of X verses X
function of Y for some line.
Rasterization of 2-D Primitives
20Rasterizing Polygons
- Different kinds of polygons
- Simple, convex, concave, semi-simple
- Scanlines
Figure Concave and convex polygons.
Rasterization of 2-D Primitives
21Rasterizing convex Polygons
- One scanline
- Horizontal lines
Figure Array to store polygons pixel lines.
Rasterization of 2-D Primitives
22Rasterizing concave Polygons
- Division in convex polygons
- Disadvantage two many objects, lines are doubled
- Special algorithms for concave P.
- Ordered, active/passive edges
Figure Steps in finding convex polygons pixel
lines.
Rasterization of 2-D Primitives
23Rendering Interpolatively Shaded Polygons
- Pixels with additional values
- Linear interpolation
Figure Interpolatively shaded polygons.
Figure 3.14 Interpolating color intensities.
Rasterization of 2-D Primitives
24Rendering Textured Polygons
- Warping when using linear mapping
- In case of shading normally its not noticed
- Solution Scanline subdivision, approximations
Figure Linear texture mapping. Note unnatural
warping.
Figure Linear texture mapping for a
perspectively projected polygon.
Figure Perspective texture mapping.
Figure Scanline subdivision and linear
approximation.
Rasterization of 2-D Primitives
25Anti-Aliasing
- Discrete nature of pixels and frames causes
undesirable effects - Stairs in lines, patterns in surfaces, optical
illusions in videos
Figure Filtering.
Rasterization of 2-D Primitives
26Clipping
- 2-D Clipping Strategies
- Clipping Points
- Clipping Line Segments
- Clipping Polygons
- 3-D Clipping Strategies
2-D/3-D Clipping
272-D Clipping Strategies
- Preclipping for simple primitives and rectangle
clip. area - Clipping during Rasterization for more complex
primitives - Postclipping for complex clipping areas
Figure Different types of clipping.
2-D/3-D Clipping
28Clipping Points
- Easy for rectangle clipping area
- - check if point is in the x- and y-range
- For others clipping areas
- - go through with scanline
- - check range(s)
2-D/3-D Clipping
29Clipping Line Segments
- Trivial rejection, based on region outcodes
- In case of acceptance clipping of he line against
an edge - Intersection computed by binary search
Figure Outcodes.
Figure Clipping a segment against a vertical
edge.
2-D/3-D Clipping
30Clipping Polygons
- Clip polygons iteratively against all edges
- Determine intersection points, new vertices, new
edges - Problem convex polygons
- - More than one part possible
- - How to treat them
Figure 4.8 Iterating polygons edges against a
single clipping edge.
Figure A scan-line coinciding with the
horizontal edge.
2-D/3-D Clipping
313-D Clipping Strategies
- Clipping in case of parallel projection
- - Rectangular clipping areas
- Perspective clipping very complex and time
consuming - Singularities/overflow for near objects
- Limited number of primitives
- No 3-D effects for far objects
- Simplify the clipped volume perspective angles
of 90 - Bounding boxes for detaild objects
Figure Bounding box and sphere for an object of
complex geometry.
2-D/3-D Clipping
32Summary
- Transformation techniques allow to describe
location, orientation and motion of virtual
objects and also their visibility to the viewer - The rasterization routines are used to picture
geometric primitives. Shading and texture mapping
can be added to improve visual realism - Clipping discards the objects in the world space
which would not contribute to the generation of
the image
2-D/3-D Clipping
33Thats it
- Thank you for listening
- Questions please