You are viewing the course site for a past offering of this course. The current offering may be found here.
Lecture 5: Texture Mapping (13)
rishiarjun

For the triangle vertices in texture space, do we just map from triangle to texture space by Barycentric coordinates? Are we just supposed to take the averages of three vertices at each point which represent the current point on the triangle

Staffyirenng

@rishiarjun

It works like this:

  • We send a triangle to the screen to be rasterized. Each vertex has screen-space (x,y)(x,y) coordinates for where it should appear on screen, and (u,v)(u,v) texture coordinates for the location it should sample from in the texture image.
  • During rasterization, a sample is generated for each framebuffer pixel inside the triangle. For each sample, which has screen-space (x,y)(x,y) coordinates, barycentric interpolation is applied to calculate interpolated (u,v)(u,v) coordinates at that sample location.
  • Each of these interpolated (u,v)(u,v) coordinates is used to index into texture space (potentially with texture filtering as described later), to retrieve the texture value to apply at the sample associated with the framebuffer pixel.

Does this answer your question?

You must be enrolled in the course to comment