Skip to content

Instantly share code, notes, and snippets.

@BABAK0T0
Created March 1, 2021 22:33
Show Gist options
  • Save BABAK0T0/bebfe378476ea19bb4bcceb2a6dbc90c to your computer and use it in GitHub Desktop.
Save BABAK0T0/bebfe378476ea19bb4bcceb2a6dbc90c to your computer and use it in GitHub Desktop.
/**
* The environment map is like an image of what's surrounding the scene.
* You can use it to add reflection or refraction to your objects.
* It can also be used as lighting information.
**/
const material = new THREE.MeshStandardMaterial();
material.metalness = 0.7;
material.roughness = 0.2;
const cubeTextureLoader = new THREE.CubeTextureLoader();
const environmentMapTexture = cubeTextureLoader.load([
'/textures/environmentMaps/0/px.jpg',
'/textures/environmentMaps/0/nx.jpg',
'/textures/environmentMaps/0/py.jpg',
'/textures/environmentMaps/0/ny.jpg',
'/textures/environmentMaps/0/pz.jpg',
'/textures/environmentMaps/0/nz.jpg'
]);
material.envMap = environmentMapTexture;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment