Texture streaming with compression

Is it the case that if I have a texture compressed and I enabled mipmaps then the system will automatically load the lores texture first and then upscale as available, or do I have to enable this behaviour somehow?

1 Like

No, mip levels are not streamed. Although @max and I did discuss the possibilities around this.

Current behavior is that the entire mip chain is transferred and uploaded to VRAM once transfer has completed and the texture is referenced in a draw call.

But you may have noticed that some PlayCanvas apps seem to load a low res image first and then switch out to a high res image sometime afterwards. The Call of Duty: Gunsmith project does this. It uses the Asset API to issue requests for sets of assets. So essentially, this is something managed in code. It’d be nice to somehow implement this functionality into the Editor directly so you don’t have to write script to manage this.

Thanks Will - so to get this clear in my mind. I should create assets for low LOD and high LOD, set the low LOD to preload and then async load the high res ones in the background? Will this still select the correct compression format or is there some other cleverness there?

Yep, exactly. :slight_smile:

And yes, the compression formats are handled internally - you don’t have to worry about the selection of those.

We had an idea to do mips streaming.
The way it would work is to pack texture data in reverse order instead of largest to smallest, it would go from smallest to largest, and then use Fetch API, which has good support, except iOS, Safari and IE.
Then it would upload mips as they come, and idea was to upload first 3rd from largest, then 2nd from largest and then largest mips. That means it would need to download only around ~10% of file size to show 2nd mip. Then at ~30% would be half sized, and then at 100% for largest mip.

This would be cool to implement indeed, but would only work with compressed formats, because JPEG and PNG mips are generated in runtime.
And it would mean our DDS containers are not following specs. Tbh, they already don’t follow specs for anything but DXT’s :slight_smile:

2 Likes

Hello, any news about that?

Only that our plan is to adopt the Basis texture format rather than implement some form of mip streaming.

1 Like