lab03 - CSE4431: Lab 3 Burton Ma Mon 30 Jan, 2012 1...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE4431: Lab 3 Burton Ma Mon 30 Jan, 2012 1 Introduction In this lab you will implement simple texture mapping (replace, modulate, and specular preserving), multiple texture mapping, gloss mapping, and bump mapping. 2 Files Copy the files from the directory /cse/course/4431/labs/03/ into a directory owned by you. 3 Basic Image Texture Mapping Open the earth.frag fragment shader in your favorite editor. The fragment shader uses a uniform sampler2D variable. Samplers are special types that are used to acess texture values. This particular shader uses the sampler to retrieve the daytime color of a point on the earth from a texture and sets the fragment color to the texture color. This is similar to the OpenGL decal texture mode. Open the earth.vert vertex shader in your favorite editor. This is essentially the ADS vertex shader from the previous lab. To perform texture mapping, we need to assign texture coordinates to each vertex. glman assigns texture coordinates for its built-in models, but we will compute our own coordinates for this lab. The function ComputeTextureCoords should compute the texture coordinates for a given point on a sphere of radius 1 centered on the origin. The standard parameterization of a sphere is given by ( x, y, z ) = (cos θ sin φ, sin θ sin φ, cos φ ) , 0 φ < 2 π, 0 φ π (1) Complete ComputeTextureCoords so that it returns a vec2 with coordinates ( s,t ) such that s is θ and t is φ , both scaled to lie between 0 and 1 . Once complete, load earth.glib in glman and observe the results. You will have to modify your calculation of s to get a correct image of Earth. 4 Modulate Lighting
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2012 for the course CSE 4431 taught by Professor Burton during the Winter '12 term at York University.

Page1 / 3

lab03 - CSE4431: Lab 3 Burton Ma Mon 30 Jan, 2012 1...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online