1 of 62

Nima Kalantari

CSCE 441 - Computer Graphics

​

Rendering Overview

Some slides from Ren Ng and Ravi Ramamoorthi

2 of 62

3D Graphics Pipeline

Modeling

Animation

Rendering

Image from

Levoy et al. 2000

Image from

Liu and Popovic 2002

3 of 62

3D Graphics Pipeline

Modeling

Animation

Rendering

Image from

Levoy et al. 2000

Image from

Liu and Popovic 2002

4 of 62

Outline

  • Image formation
  • Rendering
  • Rasterization pipeline

5 of 62

Image Formation

6 of 62

Capturing the World

7 of 62

Pinhole camera

  • Add a barrier to block off most of the rays
    • The opening known as the aperture
    • How does this transform the image?

8 of 62

Pinhole camera

From Photography, London et al.

9 of 62

Camera model

Camera

Image Plane

Lens

10 of 62

Camera model

Camera

Image Plane

Pinhole

Center of Projection (COP)

11 of 62

Camera model

Camera

Image Plane

Pinhole

Center of Projection (COP)

12 of 62

Camera model

Camera

Image Plane

COP

13 of 62

Digital Image

14 of 62

Camera model

Camera

Image Plane

COP

15 of 62

Outline

  • Image formation
  • Rendering
  • Rasterization pipeline

16 of 62

17 of 62

Rendering

Model from Pradeep Sen

Geometry

18 of 62

Shape Primitives

  • Example shape primitives (OpenGL)

3dgep.com

19 of 62

Polygon Meshes

Life of Pi (2012)

20 of 62

Triangle Meshes

21 of 62

Triangles - Fundamental Area Primitive

  • Why triangles?
    • Most basic polygon
      • Break up other polygons
      • Optimize one implementation
    • Triangles have unique properties
      • Guaranteed to be planar
      • Well-defined interior
      • Well-defined method for interpolating values at vertices over triangle (barycentric interpolation)

​

22 of 62

Rendering

Model from Pradeep Sen

Geometry

23 of 62

Rendering

Geometry

Light Source(s)

Camera

Model from Pradeep Sen

24 of 62

Rendering

Geometry

Camera

COP

Goal: compute the color of each pixel

Light Source(s)

Model from Pradeep Sen

25 of 62

Rendering

Geometry

Camera

COP

Goal: compute the color of each pixel

Light Source(s)

Model from Pradeep Sen

26 of 62

Rendering

  • Two general ways
    • Rasterization
    • Ray tracing

Geometry

Camera

COP

Model from Pradeep Sen

27 of 62

Rasterization

Geometry

Camera

COP

Model from Pradeep Sen

28 of 62

Ray Tracing

COP

Geometry

Camera

Model from Pradeep Sen

29 of 62

Rendering

  • Two general ways
    • Rasterization (real-time)
    • Ray tracing (offline*)

Geometry

Camera

COP

Model from Pradeep Sen

30 of 62

Outline

  • Image formation
  • Rendering
  • Rasterization pipeline

31 of 62

Rasterization Pipeline

Vertex Processing

Triangle Processing

Rasterization

Fragment Processing

Framebuffer Operations

Display

Application

1

2

3

4

Input: vertices in 3D space

Vertex Stream

Vertices positioned in screen space

Triangle Stream

Triangles positioned in screen space

Fragment Stream

Fragments (one per covered sample)

Shaded Fragments

Shaded fragments

Output: image (pixels)

32 of 62

Application

  • Performs all the operations that are not directly related to rendering
    • Handles the input
    • Applies changes to the scene
    • Controls AI (in games for example)

33 of 62

Example

NBA 2K21 – from IGN - Gaming YouTube channel

34 of 62

Rasterization Pipeline

Vertex Processing

Triangle Processing

Rasterization

Fragment Processing

Framebuffer Operations

Shaded Fragments

Fragment Stream

Triangle Stream

Vertex Stream

Display

Application

z

x

y

Modeling & viewing transforms

35 of 62

Transformation

  • Model (from model to world)
  • View (from world to camera)
  • Projection (from camera to image)

36 of 62

37 of 62

Digital Scene

Geometry

Model from Pradeep Sen

38 of 62

Local Coordinate

y

x

z

39 of 62

World Coordinate

40 of 62

Model Transformation

41 of 62

Model Transformation

42 of 62

Model Transformation

  • Each object has an individual model transformation

43 of 62

Transformation

  • Model (from model to world)
  • View (from world to camera)
  • Projection (from camera to image)

44 of 62

View Transformation

  • Represent the object in camera coordinate

