# Misalign of orthogonal camera and SSAO post process image when changing frustum

**URL:** <https://forum.babylonjs.com/t/misalign-of-orthogonal-camera-and-ssao-post-process-image-when-changing-frustum/59820>\
**Category:** Questions\
**Tags:** camera, ssao2\
**Created:** [July 30, 2025, 1:25pm UTC](https://forum.babylonjs.com/t/misalign-of-orthogonal-camera-and-ssao-post-process-image-when-changing-frustum/59820 "2025-07-30T13:25:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eisenbert](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@Eisenbert](https://forum.babylonjs.com/u/Eisenbert)\
**Post date:** [July 30, 2025, 1:25pm UTC](https://forum.babylonjs.com/t/misalign-of-orthogonal-camera-and-ssao-post-process-image-when-changing-frustum/59820/1 "2025-07-30T13:25:12Z")

</div>

Here is the playground link: [Babylon.js Playground](https://playground.babylonjs.com/#FCPCCZ)

I need to change orthoLeft, orthoRight etc. in my project in order to zoom and pan the camera. What I am missing? Is there a manual align method that I need to call after frustum change?

Second problem: SSAO looks messed up if I apply a negative minZ for the camera.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/6/566ca7d171ba0275a5bda5329cb41421ddb31c5e.jpeg)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [July 30, 2025, 5:16pm UTC](https://forum.babylonjs.com/t/misalign-of-orthogonal-camera-and-ssao-post-process-image-when-changing-frustum/59820/2 "2025-07-30T17:16:22Z")

</div>

cc @Cedric

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 30, 2025, 5:23pm UTC](https://forum.babylonjs.com/t/misalign-of-orthogonal-camera-and-ssao-post-process-image-when-changing-frustum/59820/3 "2025-07-30T17:23:41Z")

</div>

You need to change the values depending on what you want to do. for zooming in:

> **[Babylon.js Playground](https://playground.babylonjs.com/#FCPCCZ%231)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

I’m not sure to understand what you need with the method to call after frustum change. Maybe this will have some interests to you :

> **[Babylon.js docs](https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#framing-behavior)**

---

<div class="post-metadata">

**Author:** ![Eisenbert](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@Eisenbert](https://forum.babylonjs.com/u/Eisenbert)\
**Post date:** [July 30, 2025, 7:06pm UTC](https://forum.babylonjs.com/t/misalign-of-orthogonal-camera-and-ssao-post-process-image-when-changing-frustum/59820/4 "2025-07-30T19:06:39Z")

</div>

Thanks for your answer. I have an iso-3d-SimCity-like scene with “zoom to pointer” functionality like this: [https://playground.babylonjs.com/#FCPCCZ#3](https://playground.babylonjs.com/#FCPCCZ#3)

Zooming also involves also shifting the frustum. Maybe it is an odd way but it worked for me until I introduced ambient occlusion. From your example I get that **uniformly** increasing/decreasing the frustum to all extends (center zoom) does work with SSAO. I guess I can implement panning by changing camera.position and use this in combination with uniformed frustum change for the same results…

Any hints regarding the problem with negative camera.minZ? I can’t get good results for SSAO with this values: [https://playground.babylonjs.com/#FCPCCZ#5](https://playground.babylonjs.com/#FCPCCZ#6)

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 31, 2025, 8:12am UTC](https://forum.babylonjs.com/t/misalign-of-orthogonal-camera-and-ssao-post-process-image-when-changing-frustum/59820/5 "2025-07-31T08:12:11Z")

</div>

I have no good explanation for that, sorry. Maybe @sebavan will have some ideas when he gets back from vacation

---

<div class="post-metadata">

**Author:** ![Eisenbert](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@Eisenbert](https://forum.babylonjs.com/u/Eisenbert)\
**Post date:** [August 11, 2025, 11:50am UTC](https://forum.babylonjs.com/t/misalign-of-orthogonal-camera-and-ssao-post-process-image-when-changing-frustum/59820/6 "2025-08-11T11:50:37Z")

</div>

Any news regarding negative camera.minZ in combination with SSAO? Is it possible to prevent clipping of the ortho cam without negative minZ as a workaround?

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 1, 2025, 9:41am UTC](https://forum.babylonjs.com/t/misalign-of-orthogonal-camera-and-ssao-post-process-image-when-changing-frustum/59820/7 "2025-09-01T09:41:40Z")

</div>

Sorry for the delay. Let me add @Evgeni_Popov who knows more than me.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [September 1, 2025, 1:02pm UTC](https://forum.babylonjs.com/t/misalign-of-orthogonal-camera-and-ssao-post-process-image-when-changing-frustum/59820/8 "2025-09-01T13:02:49Z")

</div>

Negative values for **minZ** are not supported, as **minZ** corresponds to the distance from the near clipping plane. Only values greater than 0 are supported.

Regarding your issue, this is due to the fact that off-center frusta were not supported in SSAO. This PR will fix it:

> <https://github.com/BabylonJS/Babylon.js/pull/17096>
>
> See https://forum.babylonjs.com/t/misalign-of-orthogonal-camera-and-ssao-post-pr…ocess-image-when-changing-frustum/59820/6
