max zeng

Focal Point Question, Computer Graphic

Recommended Posts

max zeng    1

the self-taught thread profess you guys to be genius programmers at age 12 or something. so u figure you guys must know the answer the question i am stuck on. 

i'm programming a perspective game engine from scratch without open GL functions, and read up on how to 3d perspective work. 

I get the basic gist of it. one issue so far. 

how is focal point determined.  wat value is used here.  let's say if i were to create a camera for a game. Pinhole+Camera+Terminology.jpg

Edited by max zeng

Share this post


Link to post
Share on other sites
LorenzoGatti    4450

What focal point? There is nothing of the sort in the posted diagram.

Seriously, all you need to render a 3D scene is either finding Xim (and whether it's clipped) given Xcam or more likely Xcam given Xim. Xim coordinates also need to be transformed between 3D and 2D. The only parameters are the locations of C and P (where is your camera and where is it facing) and the U and V directions (tilt and rotation of the image plane, often but not necessarily constrained to be perpendicular to Z).

 

Share this post


Link to post
Share on other sites
0r0d    1937
1 hour ago, max zeng said:

focal length, wat value is used for this

It's not clear what you're asking.  As far as I can tell from your drawing, the "focal length" is just the distance along the line of sight to the point P, which is the "image center".  But, what is the image?  What is the image plane you're talking about?  In a game camera you have a zNear (near clipping plane) and zFar (far clipping plane) and everything in between are just points.  There is no focal distance unless you're talking about some depth-of-field rendering.  In a normal game camera, everything is in focus.

Share this post


Link to post
Share on other sites
LorenzoGatti    4450

The focal distance BZ is the distance between a point (the camera location) and a plane (the image plane). Both are under your control, so the computation is straightforward. There are very simple formulas.

Of course, as Hodgman noted, BZ doesn't have any useful role to play. Can you explain why you care about this distance?

Edited by LorenzoGatti

Share this post


Link to post
Share on other sites
max zeng    1

https://www.scratchapixel.com/lessons/3d-basic-rendering/rasterization-practical-implementation

look at FIgure 2:

see where all the rays converge onto a single point, that's what the eye represent on the last picture i posted. 

the focal length is the distance this point of convergence to the image plane. 

the focal length matters because you need it to calculate the point of intersection between the object you are looking at to the image plane to get a 2d rasterization.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now