Project 7

Texture Mapping: Checkerboard and Image textures, and Perlin-Noise based Marble

Required Image:

(Image scaled down. Click on images for fullsize view.)

Two image mapped earths, one marble sphere, and ground triangles made of checkerboarded Phong and Metal materials.
Performance data is here.

The same corner in an MPM data set as in the last project, but textured in checkerboarded materials. Steve, let's publish a paper: Towards a plaider understanding of MPM datasets. I smell SIGGRAPH!!

Design choices:
This week I updated the interface of the Object class, so this was rather an important design decision.

I decided not to go with Steve's suggestion of a separate TextureMapping class which objects could both (multiply) inherit from, and contain instances of. The confusing nature of that last sentence is basically the same reason I decided not to do it that way. That, and I get the jibblies whenever I think about multiple inheritance without making out my last will and testament.

Instead, I added a virtual tex_coords method to my Object class, which contains a default identity mapping from world space to texture space. Any object needing a different mapping can override this method and provide its own implementation. I did exactly that for my PolarSphere class, as suggested in the class notes. It is PolarSpheres that appear in both my required image, and my creative image.

I also took a different route with regard to the interplay between materials and textures. In Steve's implementation, they have both merged into a single concept. I have chosen to keep them separate, mainly to avoid writing extra code, but also because I like the flexibility of my system. What I do is give objects both a material and a texture. The texture is optional. If there is a texture, then its color at a hit point is queried during the call to the material's shade method. That color is then combined into the rest of the shading computation. The upshot of this method is that you simply decide separately what texture (if any) and what material to put on an object, and specify them. It keeps the calling sequences cleaner and easier to understand, and makes it easier to change the code to try different materials or textures.