我已在 Three.js 场景中将 x 轴设置为向上轴。现在所有环境贴图 (hdr) 的方向都是错误的。我该如何修复?我尝试旋转 hdr 文件,但这不起作用。
this.pmremGenerator = new THREE.PMREMGenerator(renderer as any);
new RGBELoader().setDataType(THREE.UnsignedByteType).setPath('assets/').load('adams_place_bridge_1k.hdr', (texture) => {
texture.mapping = THREE.EquirectangularReflectionMapping;
var envMap = this.pmremGenerator.fromEquirectangular(texture).texture;
scene.background = envMap;
scene.environment = envMap;
texture.dispose();
});
有立方体贴图的解决方法吗?
因为
r162
可以旋转场景的背景和环境。为此,您可以配置Scene.backgroundRotation和Scene.environmentRotation。两者都是欧拉类型并表示以弧度为单位的旋转。下面的官方例子演示了这个功能:
https://trijs.org/examples/webgl_materials_envmaps
旁注:
PMREMGenerator
在最新版本中不再需要使用应用程序级别。PMREMGenerator
如果环境贴图与 PBR 材质一起使用,或者如果您通过Scene.backgroundBlurriness配置模糊背景,则环境贴图会在内部进行预处理。