<p>As the <a href="https://processing.org/reference/camera_.html" rel="nofollow noreferrer">documentation</a> describes it, it looks like each group of three parameters is a vector in 3D space. The first three are the position of the “eye”, the next three are the position it’s looking at, and the last three are the “up vector”, i.e. the direction of an arrow pointing out of the top (…sort of—more detail below) of the eye. The positions aren’t related to the size of your display window—the view of your 3D geometry from the camera at that point will fill the display.</p>

<p>In other words, if you have a <a href="https://processing.org/reference/box_.html" rel="nofollow noreferrer">box</a> centered at (0, 0, 0) that’s 1×1×1 units in size, then your camera should be positioned a few units away—say (2, 3, 4)—and looking roughly at the center of the box, i.e. (0, 0, 0). If the box is 100×100×100 instead, then the eye position should be on the same order of magnitude in distance, e.g. (200, 300, 400). The behavior of the up vector is a little more complicated to explain, but leaving it at (0,1,0) is fine for most purposes—it’s mostly there to help you avoid <a href="https://en.wikipedia.org/wiki/Gimbal_lock" rel="nofollow noreferrer">gimbal lock</a>.</p>

CC BY-SA 3.0
2017-03-07T23:35:07.460Z
2017-03-07T23:35:07.460Z
Noah Witherspoon
<p>I have trouble understanding the way a camera is set in <a href="https://processing.org/" rel="nofollow noreferrer">Processing</a> (according to the reference this shoudn't be very different from OpenGl). For starters, when I set the eye position of the camera I have to set three coordinates. I'm assuming that the X coordinate is the horizontal border of the display and the Y coordinate would be the vertical border. I think the Z coordinate to be behind or in front my computer. </p>

<p>So when I do:</p>

<pre><code>camera(width/2, height/2, depth, 250, 250, 0, 0, 1, 0);
</code></pre>

<p>I'm setting the camera in the middle of the display and putting it some depth in the axis that comes into my eyes.</p>

<p>I think this part is clear enough. However, the two other parameters are not as clear. In particular in don't see the difference between the center of the scene and the last parameter which is the axis that is facing upward. </p>

<p>For the center of the scene I'm assuming that it gives me the direction the camera is looking to but what is the axis that is facing upward? </p>

CC BY-SA 3.0
2017-03-07T15:56:34.323Z
Welcome to the CGSE! To get relevant help, you will have to add more context to your question. What tool or language are you using? Is "Processing" some setting of that tool?
ivokabel
CC BY-SA 3.0
2017-03-07T16:00:56.363Z
Thanks for your welcome. Processing is a tool for developing basic computer graphics programs. I edited my post.
user1868607
<camera><processing>
Understanding camera() settings in Processing
user1868607
# Understanding camera() settings in Processing

(Asked by: username_0 on 2017-03-07)

I have trouble understanding the way a camera is set in [Processing](https://processing.org/) (according to the reference this shoudn't be very different from OpenGl). For starters, when I set the eye position of the camera I have to set three coordinates. I'm assuming that the X coordinate is the horizontal border of the display and the Y coordinate would be the vertical border. I think the Z coordinate to be behind or in front my computer.

So when I do:

```
camera(width/2, height/2, depth, 250, 250, 0, 0, 1, 0);

```

I'm setting the camera in the middle of the display and putting it some depth in the axis that comes into my eyes.

I think this part is clear enough. However, the two other parameters are not as clear. In particular in don't see the difference between the center of the scene and the last parameter which is the axis that is facing upward.

For the center of the scene I'm assuming that it gives me the direction the camera is looking to but what is the axis that is facing upward?

**Tags:** camera, processing

> **Comments:**
> **username_1**: Welcome to the CGSE! To get relevant help, you will have to add more context to your question. What tool or language are you using? Is "Processing" some setting of that tool?  
> **username_0**: Thanks for your welcome. Processing is a tool for developing basic computer graphics programs. I edited my post.  

---

## 1 answers

### Answer by username_2 on 2017-03-07. Score: 1 | Accepted answer

As the [documentation](https://processing.org/reference/camera_.html) describes it, it looks like each group of three parameters is a vector in 3D space. The first three are the position of the “eye”, the next three are the position it’s looking at, and the last three are the “up vector”, i.e. the direction of an arrow pointing out of the top (…sort of—more detail below) of the eye. The positions aren’t related to the size of your display window—the view of your 3D geometry from the camera at that point will fill the display.

In other words, if you have a [box](https://processing.org/reference/box_.html) centered at (0, 0, 0) that’s 1×1×1 units in size, then your camera should be positioned a few units away—say (2, 3, 4)—and looking roughly at the center of the box, i.e. (0, 0, 0). If the box is 100×100×100 instead, then the eye position should be on the same order of magnitude in distance, e.g. (200, 300, 400). The behavior of the up vector is a little more complicated to explain, but leaving it at (0,1,0) is fine for most purposes—it’s mostly there to help you avoid [gimbal lock](https://en.wikipedia.org/wiki/Gimbal_lock).


---