Model from Pradeep Sen

Camera

World Coordinate

Camera Coordinate

45 of 62

Transformation

  • Model (from model to world)
  • View (from world to camera)
  • Projection (from camera to image)

46 of 62

Projection

  • Project the object from 3D to 2D image plane

Model from Pradeep Sen

Camera

Image Plane

3D

2D

47 of 62

Transformation

  • Model (from model to world)
  • View (from world to camera)
  • Projection (from camera to image)

3D in Local Coordinate

2D

48 of 62

Transformation

(7.1, 0.6)

(1.4, 9.5)

(9.8, 7.6)

49 of 62

Rasterization Pipeline

Vertex Processing

Triangle Processing

Rasterization

Fragment Processing

Framebuffer Operations

Shaded Fragments

Fragment Stream

Triangle Stream

Vertex Stream

Display

Application

z

x

y

Modeling & viewing transforms

50 of 62

Rasterization Pipeline

Vertex Processing

Triangle Processing

Rasterization

Fragment Processing

Framebuffer Operations

Shaded Fragments

Fragment Stream

Triangle Stream

Vertex Stream

Display

Application

Connecting points to form triangles

51 of 62

Triangle processing

(7.1, 0.6)

(1.4, 9.5)

(9.8, 7.6)

52 of 62

Rasterization Pipeline

Vertex Processing

Triangle Processing

Rasterization

Fragment Processing

Framebuffer Operations

Shaded Fragments

Fragment Stream

Triangle Stream

Vertex Stream

Display

Application

Sampling triangle coverage

output -> fragments

53 of 62

Fragments

  • A pixel can have more than one fragments
  • Contain more information than pixels (depth, color, texture coordinates, etc.)

54 of 62

Rasterization Pipeline

Triangle Processing

Rasterization

Fragment Processing

Framebuffer Operations

Shaded Fragments

Fragment Stream

Triangle Stream

Vertex Stream

Display

Application

+ Specular

Phong Reflection

=

Ambient

Diffuse

+

Evaluating shading functions

Vertex Processing

55 of 62

Rasterization Pipeline

Triangle Processing

Rasterization

Fragment Processing

Framebuffer Operations

Shaded Fragments

Fragment Stream

Triangle Stream

Vertex Stream

Display

Application

Texture mapping

Vertex Processing

56 of 62

Rasterization Pipeline

Vertex Processing

Triangle Processing

Rasterization

Fragment Processing

Framebuffer Operations

Shaded Fragments

Fragment Stream

Triangle Stream

Vertex Stream

Display

Application

Z-Buffer Visibility Tests

57 of 62

Rasterization Pipeline

Monitor

Vertex Processing

Triangle Processing

Rasterization

Fragment Processing

Framebuffer Operations

Display

Application

1

2

3

4

Input: vertices in 3D space

Vertex Stream

Vertices positioned in screen space

Triangle Stream

Triangles positioned in screen space

Fragment Stream

Fragments (one per covered sample)

Shaded Fragments

Shaded fragments

Output: image (pixels)

CPU & GPU

Graphics Processing Unit (GPU)

58 of 62

Rasterization Pipeline

Monitor

Vertex Processing

Triangle Processing

Rasterization

Fragment Processing

Framebuffer Operations

Display

Application

1

2

3

4

Input: vertices in 3D space

Vertex Stream

Vertices positioned in screen space

Triangle Stream

Triangles positioned in screen space

Fragment Stream

Fragments (one per covered sample)

Shaded Fragments

Shaded fragments

Output: image (pixels)

CPU & GPU

Graphics Processing Unit (GPU)

59 of 62

Graphics Processing Unit (GPU)

  • The main component of a graphics card

Dedicated Graphics Card

NVIDIA GeForce Titan X

Connection

to Monitor

Connection

to CPU

GPU

60 of 62

Graphics Processing Unit (GPU)

  • Has many cores and is designed for parallel processing
  • Initially was only used for graphics, but now it’s a more generalized computing device
  • For 3D graphics applications, it takes a scene as the input and outputs an image

61 of 62

Comparison of GPU and CPU

​

​

​

​

​

  • GeForce 3090 Ti — 10K cores (1.86 GHz) – 78 TFLOPS
  • Intel Core i9 12900K — 16 cores (3.2 GHz) – 0.74 TFLOPS

CPU

(few cores)

GPU

(thousands of cores)

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

62 of 62

Why GPU is necessary?

  • 100’s of thousands to millions of triangles in a scene
  • High resolution (2-4 megapixel)
  • 30-60 frames per second (even higher for VR)

​

Unreal Engine 5 Demo (2020)