microsoft / DirectXMesh

DirectXMesh geometry processing library
https://walbourn.github.io/directxmesh/
MIT License
786 stars 152 forks source link

Meshconvert support for compressed vertices in SDKMESH #48

Closed walbourn closed 4 years ago

walbourn commented 4 years ago

The Meshconvert tool currently writes using the following vertex format for SDKMESH:

DXGI_FORMAT_R32G32B32_FLOAT for normals/tangent/binormals
DXGI_FORMAT_B8G8R8A8_UNORM for colors
DXGI_FORMAT_R32G32_FLOAT for texcoords

Should provide an option to use smaller normal formats like R11G11B10_FLOAT, colors should be able to use R10G10B10A2_UNORM or D3DDECLTYPE_DXGI_R11G11B10_FLOAT, and could use DXGI_FORMAT_R16G16_FLOAT for texture coords.

walbourn commented 4 years ago

The SDKMESH Content Exporter tool supports:

   static const ExportEnumValue VertexNormalTypes[] = {
        { "FLOAT3 (12 bytes)", "float3", D3DDECLTYPE_FLOAT3 },
        { "UBYTE4N Biased (4 bytes)", "ubyte4n", D3DDECLTYPE_UBYTE4N },
        { "SHORT4N (8 bytes)", "short4n", D3DDECLTYPE_SHORT4N },
        { "FLOAT16_4 (8 bytes)", "float16_4", D3DDECLTYPE_FLOAT16_4 },
        { "10:10:10:2 Biased (4 bytes)", "rgba_10", D3DDECLTYPE_DXGI_R10G10B10A2_UNORM },
        { "R11G11B10 Biased (4 bytes)", "r11g11b10", D3DDECLTYPE_DXGI_R11G11B10_FLOAT },
        { "R8G8B8A8 Signed (4 bytes)", "rgba_snorm", D3DDECLTYPE_DXGI_R8G8B8A8_SNORM },
        { "10:10:10 Signed A2 (4 bytes, Xbox)", "rgba_s10", D3DDECLTYPE_XBOX_R10G10B10_SNORM_A2_UNORM },
    };
   static const ExportEnumValue VertexColorTypes[] = {
        { "D3DCOLOR (4 bytes)", "bgra", D3DDECLTYPE_D3DCOLOR },
        { "UBYTE4N (4 bytes)", "rgba", D3DDECLTYPE_UBYTE4N },
        { "FLOAT4 (16 bytes)", "float4", D3DDECLTYPE_FLOAT4 },
        { "FLOAT16_4 (8 bytes)", "float16_4", D3DDECLTYPE_FLOAT16_4 },
        { "10:10:10:2 (4 byts)", "rgba_10", D3DDECLTYPE_DXGI_R10G10B10A2_UNORM },
        { "R11G11B10 (4 bytes)", "r11g11b10", D3DDECLTYPE_DXGI_R11G11B10_FLOAT },
    };
walbourn commented 4 years ago

PR: https://github.com/microsoft/DirectXMesh/pull/49