37three.js 环境反射贴图

图片.png

.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;
        }
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,486评论 0 10
  • 峰还路转轮回月, 对影共酌独自愁。 快马加鞭日不遇, 一树海棠寄中秋。
    Y萤火小筑Y阅读 151评论 1 0
  • 今天是5月1日国际劳动节,我想我们在座的每一位都特别的热爱劳动,因为劳动让世上所有的荒芜变成了繁华劳动,让我们的生...
    安然ZCR阅读 227评论 0 3