You are reading Tres v1 docs. Head over for V2 docs.
Skip to content
On this page

UseEnvironment ^1.7.0

useEnvironment composable that automatically sets up a global cubemap, which affects the default scene.environment, and optionally scene.background.

It uses the CubeTextureLoader to load the cubemap


import { useEnvironment } from '@tresjs/cientos'

const texture = await useEnvironment({
  files: [
  path: '',
  encoding: sRGBEncoding,

Then you can use the texture in your scene:

    <TresSphereGeometry />
    <TresMeshStandardMaterial :map="texture" />


filesArrayundefinedArray of 6 urls to images, one for each side of the CubeTexture.
pathbooleanfalsePath to the environment map files.
encodingEncodingsRGBEncoding for an array of files and LinearEncoding for a single textureEncoding of the environment map.
backgroundbooleanfalseIf true the texture will be used as the scene background.
blurnumber0Blur factor between 0 and 1. (only works with three 0.146 and up)
presetstringundefinedPreset environment map.