CS594 – Computer Graphics – LABS

Professor Jian Huang

TA: Jeff Burton

 

Dr. Huang’s Page

LAB 2:

What do I do, this looks like a lot of stuff?

Well, yes, there are a few things to do in this lab, but you will be adding realism to your objects via shading and texturing. First, you need to compute normals, the Red Book offers an excellent description (in one of the appendices, I think…well, it’s there somewhere), and I am relatively sure Dr. Huang has notes on it. So GO READ THEM! Oh, you’ll need to add a normal list to your object, but I’m sure you already figured that out. Once you have normals, you can turn on the lights and see your objects in a new light (sorry, bad pun…). Again, read the Red Book about lighting. Material specifications for ambient, diffuse and specular lighting are also in read the Red Book. Here are some material properties you can play with. Get normals first, then do material properties….

For texturing, Dr. Huang has several rgb textures available in the class directory (for those of you who can’t get to it, just email me). Here is some code to read rgb files: sgi_texture.c sgi_texture.h and an EXAMPLE. Don’t like rgb files? Well, there are several others image formats you can use, I believe the nehe website has a jpg and bmp code (in C) to read those particular formats. Feel free to use them. You can also use xv (or another image editor) to convert between various formats. You can use any texture you want (nothing obscene please…), but you need to use the two textures eoe2_alphaEqu1_all..rgb, eoe3_alphaEqu1_land_alpha0_water..rgb to implement the translucent water on the sphere. Questions? Email me. Oh, and don’t forget to make sure your image sizes are powers of 2.

For environment mapping, you need to use a picture that’s been through a fish-eye lens converter. The file café.rgb in Dr. Huang’s RGBfiles directory is already set up for this. Check it out, feel free to convert your own images, but don’t waste time on it. You can also do cube map environment mapping on newer video cards, if you really want to. Ask Dr. Huang first then come see me and I’ll show you what’s involved. It’s not a great deal of work.

For the marble texturing, you’ll need a decent video card if you don’t use the equipment here, I believe anything equivalent to a GeForce2 or better can handle it. In Dr. Huang’s ~huangj/datasets/Marble directory, you will find the code to create a 3D texture for you. Well, it just creates the 3D volume, you will nee to load it into OpenGL. You will need to “tweak” it to get the right look. Also, you may need to install a couple of extra header files. Look for glext.h, wglext.h on the web for Nvidia cards and grab glATI.h for Radeon cards. I would post them here, but they change frequently so just go grab them. Just place them in your project directory. These files give you the API calls necessary for advanced functionality, like 3D texturing.

For the solar system you will need some textures. We have downloaded some for you, but the best I’ve seen are here http://www.3dcafe.com/asp/texturesplanets1.asp. To do this part you need to fully understand translations and rotations. If you don’t, you will when you do this. Again, make sure your texture sizes are powers of 2, i.e. 256x256, 128x128, etc.

If you have any questions, don’t hesitate to email me or come by during office hours.

HAVE FUN!!!!!!!!!!

 

 

LAB 1:

Where do I get the lab 1 API and Demo?

~huangj/CS594F03 – grab the files LAB1_API.zip and LAB1_DEMO.zip. The API is a Visual C++ 6.0 workspace with all the files you’ll need, it works in Visual .Net as well...The demo includes a working Win32 executable and some sample data – grab a data file (say bunny.off) and drag it onto the executable. Two windows should eventually pop up, a Win32 command window and the main OpenGL window. In the command window a list of keyboard functions should allow you to manipulate the object.

For those developing at home, make sure you install GLUT and update your video drivers. For those who must be in Linux or some Unix variant, get your load_file working under Win32 and let the render.obj help you. Once you have that working, you can move everything to Linux. If you do a platform other than Win32, let me know what platform your files are for when you turn in the lab.

 

Now what do I do?

Load the lab1_api.dsw workspace file into Visual C++ and open the file lab1.h. At the bottom of the listing are 5 functions you need to define. Included in the lab is render.obj which defines init, display, reshape and SpecialKeys. This lets you test your load_file function first before moving on to the other functions which do all the OpenGL calls. load_file must fill in the OBJ structure shown in the lab1.h file. It should be obvious, if not email me. You don’t need to specify the edge list to get this working.

 

What are the file formats I must load?

OFF file format

PLY file format

OBJ file format – some obj files specify material properties for each face. It’s not required for the lab, but it does add realism to the object...a helpful attribute when you want superior visuals.

 

 

 

 

 

 

LABS

Resources

Back to TA’s page