.envMap : TextureCube
The environment map. Default is null. Note that in order for the material roughness property to correctly blur out the environment map, the shader must have access to mipmaps of the env texture. TextureCubes created with default settings are correctly configured; if adjusting texture parameters manually, ensure minFilter is set to one of the MipMap options, and that mip maps have not been otherwise forcibly disabled.
一个简单的天空盒子。要配置好对于的全景图,我这里以为测试所以用的是同一张照片。
可以将该纹理设置为scene的背景,这样可以方便观察效果。
当用作其他模型的时候只需要设置envMap 就可以了。
material.envMap = textureCube;
//天空盒子
function skyCube() {
var r = "skybox/";
var urls = [ r + "nx.jpg", r + "nx.jpg",
r + "nx.jpg", r + "nx.jpg",
r + "nx.jpg", r + "nx.jpg" ];
textureCube = new THREE.CubeTextureLoader().load( urls );
textureCube.format = THREE.RGBFormat;
textureCube.mapping = THREE.CubeReflectionMapping;
//scene.background = textureCube;
}