【问题标题】:Load a cubemap from DDS cubemap file with three.js使用 three.js 从 DDS 立方体贴图文件加载立方体贴图
【发布时间】:2016-12-17 09:38:19
【问题描述】:

如何在 three.js 中使用 DDS 立方体贴图作为场景背景(或天空盒)?目前,我将立方体贴图 DDS 分解为六个图像并使用 THREE.CubeTextureLoader() 加载它们。可能存在其他简单的方法吗?像这样:

var skybox = new THREE.TextureLoader().load('/files/skybox.dds');
scene.background = skybox;

【问题讨论】:

标签: javascript 3d three.js


【解决方案1】:

试试 DDSLoader

var loader = new THREE.DDSLoader();
var skybox = loader.load( '/files/skybox.dds' );
scene.background = skybox;

DDSLoader 类必须添加到您的应用程序中:https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/DDSLoader.js

【讨论】:

  • Cubemap 纹理使用 DDSLoader 正常加载:但是如果尝试将它们用作 scene.background 则会发生错误:TypeError: mipmaps is undefined in three.js:17959:22
  • 确保图像每边的像素长度是 2 的幂。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-05-06
  • 2010-10-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-12-15
相关资源
最近更新 更多