3D Fundamentals Tutorial 7
From Chilipedia
Textures. Put purdy pictures onto your triangles. Lot of interpolation and stuff.
Video
The tutorial video is on YouTube here.
- What is texture mapping and why do we want it? 0:14
- Mapping a picture onto a geometry (triangles)
- Basically, to create real life imagery with high fidelity
- How to approach texture mapping 2:45
- How NOT to do it: sccaling and rotating points of a sprite
- Right way: Generate a mapping of vertices of our geometry to points in our texture
- This requires:
- - Transform the vertices to screen space
- - Rasterize (using scanlines)
- - Interpolate from the geometry's screen coordinates (x,y) to coordinates of the texture (u,v)
- - Use the texture's color at (u,v) to draw the pixel on the screen at (x,y)
- This is done based on the positions of the center of the starting pixel & the scanline
- Implementing these concepts into code 8:42
- The
TexVertex
class - Incorporating data & methods in
Cube.h
- Implementing
DrawTriangleTex(...)
triangle drawing with textures inGraphics.h
andGraphics.cpp
10:55
- The
Downloads
The GitHub repository for the tutorial code is here.