# CS 184: COMPUTER GRAPHICS

PREVIOUS < - - - - > CS 184 HOME < - - - - > CURRENT < - - - - > NEXT

# Warm-up Problem:

## How do you define a suitable texture and appropriate texture coordinates on your surface ?

Escher tiling with 12 lizards

Escher tiling with 24 birds

Tiling with 60 butterflies

# Texture-Mapped Subdivision Surfaces of Arbitrary Genus

The genus of an object is measured by the number of tunnels through it, or, equivalently, by the number of "handles" glued onto a sphere.
see: http://en.wikipedia.org/wiki/Genus_(mathematics)

The construction of a subdivision surface starts with a simple polyhedron, the is then iteratively refined and smoothed by subdivision.
The texture coordinates applied to the original polyhedron are simply subdivided in the proportion of the topological splits executed.
Problems may arise in assigning texture coordinates, if the surface is not a simple cylindical or toroidal domain.
Whenever the genus of a surface is different from 1, then you cannot regularly tile this surface with quad tile with all valence-4 vertices.
In the simple example above, the cube has valence-3 vertices, and the same geometrical vertex wiull have to carry different texture coordinates for different faces.

To model a "spherical" ball we may start with a
simple cube; but the "cubist" fish shape will extend beyond a single face and overlap into two adjacent faces.

Thus the texture pattern that get's cut out from the whole fish is missing the nose and the tail, but gets these two pieces stuck in from the two sides.
Since these pieces belong to some other fish, they be be of different colors.
Thus multiple copies of the B&W texture outline with different color fills are needed for the different sides of the cube.
On the cube itself, the texture coordinates will then have to be permuted so that a seemless connection between the different patterns and colors occurs.
Some of the tiles may also have to be mirrored! (
See the actual texture coordinates used).

Here is another textured example of genus 2.  --  And another one of genus 3.

More complex examples of a genus 5 surface are discussed here.

### Multi-Textures

To make really fancy surfaces, you may have multiple textures overlaid,
e.g., one describing color, and another one describing displacement or the normal deviations for bump mapping.
Then you need to use multitexture with possibly different texture coordinates for the different maps.
-- and for each of these maps, you also have the possibility that different texture locations from different faces come together at the same vertex!
Thus it is best to have a data structure that has the vertices carry their geometrical information (i.e., their position coordinates and averaged face normals),
but let the faces (fragments) carry their own texture corrdinates at the boundary points.
To find the shape of a subdivision surface (its limit surface) you then need to deal only with the geometrical vertex information.
To find the surface decoration at any location, you only need to deal with the face and texture information that covers that particular location.

### 3D (Solid) Textures

To depict realistically 3D objects made from wood or stone, the patterns shown on adjacent surface polygons have to match in such a way as to imply a coherent 3D pattern that fills the volume inside the B-rep (e.g., wood grain).
We thus need to define a function that generates a 3-dimensional texture field (s,t,r). During rendering, the (x,y,z) coordinates on the B-rep (bilinearly interpolated on each polygon) are then used as arguments to generate texture values at the desired pixel locations.

Some sophisticated custom shaders may combine many of the above effects. They may use a volumetric textures not only to idicate brightness, but also "hardness" and resistance to abrasion. This may then translate into a height modulation at exposed surfaces, which then is handled with displacement mapping or bump mapping.

## Results of Mid-Term Exam

Max=144/160, Min=53/160, Mean=99.3, Stdev=22.7;  Approximate evaluation:  A=120-130;  B= 90-100;  C=60-70.

Comments on last question. Review of reflection, refraction, raytracing.
Nice demo of Snell's law.

## Preview of Final Project

Combine what you have learned so far in intersting, creative ways, and possibly extend it with some other technique that you study on your own.

Review:   All exam questions -- in particular those that you did not get perfectly right.
Review:   Shirley Ch. 8.

### Use this 2-day extension to do a really great job on shape and on texturing. No boring trefoil knot with elliptical cross section and checkerboard tecture!

PREVIOUS < - - - - > CS 184 HOME < - - - - > CURRENT < - - - - > NEXT
Page Editor: Carlo H. Séquin