3D Texturing Project: Environment Mapping and Tilable Textures, Study Guides, Projects, Research of Computer Graphics

A project where students will apply textures to 3d models using environment mapping and tilable textures. The project involves applying a 2d spherical environment map to a model and producing an image of a doughnut with a given texture. Students will also implement keyboard events for animation and zooming, and read input files for textures and models. Relevant opengl commands for texturing are provided.

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 08/05/2009

koofers-user-w5e
koofers-user-w5e 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Project 5 - Two textures
In this project, you’ll be applying textures to 3D models. The project has two parts and each part is
about a different kind of texture. You’ll apply a 2D spherical environment map to an arbitrary model and
produce an image of a doughnut with a pattern given by a tilable texture.
1 Environment mapping
We are providing a few photographs of the light probe, you need to apply the images as textures so that
the model looks as if it was a mirror object in the corresponding environment. Note that the camera
should be fixed (with respect to the environment) as the model rotates.
2 Tilable texture
Draw a nice brick or wooden doughnut using one of the provided textures.
3 Display of the results
You can either cut and paste code from your 3D viewer, allowing the user to use trackball interface to
rotate the textured model or just rotate the model in an aperiodic fashion (as in the OpenGL sample code
provided for project 2).
4 Keyboard events
Please implement the following keyboard events:
F/f animate faster (say, about 30% faster); don’t handle this event if you use trackball interface
S/s animate slower (again, about 30%); don’t handle this event if you use trackball interface
A/a start rotating; the default should be no animation: when we start your programs, the displayed
model should be stationary; don’t handle this event if you use trackball interface
Z/z stop rotating; don’t handle this event if you use trackball interface
I/i zoom in
O/o zoom out
E/e if selected, the model should show up with environment mapping (of course, using the texture read
from the file whose name is given as the second argument)
D/d If selected, show textured doughnut; use one of the tilable textures
5 Input files
The environment maps and the tilable textures are just binary PPM images with no comment lines (same
as in project 3). Graphics hardware often has problems with textures with resolutions that are not powers
of two, so you can assume all PPM images’ resolutions are powers of two.
Your code should read the following files:
1
pf2

Partial preview of the text

Download 3D Texturing Project: Environment Mapping and Tilable Textures and more Study Guides, Projects, Research Computer Graphics in PDF only on Docsity!

Project 5 - Two textures

In this project, you’ll be applying textures to 3D models. The project has two parts and each part is about a different kind of texture. You’ll apply a 2D spherical environment map to an arbitrary model and produce an image of a doughnut with a pattern given by a tilable texture.

1 Environment mapping

We are providing a few photographs of the light probe, you need to apply the images as textures so that the model looks as if it was a mirror object in the corresponding environment. Note that the camera should be fixed (with respect to the environment) as the model rotates.

2 Tilable texture

Draw a nice brick or wooden doughnut using one of the provided textures.

3 Display of the results

You can either cut and paste code from your 3D viewer, allowing the user to use trackball interface to rotate the textured model or just rotate the model in an aperiodic fashion (as in the OpenGL sample code provided for project 2).

4 Keyboard events

Please implement the following keyboard events:

F/f animate faster (say, about 30% faster); don’t handle this event if you use trackball interface

S/s animate slower (again, about 30%); don’t handle this event if you use trackball interface

A/a start rotating; the default should be no animation: when we start your programs, the displayed model should be stationary; don’t handle this event if you use trackball interface

Z/z stop rotating; don’t handle this event if you use trackball interface

I/i zoom in

O/o zoom out

E/e if selected, the model should show up with environment mapping (of course, using the texture read from the file whose name is given as the second argument)

D/d If selected, show textured doughnut; use one of the tilable textures

5 Input files

The environment maps and the tilable textures are just binary PPM images with no comment lines (same as in project 3). Graphics hardware often has problems with textures with resolutions that are not powers of two, so you can assume all PPM images’ resolutions are powers of two.

Your code should read the following files:

(i) envmap.ppm - the environment texture

(ii) tilable.ppm - the doughnut texture

(iii) model.t - the 3D model to be used in with the environment map

Note that the environment map will look best on high resolution models such as horse2.t, bunny2.t or feline2.t.

5.1 New OpenGL commands needed for texturing

It is OK to use automatic texture generation if you want to learn about it, but it is also not hard to specify the texture coordinates and texture transformation matrix ‘by hand’. Relevant OpenGL commands:

glTexImage(), glMatrixMode(with GL TEXTURE argument – e.g. to ‘rotate’ the texture coordinates as the object rotates), glTexCoord*(). Possibly also glTexGen(), if you want to use automatic texture generation.

Before you use the texture (before glBegin), you need to enable texturing (glEnable(GL TEXTURE 2D)), set the way the texture relates to the lighting (this is performed by glTexEnvf command; for an RGB texture (like ours), use it with arguments GL TEXTURE ENV, GL TEXTURE ENV MODE, GL REPLACE if you want to disable lighting and just apply the texture; change the last argument to GL MODULATE if you want the lighting to be combined with the texture map (this way you will see both highlights and the reflection of the environment on your object)). Also, make the magnification/minification filters just do linear interpolation by calling glTexParameteri(GL TEXTURE 2D, GL TEXTURE MAG FILTER, GL LINEAR); glTexParameteri(GL TEXTURE 2D, GL TEXTURE MIN FILTER, GL LINEAR); This will cause OpenGL to use your texture no matter what the size of the target object is. A more elegant way of doing this would be through mipmapping, i.e. providing different resolutions of the texture you wish to use.

6 Grading

Each part is worth the same, 100/2 per cent of the score. As usual, the project is individual, you are welcome to discuss high level approaches or ideas, but the code should be your own.