3480 - Computer Graphics - Semester Project
Keelan Brening
This GIF shows my goal Want to replicate this GIF |
---|
My computer graphics elements...
To demonstrate my study ...
This was built in lab9 framework using triangles to get the shape of the house
Going to be switching frameworks since opengl lets me
demenstrate it in real time.
These pictures are from changing the aspect ratio. For understanding this,
is helping me understand how to get the focal length and what is needed to clone the gif.
Picture 1 has a aspect ratio of 1
Picture 2 has an aspect ration of 250
The next step was to create the scene and add the texture map to the floor. The floor matches the GIF above. I had to change glLookAt in order to get the camera to look at the object in a isometric view.
Next step is to apply the focal length and modification of the
FOV.
focal length : 1/f = 1/u + 1/v
f = focal length
u = Object to the lens
v = distance from the lens to the image
FOV = 2 * atan(x/(2*f))
x = diagonal of the film
f = focal length
I tested the crossed out section and was not able to get the results
I wanted. It would always give out the wrong output. I found another
formula that is working. It will be below
angle = 2 * (d/2*f)
f = focal length
d = height of projection plane
fov = angle * (screen/imagescreen)
screen = screen x-axis * screen y-axis
imagescreen = (screen x-axis/2) * (screen y-axis/2)
angle = comes from teh equation above
I have been testing alot of way to recreate the GIF on the top of the page.
Alot of testing was needed to figure out what was needed in order to
recreate the zoom while keeping the camer in the same location. When
looking over gluPerspective after changing the fovy in the previous GIF.
Since the fovy was already being changed the Aspect Ration needed to change
in order to keep the screen in the same location, to simulate that the
camera is staying in the same location.
I tested alot of formulas that were unsuccessfull and caused too many errors.
At this point i just decided to add a value to the Aspect Ratio. I started
with 10.0 by either adding or subtracting it. I noticed that when subtracting
a value from it, it kindof shows the result that I was wanting. So i changed the
value from 10 to 0.05 and I had the value start at 0 and only allow it to
go negative. This value than will become a larger negative value as I
pressed M and N to zoom in and out.
This is when I saw the result below. It was still changing the fovy but
at the same time was changing the aspect ration to keep it in a
desired location.
After looking over my math, I decided I needed to redeterming the correct
formula in order to get the desired change in perspective. My mentor
from San Diego called me the day while I was working on it and helped me
figure out the trig.
AngleO = original angle
Angle = change of angle
Which gave me this formula
NewFOV = Tan(angle) * Tan(angleO) * FOV
This formula worked better than my previous I used. The only different
is that I determind that the focal lenght was the farClip in gluperspective.
I used the knowledge and modified it by a small margine.
After implementing the formula as well as modifing the variables needed.
I got the GIF below. I got the perspective the change correctly now.
I still need to do research on how to keep the camera in the same location
while the perspective changes.
===============================================================
Lab Renderings
Lab6 |
|
---|---|
Lab 8 |
|
---|---|
Render of a circle and disk |
Render of Saturn |