Capítulo 802 de 859
Ways to give a scene a background, from a simple CSS image behind the canvas up to true 3D skyboxes and environment maps drawn by three.js itself.
scene.background = texture: has three.js draw the background itself, so post-processing sees it too.THREE.BackSide, with a horizon-like texture on each face.CubeTextureLoader: loads a 6-image cubemap (one per cube face) and can be assigned directly to scene.background.EquirectangularReflectionMapping, an alternative to a 6-image cubemap.const loader = new THREE.TextureLoader();
const texture = loader.load(
"resources/images/equirectangularmaps/tears_of_steel_bridge_2k.jpg",
() => {
texture.mapping = THREE.EquirectangularReflectionMapping;
texture.colorSpace = THREE.SRGBColorSpace;
scene.background = texture;
}
);
scene.background makes three.js draw it, so post-processing effects apply to it too.THREE.BackSide.CubeTextureLoader (6 images) and equirectangular images (1 panorama) are the two common ways to source a skybox/environment texture.alpha: true if you rely on a CSS background showing through.PerspectiveCamera is enough for a skybox; no OrthographicCamera needed.