# Using Perspective Rendering To Render A 3D Point

I am wondering how I can use perspective rendering to render a point onto a screen. An image showing perspective rendering:

Say I have a 3d point (with x, y, and z coordinates), a point for the camera, and a lookat point for the camera (the point that the camera is facing), how can I use this to plot the point?

In pseudo-code:

cameraPosition = [10, 6, 5] // Camera coordinates
cameraLookat = [5, 6, 5] // Where the camera is looking
pointA = [5, 5, 5] // X, Y, and Z coordinates

// Perspective render it to get 2d-coordinates
pointA2D = perspectivePlot(pointA, cameraPosition, cameraLookat)

How would the perspectivePlot function work? From my understanding, it needs to plot a line between the cameraPosition and pointA, then find where the line intersects a plane that is 1 unit away from cameraPosition at the angle determined by cameraLookat.

How would this be done?

• Are you saying you need help computing the intersection of a line and a plane?
– Wyck
Dec 20, 2021 at 3:24
• You can either find the ray-plane intersection or you can transform the point and plane to the camera's coordinate system (the plane corresponding to $z=1$) and then divide by $z$: $(x,y,z) \rightarrow (x/z, y/z)$ Dec 20, 2021 at 12:34