在现代 DirectX 中制作和加载立方体贴图 (11, post Windows 8.1)

Making and loading cubemaps in modern DirectX (11, post Windows 8.1)

我一直在努力弄清楚如何为我的 Direct3D 11 程序创建和使用立方体贴图。

我被引导相信如果我将我的 6 个图像导出到一个 DDS 文件,我可以简单地使用 CreateDDSTextureFromFile(_device, inName, (ID3D11Resource**)&_texture, &_shaderResourceView) 加载那个文件。但是我找不到似乎应该用于将纹理编译成 DDS 的工具:dxtex.exe。理论上,它附带 DirectX SDK,后者自 Windows 8.1 (http://blogs.msdn.com/b/chuckw/archive/2013/07/01/where-is-the-directx-sdk-2013-edition.aspx) 起已失效。我搜索了我的硬盘驱动器,它不存在(所以大概没有安装在 Visual Studio 旁边——我有 2013 年和 2015 年;我是 运行ning Windows 10,从8.1).

还有一个适用于 Photoshop 的 Nvidia 插件,它已经 3 年没有更新了,当我尝试 运行 它时,我的 Photoshop 副本崩溃了 (CC 2015)。有传言说有 AMD 工具,但我读到它有一段时间没有得到支持,就像 Nvidia 工具一样。

几年前我什至看到了这个 post 他们只是单独加载每个纹理(但似乎你应该使用外部库,因为 CreateXXXTextureFromFile(...)函数期望分配一个资源视图,在我将纹理数据数组设置为单个立方体贴图之前我不需要它。

我的问题是:现在有人打算如何保存和加载立方体贴图?似乎没有任何路线看起来像是偶然的。

如果可能,我更愿意加载单个纹理。

您可以安装旧版 DirectX SDK(2010 年 6 月)以获取旧版 DXTex 工具。请记住,有 known issues with installing the legacy DirectX SDK, that some of the legacy DirectX SDK is not compatible with DirectX 11.1 or later runtimes, and that the DXTex tool does not support all DXGI formats--for details see The DDS File Format Lives.

DirectXTex library project includes a command-line tool texassemble which you can use to build up complex arrays, cubemaps, and volume maps from individual image files into a DDS. You can then process that DDS into other formats (like block compressing it to a BC format) using the texconv command-line 工具。

Making a new version of DXTex using DirectXTex is a backlog item.

您可以使用 DDSTextureLoader 代码在运行时从复杂的 DDS 文件创建资源。