three.js - 具有线性过滤的等距矩形地图渲染中的闪电伪影
问题描述
在使用magFilter = LinearFiltering
. 背景是一张低分辨率的等距矩形地图,图像中带有极度模糊。
代码片段:
new RGBELoader()
.setDataType(THREE.UnsignedByteType)
.load(this.background, (hdrtexture) => {
hdrtexture.mapping = THREE.EquirectangularReflectionMapping;
hdrtexture.encoding = THREE.RGBEEncoding;
hdrtexture.name = this.background;
hdrtexture.magFilter = THREE.LinearFilter;
hdrtexture.needsUpdate = true;
// If the gui is set to show the env map, set the background to be the new map
if (this.params.showMap) {
this.scene.background = hdrtexture;
}
});
如果没有线性过滤,我会在两极看到最近的过滤器问题(块状像素化),因此我要应用线性过滤器。
去除这些闪电伪影的最佳方法是什么?转换为立方体贴图?
解决方案
将 equirectangular 贴图转换为立方体贴图可以解决伪影问题。
片段:
new RGBELoader()
.setDataType(THREE.UnsignedByteType)
.load(this.background, (hdrtexture) => {
hdrtexture.mapping = THREE.EquirectangularReflectionMapping;
hdrtexture.encoding = THREE.RGBEEncoding;
hdrtexture.name = this.background;
hdrtexture.magFilter = THREE.LinearFilter;
hdrtexture.needsUpdate = true;
const pmrem = new THREE.PMREMGenerator(this.renderer);
const envMap = pmrem.fromEquirectangular(hdrtexture).texture;
// If the gui is set to show the env map, set the background to be the new map
if (this.params.showMap) {
this.scene.background = envMap;
}
});
推荐阅读
- stl - 如何获得 j3d 加载器?
- roomle - 零件颜色无法从已配置产品中穿透
- python - 如何使用 Python 和 Amazon Comprehend 分析包含多个注释的文件?
- java - 如何使用 AWS S3 PRESIGNED URL 作为 HTML 上传?
- c# - 更改过滤的 DataGridView 中单元格的值
- react-native - React Native - 带阴影的按钮
- nginx - 一个上游下的上游http和https协议
- css - 语义 UI 调整分隔线部分的大小?
- flutter - Flutter 构建 APK 失败
- json - 通过 Postman 发送请求时出现 org.mozilla.javascript.Undefined@7dee967 错误