Vulkan-Samples icon indicating copy to clipboard operation
Vulkan-Samples copied to clipboard

Goal: Asset Pipeline

Open TomAtkinsonArm opened this issue 3 years ago • 1 comments

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.

  • Search assets for a assets.json file
  • Optimize assets according to this files requirements per platform
  • Cache sha256 of each file processed so that we do not rerun on each asset every build
  • Save to a folder known by the build system
  • Have assets which load as fast as possibly for a given platform
  • VKB_OPTIMIZE_ASSETS

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)

TomAtkinsonArm avatar May 24 '22 08:05 TomAtkinsonArm

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

SaschaWillems avatar May 18 '24 08:05 SaschaWillems