Computer graphics is a post AP Computer Science course where we wrote our own graphics engine from scratch in a language of our choice (I chose Typescript). We covered topics like line/curve drawing algorithms, Phong shading, animations, and more. For my final assignment, I chose to learn and implement ray tracing.
- Team Name: House Graphics
- Team Members: William Cao Period 10
- Antialiasing with raytracing. Supported materials are: glass, metal, and diffuse.
- Please have "shading raytrace" as the first line of the mdl file.
- The only supported shape is a sphere. The command should formatted as:
sphere x y z radius material red green blue reflectionIndex|fuzz
- If the "material" is glass:
- Put positive value for reflection index (last argument)
- Reflection index: https://en.wikipedia.org/wiki/List_of_refractive_indices
- put any random NUMBER for "red", "green", and "blue" field
- If the "material" is diffuse:
- put any NUMBER for last argument
- If the "material" is metal:
- last value is "fuzz" positive value from 0 to 1 exclusive. fuzziness of reflection from metal
- The screen is -1 to 1 by -1 to 1 (and not 500x500).
- The camera is located at (0, 0, 0), so use negative z values
- The program will display where the program is currently at like so:
This means it is 95.6% done, and has finished 239,000 pixels of 250,000.
Finished pixel 239000 of 250000 (0.956)
- I assume you can compile typescript, have npm installed, and imagemagik working. Use macOS or a linux distro.
- Clone the repo and change directory into it
git clone https://github.com/WilliamC07/graphics-final.git && cd graphics-final.git
- Run make
make
- Open the image created (asd.png)
- I followed this guide (Ray tracing in one weekend).
- The guide was in c++
- Ray tracing
- Online guide
- Another one
- I can expand on this to include more reflection types (transparency, water bending light, etc...), or until my computer takes too long to run the program when debugging.
- Supporting .obj texture (when I get ray tracing to work)