Is there a way to get the cube image array from the scene.backgroud?

Have you tried scene.background.image?

Thanks a lot for your help, will be very useful.

I am trying this…

**I made an app with an equirectangular image as environment using it as texture in a sphere that works as scenario, I was trying to use the image as scene background but it seems that only accept cube texture. I tried EquirectangularToCubemap to convert my image to cube image but It doesn’t work. this file returns camera.renderTarget.texture, I tried to apply it to scene background and didn’t work,

someone knows how to do this? ( convert equirectangular images to cube image to be used as scene background )

Thanks in advance…

No need to use an external project. There is THREE.CubemapGenerator. Try it with .fromEquirectangular() and see how it goes. The method returns a render target (not a camera). Apply it to the background like so:

scene.background = renderTarget;

Hi, sorry for bother you again, I have been trying to make it work but still having problems.

I tried something like; var tx=new THREE.CubemapGenerator() and give me an error …

How can I apply this on this example?
I’m trying to put the equirectangular to the scene background to the scene background…

Try it like so:

After including the external example file into your app, execute the following code as soon as your equirectangular image has been loaded.

var generator = new THREE.CubemapGenerator( renderer );
var renderTarget = generator.fromEquirectangular( texture, { resolution: 256 } ); // the resolution depends on your image
scene.background = renderTarget;

Just great, thanks…

is new THREE.CubemapGenerator(); deprecated now days? bacause when i applied it with my code i got an error and it says Uncaught TypeError: THREE.CubemapGenerator is not a constructor

Yes, CubemapGenerator does not exist anymore. With the current release r124, you can directly assign an equirectangular texture to Scene.background.

1 Like

great I just added .mapping property on my code and add THREE.EquirectangularReflectionMapping and it looks like google map street view, thanks.

1 Like