# Chromatic aberrations doesn't work when created before cameras

**URL:** <https://forum.babylonjs.com/t/chromatic-aberrations-doesnt-work-when-created-before-cameras/56651>\
**Category:** Bugs\
**Tags:** pipeline\
**Created:** [February 18, 2025, 11:22pm UTC](https://forum.babylonjs.com/t/chromatic-aberrations-doesnt-work-when-created-before-cameras/56651 "2025-02-18T23:22:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TooCalm](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/toocalm/32/3301_2.png) [@TooCalm](https://forum.babylonjs.com/u/TooCalm)\
**Post date:** [February 18, 2025, 11:22pm UTC](https://forum.babylonjs.com/t/chromatic-aberrations-doesnt-work-when-created-before-cameras/56651/1 "2025-02-18T23:22:54Z")

</div>

Hey guys, found an issue with chromatic aberrations from default pipeline

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

chromatic aberrations doesn’t work when pipeline was created BEFORE cameras. I assume that  
when pipeline is created scene.cameras parameter is empty and chromatic aberrations don’t see cameras even if they are added after

spent a lot of time to understand why everything is working except aberrations, so i think it should be fixed to prevent losing time from others

btw depthOfField throws exception when there is no cameras

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

I think chromatic aberrations should throw exception too

Thanks

---

<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:** [February 19, 2025, 12:08am UTC](https://forum.babylonjs.com/t/chromatic-aberrations-doesnt-work-when-created-before-cameras/56651/2 "2025-02-19T00:08:24Z")

</div>

it is a good point. Wanna do a PR to get that in ?

---

<div class="post-metadata">

**Author:** ![TooCalm](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/toocalm/32/3301_2.png) [@TooCalm](https://forum.babylonjs.com/u/TooCalm)\
**Post date:** [February 19, 2025, 12:16am UTC](https://forum.babylonjs.com/t/chromatic-aberrations-doesnt-work-when-created-before-cameras/56651/3 "2025-02-19T00:16:08Z")

</div>

Sure, but it will take time:)

---

<div class="post-metadata">

**Author:** ![TooCalm](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/toocalm/32/3301_2.png) [@TooCalm](https://forum.babylonjs.com/u/TooCalm)\
**Post date:** [February 22, 2025, 4:42am UTC](https://forum.babylonjs.com/t/chromatic-aberrations-doesnt-work-when-created-before-cameras/56651/4 "2025-02-22T04:42:04Z")

</div>

I investigated problem more precisely

During investigation i found that there is not only chromatic aberrations doesn’t work without cameras but also grain, bloom (and maybe others)  
It’s strange that those effects are created without cameras in pipeline constructor  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/optimized/3X/9/1/91ae1cb5c03e8c242fe8944e4201599de8ca0505_2_690x20.png)

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/9/a904f4ca82d126d40823baca11506a5ca6e4aebb.png)

as i understand cameras are attached during  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/2/a2b77214bc916bf102480e19fb70bcff751d9cfc.png)  
method

So i think we need to throw exception during constructor of default pipeline (and i think other pipelines too) where cameras initialized from parameter or scene.cameras  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/4/7479a69d2a28ea81dd1b7f1497e7aee710545a7e.png)  
i think after this line we chould check that cameras is not empty  
if (!this.cameras.length) {  
// eslint-disable-next-line no-throw-literal  
throw “No camera available for default pipeline effects”;  
}

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/8/a8d3e556977ac2986ce644ef9dbe121ef79807ca.png)

the problem that i’m not sure this check should be in other pipelines  
for example for SSAO2RenderingPipeline cameras also optional  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/optimized/3X/a/d/ad8f7b501bc79b447de9cb261fa83495fcaee740_2_690x27.png)  
it doesn’t have check for scene.cameras and just tries to use cameras  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/optimized/3X/b/f/bf3ce13c3213fda075f6001d077e45535d279486_2_690x52.png)  
i tried to use this pipeline and it looks like it doesn’t work regardless of cameras exist or not:)

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

as i understand it should have some predefined posteffects but there is no changes in scene

so i think someone more qualified should check other pipelines and ensure that this cameras check should be there or not

Thanks
