.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.
一個簡單的天空盒子矿瘦。要配置好對于的全景圖,我這里以為測試所以用的是同一張照片愿卒。
可以將該紋理設(shè)置為scene的背景缚去,這樣可以方便觀察效果。
當(dāng)用作其他模型的時候只需要設(shè)置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;
}