# 3D Projection using lens formula

This is how I re-invented the wheel đ

This is an alternate approach to do projection in computer graphics using a lens formula. As it is a technique which is derived from lens formula, the focal length of the lens is the major parameter. The traditional projection techniques uses the ‘field of view’ value – which is an angle expressed in degrees or radians.

Anyways, if you are a person who didn’t even experienced the 3D graphics programming, you may ask these following questions to yourself before you get started.

1. How to draw 3D objects on a 2D Plane?

2. How can we plot a 3D vertex(x, y, z) into a 2D plane which has only 2 axes.

I asked this questions to myself long time back before attending some 3D graphics lessons. As a result, after some days of deep thought, I landed up with an idea to go through my Physics book. I flipped through the pages and stopped at the chapter Ray Optics. Finally, after some days, I ended up with some clues to solve the above problems. The final outcome of this was an equation by which we can accomplish projection. Later when I covered computer graphics I came to know that this is called the âProjectionâ operation in 3D Graphics. Yeah. The moment I came to know that I re-invented the wheel.

Here we start,

Most probably you might be familiar with this equation. Its the equation of a convex lens. The main reason why I choose a lens is that, it can project a 3D objects on a 2D plane. For eg, have a look at the working princpile of an human eye. The lens of the eye projects the 3D world around us into a small plane inside the eyeball – called retina. Similarly, a camera does the same thing. It projects the world into a photographic film or a digital sensor.

Now lets visualize the 3D coordinate system(Right handed), where the Y axis grows up, X Axis grows right and the Z axis grows towards the viewer. Place the lens at the Origin facing the viewer so that the Z axis coincides with the principal axis,also the Origin coincides with the Optical Center of the lens. Now lets place a point object P(x1, y1, z1) infront of the lens as shown below

Lets setup a diagram and workout a formula

**Calculate x2**

ie,

**Calculating **

Similarly, for , substitute for OB in eq (1), we’ll get,

So we can conclude,

*A convex lens with focal length âfâ projects a 3D coordinate into a plane, at position*