ld32: FATAL 12: Expecting n32 objects: /usr/class/cs248/support/lib/libppm.a(libppm1.o) is o32. make: *** [viewer] Error 2
A. This is due to a bug in the Makefile that causes trouble on the raptors. Please copy the updated makefile from the assignments directory to your work directory, remove your old object files, and try compiling again.
A. Don't worry about the third one, it's always zero. The first two are the u and v texture coordinates, respectively.
A. Make any variable you could ever possibly want to change when experimenting a parameter. For example, you can implement several ways of doing something as separate shaders - or introduce an integer or string valued variable to make a choice between implementations inside a shader. Document everything. We'll need to know what variables you used so we can see what they do.
A. See the file image.h in the framework; the
function ReadImage()
is what you want to use. You'll probably
want to load the texture in the shaderSetup()
function.
A. Check out the variables float surfaceDDs[3], surfaceDDt[3];
in info.h
A. Nope! You'll want to use noise and call the
FBm()
function, but you don't need to implement your own
noise function or change the implementation of the supplied one. Instead, the
trick is figuring out how to call the function and how to use the result
in the process of getting an accurate-looking result.
A. Sure! Use a paint program to design bump images. Start with a black canvas and paint white shapes on it. Then, view it with xv and blur it (a lot... use a blur size of at least 7). Or, write a function that given parameter values (u,v) returns a height value or a gradiant value. Think about including a bumpScale parameter that will allow you to increase or decrease the effect the bumps have on your normal to make them easier to see.
A. You bet, campers! Our silly noise example used the noise function to modulate a color between black and white - i.e. color = noise*otherColor. Use linear interpolation to modulate between two colors. Even better - figure out a way to modulate between three colors.
A. Is the shader that is being executed setting a color?
FBm()
function.
A. Bug in our Makefile--sorry! Please copy the new Makefile from /usr/class/cs248/assignments/assignment4.
A. display is a possibility. Run it and hit the left mouse button over the window to get a menu. There are some options for drawing basic shapes, etc.
A. Make sure the config file ends with a newline. Unfortunately, our parser doesn't handle this robustly.
A. First, a brief review of Perlin's noise function. The noise function is defined throughout 3D space, and returns a value between -1 and 1 (roughly). It has two important properties:
The function we supply you, FBm(), packages Perlin's function in a convenient manner. To wit:
double FBm(float x, float y, float z, float omega, float lambda, float octaves) { double ret = 0; double o = omega; for (int i = 0; i < (int)octaves; ++i) { ret += o * Noise(x, y, z); o *= omega; x *= lambda; y *= lambda; z *= lambda; } ret += (octaves - (int)octaves) * o * Noise(x, y, z); return ret; }FBm() can be used to compute a series of scales of noise, in order to add higher frequencies. The octaves parameter defines how many scales to add together. Lambda gives the change in frequency between scales: for almost all situations, a lambda value of 2 is right. Finally, the omega parameter is a muliplicitive change in amplitude from scale to scale. It should usually be less than one, since higher frequencies should have less impact. Experiment with it to see how it changes the 'roughness' of the texture. Given a value of omega and the knowledge of the fact that Noise() returns values (roughly) between -1 and 1, it's possible to bound the value of FBm().
Given all that, there are a few things to figure out:
A. When you make a *.ppm image in xpaint or xv, make sure you save it in full color mode. Otherwise, it uses a range of 0-1 rather than 0-255.