# Create environment after PBRMaterial, needs update on PBRMaterial reflection settings?

**URL:** <https://forum.babylonjs.com/t/create-environment-after-pbrmaterial-needs-update-on-pbrmaterial-reflection-settings/27374>\
**Category:** Questions\
**Created:** [February 4, 2022, 6:30pm UTC](https://forum.babylonjs.com/t/create-environment-after-pbrmaterial-needs-update-on-pbrmaterial-reflection-settings/27374 "2022-02-04T18:30:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomasaull](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thomasaull/32/40115_2.png) [@thomasaull](https://forum.babylonjs.com/u/thomasaull)\
**Post date:** [February 4, 2022, 6:30pm UTC](https://forum.babylonjs.com/t/create-environment-after-pbrmaterial-needs-update-on-pbrmaterial-reflection-settings/27374/1 "2022-02-04T18:30:23Z")

</div>

I’m having a case, where I might need to load an environment skybox after some models with PBR Material applied to them have already been loaded and added to the scene. In this case the reflection of the materials is black.

I guess I need to update some material settings by myself in this case, but I cant figure out which and how. Maybe anyone has a pointer?

Example PG: [Babylon.js Playground](https://playground.babylonjs.com/#NRW5ZX)  
Changing the value in `setTimeout` to `0` makes the reflection texture appear

---

<div class="post-metadata">

**Author:** ![syntheticmagus](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/syntheticmagus/32/395_2.png) [@syntheticmagus](https://forum.babylonjs.com/u/syntheticmagus)\
**Post date:** [February 4, 2022, 6:52pm UTC](https://forum.babylonjs.com/t/create-environment-after-pbrmaterial-needs-update-on-pbrmaterial-reflection-settings/27374/2 "2022-02-04T18:52:07Z")

</div>

Hi thomasaull,

In the Playground you linked, I see the reflection as soon as the default environment is created even if I turn `setTimeout` up to 1000. However, if you need to set the reflection texture manually, I believe you can just assign the texture you want to the `PBRMaterial`'s [`reflectionTexture`](https://doc.babylonjs.com/typedoc/classes/babylon.pbrmaterial#reflectiontexture) property. Does that work for your scenario?

---

<div class="post-metadata">

**Author:** ![thomasaull](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thomasaull/32/40115_2.png) [@thomasaull](https://forum.babylonjs.com/u/thomasaull)\
**Post date:** [February 4, 2022, 6:57pm UTC](https://forum.babylonjs.com/t/create-environment-after-pbrmaterial-needs-update-on-pbrmaterial-reflection-settings/27374/3 "2022-02-04T18:57:56Z")

</div>

Hmm I set the timeout to 5s and tried again, in v4 it does work indeed in v5 it does not (I’m using Firefox 94 if this is relevant).

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

In my project I actually tried to set:

```auto
material.reflectionTexture = scene.environmentTexture

```

but this didn’t help either. It seems like this is a bug in v5 then?

---

<div class="post-metadata">

**Author:** ![syntheticmagus](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/syntheticmagus/32/395_2.png) [@syntheticmagus](https://forum.babylonjs.com/u/syntheticmagus)\
**Post date:** [February 4, 2022, 7:03pm UTC](https://forum.babylonjs.com/t/create-environment-after-pbrmaterial-needs-update-on-pbrmaterial-reflection-settings/27374/4 "2022-02-04T19:03:46Z")

</div>

Interesting. It works in both v4 and v5 for me on Chromium-based Edge, but I repro exactly what you described in Firefox. @sebavan, do you know if this is a bug?

---

<div class="post-metadata">

**Author:** ![thomasaull](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thomasaull/32/40115_2.png) [@thomasaull](https://forum.babylonjs.com/u/thomasaull)\
**Post date:** [February 4, 2022, 7:05pm UTC](https://forum.babylonjs.com/t/create-environment-after-pbrmaterial-needs-update-on-pbrmaterial-reflection-settings/27374/5 "2022-02-04T19:05:34Z")

</div>

It actually does not work for me in Chrome 98 for v5 (but does for v4)

---

<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:** [February 5, 2022, 12:48am UTC](https://forum.babylonjs.com/t/create-environment-after-pbrmaterial-needs-update-on-pbrmaterial-reflection-settings/27374/6 "2022-02-05T00:48:13Z")

</div>

Fix is in PR [https://github.com/BabylonJS/Babylon.js/pull/11921](https://github.com/BabylonJS/Babylon.js/pull/11921)

cc @Deltakosh

---

<div class="post-metadata">

**Author:** ![thomasaull](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thomasaull/32/40115_2.png) [@thomasaull](https://forum.babylonjs.com/u/thomasaull)\
**Post date:** [February 5, 2022, 10:48am UTC](https://forum.babylonjs.com/t/create-environment-after-pbrmaterial-needs-update-on-pbrmaterial-reflection-settings/27374/7 "2022-02-05T10:48:19Z")

</div>

Bugreport to Bugfix in 6 hours, thats awesome 🙂 Thanks @sebavan I just tested with the latest `/master` and it seems to work 🙂
