diff --git a/Texconv/texconv.cpp b/Texconv/texconv.cpp index a55a337..0109cbb 100644 --- a/Texconv/texconv.cpp +++ b/Texconv/texconv.cpp @@ -2469,24 +2469,19 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) } // --- Generate mips ----------------------------------------------------------- + DWORD dwFilter3D = dwFilter; if (!ispow2(info.width) || !ispow2(info.height) || !ispow2(info.depth)) { - if (info.dimension == TEX_DIMENSION_TEXTURE3D) - { - if (!tMips) - { - tMips = 1; - } - else - { - wprintf(L"\nERROR: Cannot generate mips for non-power-of-2 volume textures\n"); - return 1; - } - } - else if (!tMips || info.mipLevels != 1) + if (!tMips || info.mipLevels != 1) { nonpow2warn = true; } + + if (info.dimension == TEX_DIMENSION_TEXTURE3D) + { + // Must force triangle filter for non-power-of-2 volume textures to get correct results + dwFilter3D = TEX_FILTER_TRIANGLE; + } } if ((!tMips || info.mipLevels != tMips) && (info.mipLevels != 1)) @@ -2590,7 +2585,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[]) if (info.dimension == TEX_DIMENSION_TEXTURE3D) { - hr = GenerateMipMaps3D(image->GetImages(), image->GetImageCount(), image->GetMetadata(), dwFilter | dwFilterOpts, tMips, *timage); + hr = GenerateMipMaps3D(image->GetImages(), image->GetImageCount(), image->GetMetadata(), dwFilter3D | dwFilterOpts, tMips, *timage); } else {