# Avoid getting blurriness objects at a certain distance

**URL:** <https://forum.babylonjs.com/t/avoid-getting-blurriness-objects-at-a-certain-distance/39385>\
**Category:** Questions\
**Created:** [March 27, 2023, 6:37pm UTC](https://forum.babylonjs.com/t/avoid-getting-blurriness-objects-at-a-certain-distance/39385 "2023-03-27T18:37:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rangerz132](https://avatars.discourse-cdn.com/v4/letter/r/cc9497/32.png) [@Rangerz132](https://forum.babylonjs.com/u/Rangerz132)\
**Post date:** [March 27, 2023, 6:37pm UTC](https://forum.babylonjs.com/t/avoid-getting-blurriness-objects-at-a-certain-distance/39385/1 "2023-03-27T18:37:59Z")

</div>

First of all, my question might sound stupid (and I apologize for that)…

I’m currently doing a pool game (which is not the first time and I’m posting about it 😅 here in the forum) and I’m facing an issue about the visual quality. My game is a mix between 2d and 3d. The camera is above the table and it takes all the scene view.

The game is meant to be played on mobile. The resolution of the canvas is 390 x 844. In order to see the entire table, the camera is positioned like this :

```auto
this.camera = new UniversalCamera('sceneCamera', new Vector3(0, 40, 0), this.scene)
this.camera.setTarget(new Vector3(0, 0, 0))

```

The table and the balls are positioned at around 0 in the Y axe. The issue is that even if all my textures are high quality, the entire game is kind of blurry. However, when I approach the camera, the elements because much clearer (which of course, make sense…). So basically, I’m kind of stocked because I need to see everything but in order to do that, I need to put my camera a bit far.

The discussion is opened if you have any reflextion/suggestion to have better quality.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 27, 2023, 8:35pm UTC](https://forum.babylonjs.com/t/avoid-getting-blurriness-objects-at-a-certain-distance/39385/2 "2023-03-27T20:35:12Z")

</div>

You probably need to use engine.setHardwareScalingLevel(x) where x will be the inverse of the dpi you want let s say 0.5 if you want a 2x DPI

---

<div class="post-metadata">

**Author:** ![Rangerz132](https://avatars.discourse-cdn.com/v4/letter/r/cc9497/32.png) [@Rangerz132](https://forum.babylonjs.com/u/Rangerz132)\
**Post date:** [March 27, 2023, 9:01pm UTC](https://forum.babylonjs.com/t/avoid-getting-blurriness-objects-at-a-certain-distance/39385/3 "2023-03-27T21:01:55Z")

</div>

Is there a way to achieve that result without doing engine.setHardwareScalingLevel(x) because it increase the canvas size as well. I would like to stay the same size.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 27, 2023, 10:52pm UTC](https://forum.babylonjs.com/t/avoid-getting-blurriness-objects-at-a-certain-distance/39385/4 "2023-03-27T22:52:57Z")

</div>

It is possible, you need to apply css to fix the visible size and then setHardwareScalingLevel with change the width/height to ensure the pixel density is respected.

---

<div class="post-metadata">

**Author:** ![Rangerz132](https://avatars.discourse-cdn.com/v4/letter/r/cc9497/32.png) [@Rangerz132](https://forum.babylonjs.com/u/Rangerz132)\
**Post date:** [March 29, 2023, 6:04pm UTC](https://forum.babylonjs.com/t/avoid-getting-blurriness-objects-at-a-certain-distance/39385/5 "2023-03-29T18:04:25Z")

</div>

What do you mean by that?

At the moment, the canvas is created into a div which take all the screen view of my device. Then I put `this.engine.setHardwareScalingLevel(0.5)` to have a better resolution but the canvas is now way way too big. I don’t really have any access to the css because the game is on a tier platform.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 29, 2023, 7:57pm UTC](https://forum.babylonjs.com/t/avoid-getting-blurriness-objects-at-a-certain-distance/39385/6 "2023-03-29T19:57:24Z")

</div>

your css should correct that basically the css size need to fill the container and the actual canvas size will be twice as big.

You can see an example in the playground [Babylon.js Playground](https://playground.babylonjs.com/#E83FYA)
