-1

I need to set static background image on scene with image formats like .png, .jpg, etc. May be someone know how to do it? I tryed lot of variants, mut still can't fiend correct solution.

1 Answers1

0

Assuming that your background is a skybox with 6 separate files, you can load images with CubeTextureLoader and set it as scene.background:

const path = 'textures/cube/your-skybox-directory/';
const format = '.jpg';
const urls = [
    path + 'px' + format, path + 'nx' + format,
    path + 'py' + format, path + 'ny' + format,
    path + 'pz' + format, path + 'nz' + format
];

const reflectionCube = new THREE.CubeTextureLoader().load(urls);

scene = new THREE.Scene();
scene.background = reflectionCube;

Based on examples from: https://threejs.org/examples/?q=cube#webgl_materials_cubemap

MTP
  • 161
  • 11