如何构建带有纹理和 MeshConvert.exe 的 SdkMesh?

How do I build an SdkMesh with Textures and MeshConvert.exe?

我需要构建一个类似于 DirectX SDK 附带的 Tiny.sdkmesh 的 sdkmesh 文件。

我有网格文件base.obj

我在textures/base.jpg

中有纹理

我 运行 meshconvert.exe 使用以下命令行

meshconvert.exe base.obj -n -op -tb

它生成一个base.sdkmesh但它没有纹理文件

我尝试使用 paint.net

jpeg 纹理保存为 dds 文件

当我渲染我的模型时,它全黑了。但是当我渲染 tiny.sdkmesh 模型时,它有纹理。

有人可以帮助解释这个未记录的工具和程序吗?

谢谢,

最新版本 meshconvertDirectXMesh, so unless you specifically need legacy .X file support (which you don't since you are using Wavefront OBJ) you should use that one instead of the legacy DirectX SDK 的一部分。

meshconvert 的默认行为是从 Wavefront OBJ 的 mtl 文件中获取纹理文件名并将它们嵌入为同一文件的 .dds 版本(所以 texture.jpg 存储为 texture.dds)。您可以使用 DirectXTex 项目中的 texconv 工具生成 dds。您还可以使用 -nodds 开关告诉最新的 meshconvert 单独保留文件名。

您还可以使用 DirectX SDK Samples Content Exporter 从 Autodesk FBX 文件创建 SDKMESH 文件。该导出器也将 'cook' 纹理作为导出过程的一部分。

如果您有一个 sdkmesh 并且您正试图弄清楚其中包含哪些纹理引用,请尝试使用 sdkmeshdump 控制台实用程序查看其中的内容。

Disclaimer: SDKMESH is really only intended as a learning format used in DirectX samples. You can use it in your project, but you will most likely want to develop your own runtime container format if your engine/project becomes sophisticated. It mostly has the value of existing, so YMMV.

DirectXMesh wiki and the DirectX SDK Content Exporter wiki

If you are using DXUT, you should use the latest version from GitHub. sdkmesh is also supported by the DirectX Tool Kit for DX11 and DX12