3D Computer Fundamentals Part 1 - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

3D Computer Fundamentals Part 1

Description:

Transformations in a matrix form, Projection. Fixed point ... 'staircase effect' of jagged lines and edges when using straightforward rasterization algorithms ... – PowerPoint PPT presentation

Number of Views:46
Avg rating:3.0/5.0
Slides: 33
Provided by: milanra5
Category:

less

Transcript and Presenter's Notes

Title: 3D Computer Fundamentals Part 1


1
3-D Computer Fundamentals- Part 1 -
  • Supervisor
  • Naoufel Boulila

2
What are we going to talk about?
  • 3-D Transformations
  • Translation, Scaling, Rotation
  • Transformations in a matrix form, Projection
  • Fixed point arithmetic
  • Rasterization of 2-D primitives
  • Points, Line segments, Polygons
  • Textured polygons
  • Anti-aliasing
  • 2-D and 3-D Clipping
  • 2-D Clipping strategies
  • 3-D Clipping strategies

3
Basics
  • Euclidean spaces
  • Operations on vectors

4
Translation
  • Moving the points of an object
  • Moving the coordinate system (opposite direction)
  • Moving (translating a set of points in 2D 3D)
  • In 2D along X und Y axes
  • In 3D along X, Y und Z axes

5
Scaling
  • Expansion or contraction
  • of an object
  • Optional Scaling of the space itself
  • 0 lt factor lt 1 ? Contraction
  • factor gt 1 ? Expansion

6
Rotation
  • Rotation in 2D using
  • sin cos functions
  • Optional Rotating space
  • 3D Rotation with the help of 2D Rotations.
  • Important
  • Reference system?
  • Positive directions?
  • Sequence of rotations?

7
Coordinate systems
  • Right- and left-handed notation
  • We are using the left-handed notation coordinate
    system (see picture)
  • a angle roll
  • ß angle pitch
  • ? angle yaw

8
3D Rotation
x' z sin() x cos() x'' x
x''' y'' sin() x''
cos() y' y y''
y' cos() z' sin() y''' y''
cos() x'' sin() z' z cos() x sin()
z'' y' sin() z' cos()
z''' z''
  • x''' xmx1 ymy1 zmz1
  • y''' xmx2 ymy2 zmz2
  • z''' xmx3 ymy3 zmz3

9
Matrix form
  • Representing the transformation coefficients in a
    matrix form
  • Scaling and Rotating with 3x3 matrix (we use also
    4x4 matrices to assimilate with translating)
  • Translating with 4x4 matrix
  • Example 3D Rotation matrix

10
Projection transformations
  • How can we map the 3D space onto a 2D screen?
  • Parallel projection
    Perspective projection

Viewing
direction.
11
Parallel projection
  • All the points belonging to parallel lines in 3D
    space would come together in one point in 2D
    plane
  • Angle between projection lines and projection
    plane
  • 90 than is orthographic projection
  • Otherwise oblique projection
  • When camera position is not parallel to XY plane
    than we do first affine transformation and after
    that we use the parallel projection

12
Perspective projection
  • Similar triangles
  • Problem with the z coordinate
  • If zz then can come to distortions
  • Solution is z-C/z where C is some constant
  • If z0 than we get error because we divide by
    zero
  • If z negative we get points (pixels) that are
    behind the viewer

13
Fixed point arithmetic
  • sin cos functions with real values
  • Instead expensive floating-point operations we
    use fixed-point arithmetic

14
Rasterization
  • Raster graphics
  • Image on the screen composed from a mosaic of
    pixels
  • Rasterizing points
  • Rasterizing line segments
  • Rasterizing polygons
  • Convex polygons
  • Concave polygons

15
Rasterizing points
  • Each pixel is represented by one unit of memory
    (byte or word)
  • Address of pixel (x,y) ysizex x with sizex
    and sizey as a dimensions of the picture
  • Problem
  • Point with a real coordinates
  • Rounding to the nearest integer

16
Rasterizing line segments
  • Finding all pixels intersected by a given line
    (Xstart ,Ystart) and (X end ,Y end)
  • ?X gt ?Y ?
  • ?Y gt ?X ?
  • Performance?
  • Alternatives?
  • Forward differences J.E.Bresenham Method

