<p>I am wondering how I can use perspective rendering to render a point onto a screen. An image showing perspective rendering:</p>
<p><a href="https://i.sstatic.net/iwh5j.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/iwh5j.png" alt="Picture of perspective rendering" /></a></p>
<br>
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?
<p>In pseudo-code:</p>
<pre><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)
</code></pre>
<p>How would the <code>perspectivePlot</code> function work? From my understanding, it needs to plot a line between the <code>cameraPosition</code> and <code>pointA</code>, then find where the line intersects a plane that is 1 unit away from <code>cameraPosition</code> at the angle determined by <code>cameraLookat</code>.</p>
<p>How would this be done?</p>

CC BY-SA 4.0
2021-12-20T03:24:50.273Z
Are you saying you need help computing the intersection of a line and a plane?
Wyck
CC BY-SA 4.0
2021-12-20T12:34:43.447Z
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)$
lightxbulb
<rendering><3d><perspective><camera><render>
Using Perspective Rendering To Render A 3D Point
Brendan R.
# Using Perspective Rendering To Render A 3D Point

(Asked by: username_0 on 2021-12-19)

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

[![Picture of perspective rendering](https://i.sstatic.net/iwh5j.png)](https://i.sstatic.net/iwh5j.png)

  
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?

**Tags:** rendering, 3d, perspective, camera, render

> **Comments:**
> **username_1**: Are you saying you need help computing the intersection of a line and a plane?  
> **username_2**: 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)$  

---

## 0 answers

