How to stamp on a mesh the texture in BG (skybox)?

Hello,

I don’t know if I will be clear but what I’m trying to do is first:

Having a skybox and in the middle of the scene a cube. your camera is in front of the cube, so the front mesh of the cube will take what you see behind the cube, so the part of the skybox.

Then what I want is to keep this texture (as a screenshot) into the face of the cube and when you rotate around the cube the texture on the face is what we saw at the beginning.

Technically I want a little bit like this PG: https://www.babylonjs-playground.com/#UU7RQ#3
But I want to see what is behind the cube and keep it on the face I don’t want to see what it’s reflecting.

Thanks guys!

A suggestion. You can see in this PG https://www.babylonjs-playground.com/#UU7RQ#368 that the texture on the cube uses a different skybox than for the sky. To achieve what you need

  1. take the files from skybox, skybox_px.jpg, skybox_nx.jpg, skybox_py.jpg, skybox_ny.jpg, skybox_pz.jpg or skybox_nz.jpg

  2. create a newSkybox where
    newSkybox_nx.jpg = skybox_px.jpg,
    newSkybox_px.jpg = skybox_nx.jpg,
    newSkybox_ny.jpg = skybox_py.jpg,
    newSkybox_py.jpg = skybox_ny.jpg,
    newSkybox_nz.jpg = skybox_pz.jpg,
    newSkybox_pz.jpg = skybox_nz.jpg,

  3. Use newSkybox for cube.

1 Like

Oh it’s a good idea but the idea behind is in the futur to use sophisticated meshes and apply the same thing.

So I guess that it’s not possible to add a skybox as texture to weird meshes like the crane model ?

As usual the best way is to try it and see https://www.babylonjs-playground.com/#UU7RQ#369

It will either work or not! :slightly_smiling_face:

2 Likes

“Then what I want is to keep this texture (as a screenshot) into the face of the cube and when you rotate around the cube the texture on the face is what we saw at the beginning.”

Tell the reflection probe to only update once.

UPDATE

My bad I did not realize you were using the reflection material not a probe, It should work on a complex mesh then, its just on the GPU side so it should be no issue.

1 Like

thanks JohnK! And yes that’s true I will use your PG to make some tests.

What I want is for example on this image we can’t see the knot because the texture will be exactly match what you see behind so in that case the sun.
But when you rotate around it, you will begin to see the probe because the texture won’t match anymore the background because you rotated.

So I will try to do something with you PG! :slight_smile: