# Objects in P3D look weird (clipping)

**URL:** https://discourse.processing.org/t/objects-in-p3d-look-weird-clipping/30094
**Category:** Coding Questions
**Created:** [May 14, 2021, 5:39am UTC](https://discourse.processing.org/t/objects-in-p3d-look-weird-clipping/30094 "2021-05-14T05:39:12Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Eastern](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/eastern/32/13249_2.png) [@Eastern](https://discourse.processing.org/u/Eastern)
#### Post date: [May 14, 2021, 5:39am UTC](https://discourse.processing.org/t/objects-in-p3d-look-weird-clipping/30094/1 "2021-05-14T05:39:12Z")

</div>

Demonstration video: [HERE](https://www.youtube.com/watch?v=vPrSgFr5IpU)

I was making a first person maze game in P3D and encountered this problem. It seems like when I get too close to an object, I see through it. The camera haven’t even reached the surface of the object.

This is the code I use to control the camera:

```auto
camera(cam.x, cam.y, cam.z, cam.x+direction.x, cam.y+direction.y, cam.z+direction.z, 0, 0, -1);

```

Does anyone know why this happens and how to solve it?

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [May 14, 2021, 5:57am UTC](https://discourse.processing.org/t/objects-in-p3d-look-weird-clipping/30094/2 "2021-05-14T05:57:51Z")

</div>

Call this please

```auto

void avoidClipping() {
  // avoid clipping (at camera): 
  // https : // 
  // forum.processing.org/two/discussion/4128/quick-q-how-close-is-too-close-why-when-do-3d-objects-disappear
  perspective(PI/3.0, (float) width/height, 1, 1000000);
}//func 
//

```

---

<div class="post-metadata">

### Author: ![Eastern](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/eastern/32/13249_2.png) [@Eastern](https://discourse.processing.org/u/Eastern)
#### Post date: [May 14, 2021, 6:05am UTC](https://discourse.processing.org/t/objects-in-p3d-look-weird-clipping/30094/3 "2021-05-14T06:05:19Z")

</div>

Whoa thank you! It works like magic 😃  
I didn’t know Processing clips the scene by default.

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [May 15, 2021, 1:46pm UTC](https://discourse.processing.org/t/objects-in-p3d-look-weird-clipping/30094/4 "2021-05-15T13:46:02Z")

</div>

Some references to clipping:

> [@Drawn object stops moving away?](https://discourse.processing.org/t/drawn-object-stops-moving-away/17493/3):
>
> Hello, Welcome to the forum. You are experiencing clipping. The Perspective section discusses this: [https://processing.org/tutorials/p3d/](https://processing.org/tutorials/p3d/) And you can adjust the z-far parameter using perspective(): [https://processing.org/reference/perspective\_.html](https://processing.org/reference/perspective_.html)

And more:  
_[clipping site:processing.org - Google Search](https://www.google.com/search?as_sitesearch=processing.org&as_q=clipping)_

`:)`

---

<div class="post-metadata">

### Author: ![Eastern](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/eastern/32/13249_2.png) [@Eastern](https://discourse.processing.org/u/Eastern)
#### Post date: [May 17, 2021, 6:59am UTC](https://discourse.processing.org/t/objects-in-p3d-look-weird-clipping/30094/5 "2021-05-17T06:59:14Z")

</div>

Thank you for your information!
