G33X Nexus Entertainment

G33X Nexus Entertainment => Requiem for Innocence => Current Projects => Precursors => Topic started by: Rosencrantz on August 30, 2006, 03:37:17 am

Title: Notes on the journal of the main developer of Infinity
Post by: Rosencrantz on August 30, 2006, 03:37:17 am
I've been looking through this guys journal some just to get a feel for where he started and how he got there, and if any of it is useful to us.

First of all, can someone with more graphics background explain field of view?
Specifically I'm referring to his Aug 30, 2004 post.
Quote
I finally fixed the impostor bug. The formula i used was wrong, i was not calculating the frustum field of view angle correctly. It was a bit tricky to understand why, but revising my trigonometry helped a bit. For those interesting, the code looks like this: for a viewer position located at ViewPos, the impostored object being represented as its bounding sphere Center, Radius,

float d = distance(ViewPos, Center)
float fov = asin(Radius / d)
float l = d * tan(fov)
matrix4x4 viewMatrix = buildLookAtMatrix(ViewPos, Center)
viewMatrix = buildTranslateMatrix(-ViewPos) * viewMatrix.transpose()
matrix4x4 projMatrix = buildProjectionMatrix(fov, 1, znear, zfar)
matrix4x4 worldMatrix = buildIdentityMatrix()

Looking at what kind of triangle that math produces makes absolutely no sense physically. I'd expect something more like.

fov = atan(Radius/d)
l = Radius / sin(fov)

Is there something missing? (Probably the definition of field of view).

Title: Re: Notes on the journal of the main developer of Infinity
Post by: Morgul on August 30, 2006, 09:33:05 am
Unfortunately, I have not background in this stuff at all, just a minor physics background. Howeverf, I have to agree with you, I would have expected your forumlas not his. Odd.