estelendur d4be579a9f Initial commit 9 vuotta sitten
..
._README.txt d4be579a9f Initial commit 9 vuotta sitten
README.txt d4be579a9f Initial commit 9 vuotta sitten
SphereCam.m d4be579a9f Initial commit 9 vuotta sitten
writeup.pdf d4be579a9f Initial commit 9 vuotta sitten

README.txt

Esty (Katherine) Thomas
Module: MATLAB/Frames

FILES:
SphereCam.m - Contains all the code for the project: rendering spheres by means of raycasting using user input to describe the space & spheres.
README - This file.
writeup.pdf - The explanatory writeup.
circleXY.png - Interaction history for each of the images included in the writeup.

HOW TO COMPILE:
As far as I am aware, does not need to be compiled; just open in Matlab.

HOW TO USE:
Once in Matlab, with SphereCam visible in the filesystem, type SphereCam().
The input prompts are as follows (vectors should be entered [x;y;z]):
Viewpoint (the point from which rays are cast - vector)
Resolution (the image is this many pixels square - scalar)
Size (the pixels fit into this distance - scalar)
Light direction vector (direction towards the light source at infinity)
Center of the sphere (vector)
Radius of the sphere (scalar)
Albedo of the sphere (how dark or light the surface is - scalar)
Gloss value (the proportion of non-Lambertian effect - scalar)
Gloss sharpness (closeness to mirror finish - scalar)
Ambient light level (how bright the background is - scalar)
For camera movement: (CHECK THIS)
Track: enter a translation vector [x;y;z].
x>0 moves view right; x<0 moves view left
y>0 moves view up; y<0 moves view down
z>0 moves towards sphere; z<0 moves away from sphere
Pan: enter an angle in degrees
angle > 0 pans right; angle < 0 pans left
(pans right == sphere shifts left, and vice versa)
Tilt: enter an angle in degrees
angle > 0 tilts up; angle < 0 tilts down
(tilts up == sphere shifts down, and vice versa)
At the prompts 'New Sphere?', 'Want to move the camera?', 'Again?', and 'Nother sphere?', or any of the camera movement prompts, entering 'n' will exit that level of the program (camera or sphere). Simply not entering anything at the sphere prompts and pressing return will force a crash eventually. (This should be more graceful, but time constraints prevent it.)

KNOWN BUGS:
The sphere very often appears really skewed initially, or skews once the camera is moved, or is not lit at all (in which case the background is very bright and the sphere is very dark), or is lit only on the very edge. The error where the sphere is not lit at all can be corrected by taking the farther of the two intersection points, but this gives very amusing and wrong results when the sphere is glossy rather than matte.
The skew seems to indicate that the field of view is acting as a cone, onto the sides of which the sphere is smeared and distorted.