KhronosGroup / Vulkan-Samples

One stop solution for all Vulkan samples
Apache License 2.0
4.19k stars 625 forks source link

Goal: Asset Pipeline #459

Open TomAtkinsonArm opened 2 years ago

TomAtkinsonArm commented 2 years ago

We currently store assets in a optimized format KTX + compression. This is only optimal for specific platforms. On platforms which don't support these optimizations, it can take several minutes to load textures. Textures may also loose quality if using lossy compression

Being compressed and wrapped, assets are also much harder to work with and change. We cant simple swap a texture out or replace textures.

One solution too this is taking components and building a small executable which loads all available assets and performs specific optimizations for specific platforms. This can all be triaged by CMake at compile time.

might look something like this

{
    "configurations": {
        "android-default": {
            "*.png": {
                "type": "image",
                "compression-priority": ["ASTC"],
                "mipmaps": true,
                "archive": "KTX"
            },
            "*.gltf": {
                "type": "model",
                "optimize-images": true,
                "generate": ["NORMALS", "TANGENTS", "BITANGENTS", "AABB"]
            }
        },
        "windows-default": {
            "*.png": {
                "type": "image",
                "compression-priority": ["ASTC"],
                "mipmaps": true,
                "archive": "KTX"
            },
            "*.gltf": {
                "type": "model",
                "optimize-images": true,
                "generate": ["NORMALS", "TANGENTS", "BITANGENTS", "AABB"]
            }
        }
    },
    "files": {
        "scenes/sponza/Sponza01.gltf": {
            "android": "android-default",
            "windows": "windows-default"
        }
    }
}

compression-priority could potentially check for ASTC device support before optimizing (if running on the host)

SaschaWillems commented 3 months ago

Do we still want to do this? Is there a use case where this is required? If not, maybe we should just close it.