cs380 fall2017 lecture 14.ppt - compatibility mode€¦ · microsoft powerpoint -...

22
CS 380 - GPU and GPGPU Programming Lecture 14: GPU Texturing 2 Markus Hadwiger, KAUST

Upload: others

Post on 28-Jan-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

  • CS 380 - GPU and GPGPU ProgrammingLecture 14: GPU Texturing 2

    Markus Hadwiger, KAUST

  • 2

    Reading Assignment #9 (until Oct 29)

    Read (required):

    • Rational-Linear Interpolation of Texture Coordinates and Their PartialDerivatives

    http://www.hpl.hp.com/techreports/98/HPL-98-113.pdf

    • OpenGL 4.6 Core Specification,Chapter 9 (Frame Buffers and Frame Buffer Objects)

    https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf

  • 3

    Programming Assignments: Schedule (tentative)

    Assignment #1:

    • Querying the GPU (OpenGL and CUDA) due Aug 27

    ----- Eid Break: Aug 31 – Sep 7 -----

    Assignment #2:

    • Phong shading and procedural texturing (GLSL) due Oct 1

    • OpenGL + GLSL Tutorial: this week

    Assignment #3:

    • Image Processing with (a) GLSL, and (b) CUDA due Oct 22

    Assignment #4:

    • Linear Algebra (CUDA) due Nov 12

  • 4

    Quiz #2: Nov 1

    Organization

    • First 30 min of lecture

    • No material (book, notes, ...) allowed

    Content of questions

    • Lectures (both actual lectures and slides)

    • Reading assigments

    • Programming assignments (algorithms, methods)

    • Solve short practical examples

  • Next Lectures

    Lecture 15: Thursday, Oct 26, 9:00

    Markus Hadwiger, KAUST 5

  • 6

    GPU Texturing

    Rage / id Tech 5 (id Software)

  • Eduard Gröller, Stefan Jeschke 7

    Texturing: General Approach

    Texture space (u,v) Object space (xO,yO,zO) Image Space (xI,yI)

    Parametrization Rendering(Projection etc.)

    Texels

  • 8

    Perspective Projection

  • 9

    Perspective Projection

  • 10

    Perspective Projection

  • 11

    Perspective Projection

  • 12

    Perspective Projection

  • 13

    Perspective Projection

  • Vienna University of Technology 14

    Perspective Texture Mapping

    2

    2

    1

    1

    21

    21

    w

    xb

    w

    xa

    bwaw

    bxax

    linear interpolation

    in object space

    a = b = 0.5

    linear interpolationin screen space

  • 15

    Early Perspective Texture Mapping in Games

    DOOM (id Software, 1993)

  • 16

    Early Perspective Texture Mapping in Games

    Quake (id Software, 1996)

  • 17

    Perspective Projection

  • Vienna University of Technology 18

    Perspective Texture Mapping

    Solution: interpolate (s/w, t/w, 1/w)

    (s/w) / (1/w) = s etc. at every fragment

    each vertex

    each fragment

    Heckbert and Moreton

  • 19

    Perspective-Correct Interpolation Recipe

    Heckbert and Moreton

  • 2D Texture Mapping

    Texture

    R G B AFor each fragment:

    interpolate thetexture coordinates

    (barycentric)Or:

    Use arbitrary, computed coordinates

    Texture-Lookup:interpolate thetexture data(bi-linear)

    Or:Nearest-neighbor for “array lookup”

  • 3D Texture Mapping

    R G B A

    R

    GB

    For each fragment:interpolate the

    texture coordinates(barycentric)

    Or:Use arbitrary, computed coordinates

    Texture-Lookup:interpolate thetexture data(tri-linear)

    Or:Nearest-neighbor for “array lookup”

  • Thank you.