Box texture as environment for PBR Material

Hi there,
consider this PG: https://playground.babylonjs.com/#1MB0Y0#14
I’d like to use as environment for the PBR material the same texture used for the container box: in other word i want that the box walls has the texture used then as reflection texture for PBR material. As you can see if i apply the same hdr texture to the box something weird happen (it uses the dynamic texture :roll_eyes:) Is it possible and if yes what the best practice to do that?

Thank’s

This is all because of this line:

matHd.baseTexture = hdrTexture2;

you are trying to put a cube texture in a channel who can only accept a 2d one so basically you simply need to comment it :slight_smile: and set the base color similar to your text one https://playground.babylonjs.com/#1MB0Y0#23

2 Likes

Ok, i thought was something like that becouse commenting that line solves the texture problem, but the real question is: is it possible to apply a texture to the box (for example from 6 images) and make the box behave like an environment background? My goal is to make a box representing a room and all PBR materials inside the box (the room) reflects the walls. Is it possible?
Thank’s

Would the effect you’re trying to achieve be this?

There I reduced the roughness to zero so the material acts like a mirror.

1 Like

Yes, but i want that the reflection texture is that of the box not of the background environment. Consider the box as a room inside the scene: all the PBR material inside the box must reflect only the walls. In the image you’ve posted i guess you have hidden the box and the reflection comes from the environment.

oh i see, for this you would need to use a reflection probe: Reflection Probes | Babylon.js Documentation

Thank you, but i need to pay attention to the performance i guess :slight_smile:

1 Like