# Enter webXR, the effect is different

**URL:** <https://forum.babylonjs.com/t/enter-webxr-the-effect-is-different/42951>\
**Category:** Questions\
**Tags:** webxr\
**Created:** [August 3, 2023, 1:54am UTC](https://forum.babylonjs.com/t/enter-webxr-the-effect-is-different/42951 "2023-08-03T01:54:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lxq100](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lxq100/32/43689_2.png) [@lxq100](https://forum.babylonjs.com/u/lxq100)\
**Post date:** [August 3, 2023, 1:54am UTC](https://forum.babylonjs.com/t/enter-webxr-the-effect-is-different/42951/1 "2023-08-03T01:54:17Z")

</div>

I modified the engine parameter in PG ([https://playground.babylonjs.com/#JA1ND3#863](https://playground.babylonjs.com/#JA1ND3#863))

```auto
engine.setHardwareScalingLevel(20);

```

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

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/d/1/d13be096f5deb5ba5d7e946173108e8ad58d44f0.jpeg)  
After entering xr, the effect is different from the initial effect

---

<div class="post-metadata">

**Author:** ![lxq100](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lxq100/32/43689_2.png) [@lxq100](https://forum.babylonjs.com/u/lxq100)\
**Post date:** [August 3, 2023, 1:59am UTC](https://forum.babylonjs.com/t/enter-webxr-the-effect-is-different/42951/2 "2023-08-03T01:59:54Z")

</div>

I add codes.[PG:[https://playground.babylonjs.com/#JA1ND3#861](https://playground.babylonjs.com/#JA1ND3#861)]

```auto
let defaultPipeline = new BABYLON.DefaultRenderingPipeline(
                "DefaultRenderingPipeline",
                true, // is HDR?
                scene,
                scene.cameras
            );

            //抗锯齿
            defaultPipeline.samples = 8;
            defaultPipeline.fxaaEnabled = true;

```

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/a/ea0909b736e0e61110681ad43c407c8a20c2a807.jpeg)

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/d/6dc3d6a00290772e7b2aac9effce8ff2b1844a9e.jpeg)  
After entering xr, the effect is different from the initial effect

---

<div class="post-metadata">

**Author:** ![noname0310](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/noname0310/32/27103_2.png) [@noname0310](https://forum.babylonjs.com/u/noname0310)\
**Post date:** [August 3, 2023, 5:25am UTC](https://forum.babylonjs.com/t/enter-webxr-the-effect-is-different/42951/3 "2023-08-03T05:25:42Z")

</div>

> [@With pipeline enabled, console shows error when entering XR](https://forum.babylonjs.com/t/with-pipeline-enabled-console-shows-error-when-entering-xr/42493):
>
> It doesn’t crash though, but it just has this error when the pipeline adding new cameras while entering XR mode. How to prevent it?

It appears to be an issue like this.

After entering webXR, try add camera to the pipeline

```typescript
scene.createDefaultXRExperienceAsync({
    floorMeshes: [scene.getMeshByName("Sols")]
}).then((xr) => {
    xr.baseExperience.sessionManager.onXRFrameObservable.addOnce(() => {
        defaultPipeline.addCamera(xr.baseExperience.camera)
    });
});

```

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [August 4, 2023, 12:13am UTC](https://forum.babylonjs.com/t/enter-webxr-the-effect-is-different/42951/4 "2023-08-04T00:13:24Z")

</div>

cc @RaananW

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 1, 2023, 11:34am UTC](https://forum.babylonjs.com/t/enter-webxr-the-effect-is-different/42951/5 "2023-09-01T11:34:02Z")

</div>



---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [September 4, 2023, 10:32am UTC](https://forum.babylonjs.com/t/enter-webxr-the-effect-is-different/42951/6 "2023-09-04T10:32:08Z")

</div>

Not sure why I am assigned, the last answer was correct 🙂  
The XR camera is different than the default scene came5ra, and it needs to be used in the pipeline in order for the XR camera(s) to render the scene correctly. There is probably no way to automate that - the cameras don’t keep a list of rendering pipelines or post processes they are included it, so we can’t “copy” the assignments from the original camera. Also, you might not want to do that automatically.

Small note regarding hardware scaling rate - XR doesn’t use your canvas to render. If you want to emulate that in XR you can pass a different value to the `framebufferScaleFactor ([XRWebGLLayerInit | Babylon.js Documentation](https://doc.babylonjs.com/typedoc/interfaces/XRWebGLLayerInit)) when initializing the output canvas options in the XR experience helper

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [September 4, 2023, 10:32am UTC](https://forum.babylonjs.com/t/enter-webxr-the-effect-is-different/42951/7 "2023-09-04T10:32:10Z")

</div>


