# P3D renders edges blurryly

**URL:** <https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151>\
**Category:** Coding Questions\
**Created:** [September 23, 2019, 9:40pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151 "2019-09-23T21:40:27Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![F53](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/f53/32/7118_2.png) [@F53](https://discourse.processing.org/u/F53)\
**Post date:** [September 23, 2019, 9:40pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/1 "2019-09-23T21:40:27Z")

</div>

P2D and the default renderer give me the same crisp not blurry results as each other. But both suffer severe frame loss when pipes are displayed on screen.

P3D, (which I was at the time calling as fullscreen(OPENGL)) never drops a frame below 60 even on Android  
Because of this I have been using P3D for a 2D sketch, not changing anything other than the declaration of the renderer used.

A side effect of using P3D, is that it makes the edges of lines blurry.

What I am trying to do is get rid of the blur introduced by P3D.

![with](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/ee54ac8937085f03896bf7b2a6edc4155014f1e9.png) This is the rendering with P3D enabled  
 ![without](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/2e97103b940e76810e1103333cefa207fcfaf007.png) This is the rendering with the default renderer

The Screenshots dull the effect somehow, it’s much worse in real life  
(tested on multiple monitors)

---

<div class="post-metadata">

**Author:** ![rufsketch1](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@rufsketch1](https://discourse.processing.org/u/rufsketch1)\
**Post date:** [September 23, 2019, 10:31pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/2 "2019-09-23T22:31:45Z")

</div>

Could you post screenshots of the differences between the two for comparison?

---

<div class="post-metadata">

**Author:** ![F53](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/f53/32/7118_2.png) [@F53](https://discourse.processing.org/u/F53)\
**Post date:** [September 25, 2019, 12:39am UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/3 "2019-09-25T00:39:56Z")

</div>

I am recreating Flappy Bird, so the lines are supposed to be very hard.  
While I know openGL is for 3D applications, it handles drawing images so much better than P2D it doubles my framerate when many images are visible.

![with](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/ee54ac8937085f03896bf7b2a6edc4155014f1e9.png) This is the rendering with openGL  
 ![without](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/2e97103b940e76810e1103333cefa207fcfaf007.png) This is the rendering without openGL enabled.

The Screenshots dull the effect somehow, it’s much worse in real life  
(tested on multiple monitors)

---

<div class="post-metadata">

**Author:** ![rufsketch1](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@rufsketch1](https://discourse.processing.org/u/rufsketch1)\
**Post date:** [September 25, 2019, 2:55am UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/4 "2019-09-25T02:55:45Z")

</div>

Possibly try initializing the sketch with

```auto
hint(DISABLE_TEXTURE_MIPMAPS);
 ((PGraphicsOpenGL)g).textureSampling(2);

```

Alternatively, you might try increasing/decreasing the size of whatever surface you’re rendering on by some small amount.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [September 25, 2019, 7:06am UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/5 "2019-09-25T07:06:42Z")

</div>

> [@F53](#):
>
> While I know openGL is for 3D applications, it handles drawing images so much better than P2D

What does that mean? What renderer are you using? P2D is not the default, it’s a 2D OpenGL renderer. P3D is the 3D OpenGL renderer.

---

<div class="post-metadata">

**Author:** ![F53](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/f53/32/7118_2.png) [@F53](https://discourse.processing.org/u/F53)\
**Post date:** [September 25, 2019, 1:44pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/6 "2019-09-25T13:44:04Z")

</div>

I have been using P3D for a 2D sketch, not changing anything other than the declaration of the renderer used.

P2D and the default renderer give me the same crisp not blurry results as each other. But both suffer severe frame loss when pipes are displayed on screen.

P3D, (which I was at the time calling as fullscreen(OPENGL)) never drops a frame below 60 even on Android, but as a side effect, makes the edges of lines blurry.

What I am trying to do is get rid of the blur introduced by P3D.

---

<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:** [September 25, 2019, 2:32pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/7 "2019-09-25T14:32:09Z")

</div>

err, did you try `noSmooth();` ?

Chrisir

---

<div class="post-metadata">

**Author:** ![F53](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/f53/32/7118_2.png) [@F53](https://discourse.processing.org/u/F53)\
**Post date:** [September 25, 2019, 4:09pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/8 "2019-09-25T16:09:04Z")

</div>

Yes, I forgot to write that down

---

<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:** [September 25, 2019, 4:22pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/9 "2019-09-25T16:22:00Z")

</div>

Did you try FX2D ?

> [@FX2D noSmooth(), textureSampling?](https://discourse.processing.org/t/fx2d-nosmooth-texturesampling/4312):
>
> The performance boost from FX2D is really nice, however I can’t seem to be able to turn off the smoothing. noSmooth() doesn’t work, before or after calling size(), in settings() or setup(); It doesn’t appear ((PGraphicsOpenGL)g).textureSampling(2); can be used with FX2D, as PGraphicsFX2D can’t be cast to PGraphicsOpenGL PSurfaceFX has setSmooth but I can’t figure out how to test it.

---

<div class="post-metadata">

**Author:** ![F53](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/f53/32/7118_2.png) [@F53](https://discourse.processing.org/u/F53)\
**Post date:** [September 25, 2019, 4:42pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/10 "2019-09-25T16:42:47Z")

</div>

Interesting, I just did and it gives me the same frames as OPENGL, with the same issue with blurry lines.

I will look into the provided solution in your link.

---

<div class="post-metadata">

**Author:** ![F53](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/f53/32/7118_2.png) [@F53](https://discourse.processing.org/u/F53)\
**Post date:** [September 25, 2019, 5:12pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/11 "2019-09-25T17:12:50Z")

</div>

SOLUTION:  
a. if you are just switching to OPENGL/P3D for FPS, use this solution from rufsketch 1 in your main to get back your hard lines

> [@rufsketch1](#):
>
> hint(DISABLE\_TEXTURE\_MIPMAPS); ((PGraphicsOpenGL)g).textureSampling(2);

b. if you need to have edges not blurry in FX2D,

- I don’t know what to do for you, but you can put research into the link given by Chrisir  
\> [FX2D noSmooth(), textureSampling?](https://discourse.processing.org/t/fx2d-nosmooth-texturesampling/4312)
- You could also look into using a sharpening filter, while I abandoned this idea, this may be helpful, as I got quite a lot of resources together about it:  
\> [I need help with optimization of a basic sharpening algorithm - #5 by F53](https://discourse.processing.org/t/i-need-help-with-optimization-of-a-basic-sharpening-algorithm/14192/5)

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [September 25, 2019, 7:46pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/12 "2019-09-25T19:46:56Z")

</div>

wait a minute?  
YOUR / this / solution was given to you above here by @rufsketch1

> [@P3D renders edges blurryly](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/4):
>
> Possibly try initializing the sketch with hint(DISABLE\_TEXTURE\_MIPMAPS); ((PGraphicsOpenGL)g).textureSampling(2); Alternatively, you might try increasing/decreasing the size of whatever surface you’re rendering on by some small amount.

and you not even say THANK YOU? or LIKE? or Solution?  
to him.

---

<div class="post-metadata">

**Author:** ![rufsketch1](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@rufsketch1](https://discourse.processing.org/u/rufsketch1)\
**Post date:** [September 25, 2019, 9:03pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/13 "2019-09-25T21:03:34Z")

</div>

Haha. No big deal. At least his additional solution also includes info for FX2D.

---

<div class="post-metadata">

**Author:** ![F53](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/f53/32/7118_2.png) [@F53](https://discourse.processing.org/u/F53)\
**Post date:** [September 25, 2019, 9:32pm UTC](https://discourse.processing.org/t/p3d-renders-edges-blurryly/14151/14 "2019-09-25T21:32:05Z")

</div>

I’m sorry, completely forgot to credit you.