17
Rasterizing polygons
  • Different types of polygons convex, concave
  • Rasterization method scan-line
  • Concave (left) convex (right)
    polygon with pixel line

18
Rasterizing convex polygons
  • Finding and rasterizing horizontal pixel-lines
  • We are using arrays to store the polygons pixel
    lines
  • Edge scanning process (just like rasterization of
    a line segment)

Start
End
1
5
2
8
2
7
3
7
4
6
19
Rasterizing concave polygons
  • Splitting into convex polygons
  • Problem
  • Finding intersections of scan-line and edges is
    expensive
  • Solution
  • Rasterizing with pre-sorted list and active edge
    list

20
Rendering shaded polygons
  • Technique
  • include lighting during rasterization
  • apply a material texture onto the polygon
  • Shading
  • We integrate rasterization by interpolating light
    values for every vertex at the time of pixel line
    computations
  • Ix color intensity value (see pic.)

21
Rendering textured polygons
  • Texturing a texture associates color value to
    two parameters (u,v) of polygons area
  • procedural textures
  • store a texture as a bitmap
  • Combining interpolation technique for calculating
    color intensity and texturing a polygons area

22
Texturing perspective projection
Screen space
Texture space
  • Problem
  • The effect of perspective destortion in linear
    texture mapping
  • Solution
  • Subdivision of the polygon before per.pr.
  • Approximation instead of real texture mapping

A
B
A
B
C
D
C
D
23
Anti-aliasing
  • Problem
  • staircase effect of jagged lines and edges when
    using straightforward rasterization algorithms
  • Solution
  • The techniques
  • using filtering on
  • the rendered
  • image and making
  • it smoother

24
Clipping
  • Restriction of the coordinates of primitives to
    the boundaries of the screen
  • Problem
  • Point with z0 cannot be transformed into the
    screen
  • Objects whith negative z are behind the viewer,
    and, thus, invisible
  • Two sort of clippings
  • 2D screen boundaries clipping
  • 3D volume clipping

25
2D Clipping strategies
  • Three different approaches to 2D Clipping
  • Clipping before the rasterization phase (for
    polygons) - Preclipping
  • Clipping during the rasterization phase (for
    complex primitives)
  • Clipping after the rasterization phase -
    Postclipping

26
Clipping points line segments
  • Points
  • we are checking if the point coordinates
  • are within the clipping area
  • Line segments divide conquer
  • We are finding the part of the line segment
  • by clipping against some boundary and
  • proceeding to other boundaries whith the
  • sub-problem (usefully for any clipping area)

27
Clipping line segments
  • Can we speed up the proces?
  • Region outcodes trivial
  • acceptance or rejection
  • Both endpoints are outside the
  • clipp. area ? the line segment
  • is rejected (acceptance analog)
  • Bitwise and and or to decide
  • whether the line segment would
  • be accepted, rejected or taken
  • through the clipping process

28
Clipping line segments
  • Finding intersections with
  • or
  • binary search

29
Clipping polygons
  • Problem
  • Polygon can change its shape as a
  • result of clipping
  • Clipping divide conquer
  • - at each iteration we
    obtain a progressively smaller
    problem

30
Clipping polygons
  • Proceeding
  • We are considering pol. edges in order of
    appearance and use clipping (for AB and CD edges,
    picture below) ABCD ? AI1I2D
  • The same proceeding for concave polygons

31
3D Clipping strategies
  • Two kind of points
  • Projected inside the screen, belonging to the
    view volume
  • Projected outside the screen (overflow problem)
  • Parallel projection
  • 2D boundaries clipping
  • Perspective projection
  • Volume clipping
  • No effects for far objects
  • Bounding box and sphere

32
Conclusion
  • Transformation
  • Used to describe location, orientation and motion
    of virtual objects and their visibility to the
    viewer
  • Rasterization
  • Used to picture geometric primitives in raster
    display device. More complex objects are usually
    presented as a collection of simpler primitives
  • Clipping
  • Used to discard the objects in the world space
    which cant be rasterized or transformed with the
    perspective projection. It insures consistency of
    these two algorithms.
Write a Comment
User Comments (0)
About PowerShow.com