3480 - Computer Graphics - Semester Project
Nicholas Kalar
Elements and Demonstrations
Torus Object
Perlin Noise
Last Work Done
Lab 15
Work from past labs
Donut Sans Bite
Image showing general idea of project:
My computer graphics elements:
1. Creating a torus using ray tracing
2. Cliping a torus using a cylinder
3. Perlin Noise
To demonstrate my study:
1. A torus
2. A second torus cliped with a sine wave to simulate frosting
3. A clip taken out of the original torus to simulate a bite
4. Perlin Noise simulation of cooked dough
Here is my first attempt at a torus:
Torus equations found at
https://github.com/lishicao/RayTracer/tree/master/myRayTracer
and
http://blog.marcinchwedczuk.pl/ray-tracing-torus
Here is a test with clipping a torus, and a verticle torus
requested by Instructor Gordon:
Rotation information found at:
https://en.wikipedia.org/wiki/Rotation_matrix
And here is a second rotated donut on both the z and y axis:
I attempted to get a clip out of my donut, as seen in the screenshot below.
For some reason, the clip doesn't show up in the donut itself, but partially
in the reflection on the table.
Since I had no luck working on the clipping. I decided to try and tackle
Perlin noise. Below are my first 3 attempts with noise. I started with 2D
noise on a 2D disk. Once I got that up and running, I moved to 3D noise on
a sphere. Finally I attempted to add color. That's were I hit a wall.
Perlin noise code found at
http://cs.nyu.edu/~perlin/doc/oscar.html
I decided to give up on that for a moment and attempt clipping in a
different way. Using just the x and z coordinates, I cut a small slice
out of my donut.
I played around with how perlin noise gradiated colors for a while with
little success, but I was finally able at get some color to show up how
I wanted it to look.
WORK DONE 12/8/2020 TO 12/15/2020
After working on the math of the cylinder, I was able to get it to display
the back of the cylinder only.
I also, just for fun, made sure the cylinder can rotate.
I attempted to use this math for my clipping, but it didn't work. I then
remembered that we had the math set up for clipping a sphere, so I tried
that and this is the results.
After some trial and error, I was finally able to get a successful clip
using a cylinder. Turns out all I needed was to use the math for the
sphere, but remove the y coordinate. Work smarter not harder, kids.
Now it's mostly just a game of playing around until I'm happy. Below are
the first 3 completed "bites" I did for my donut.
As you can see, it's still pretty dark and the cylinder shape won't clip
perfectly into the slot. With more time and more math, I should be able
to fix the second issue. As for the first, lets see if moving the light
will help.
Didn't seem to help. Let's try making the light more diffuse and messing
with the normals of the cylinder.
Nope! Still nothing.
After confering with Gordon on the issue, he gave me the idea to negate the
normal of the cylinder/bite if it's normal is pointing away from the ray.
After doing that, it worked!
Now that all this has been done, we can take a look at the full scene.
Overall, I'm pretty happy with it. I could spend more time working on the
bite, getting it to not poke out and to cover the bottom better, but with
the time I've already spent on the project and the amount of work it took
to get this far, I'm satisfied with the work I've accomplished.
Lab 15 work done
I was able to get a cylinder to render. This cylinder will be used to create
a clip in my torus to mimick a bite being taken out.
The animation from my lab-6 is here:
Screenshot of lab8 working:
Hey, look at this pokeball: