bevyengine / bevyengine/bevy

Runtime mipmap generation

Open
#18,037 4 comments 0 reactions 0 assignees View on GitHub
A-Assets A-Rendering C-Feature X-Blessed
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

Textures show aliasing artifacts if they are not accompanied with mipmaps when shown at smaller sizes than their original resolution, which is particularly noticeable in 3D.

Currently, Bevy "technically" supports generating mipmaps at runtime using the asset processor but it comes with some drawbacks:

* The asset processor is off by default.
* You have to enable the `basis-universal` feature and output to the ktx2 format.
* The textures have to be saved on your file system (which excludes dynamically generated or loaded textures).
* Doesn't work on textures which are modified at runtime.
* Doesn't work for textures embedded inside glTF models.
* Doesn't work on wasm because AssetProcessor is unsupported on single-threaded/wasm and basis-universal doesn't compile (easily).

## What solution would you like?

I think that most of these issues were planned to be solved by improvements to asset processing but it would require a nontrivial amount of work to get there. In the meantime, perhaps automatically generating mipmaps would supplement these issues?

## What alternative(s) have you considered?

* Improve the asset processor (https://github.com/bevyengine/bevy/issues/9714, https://github.com/bevyengine/bevy/issues/14671)
* [bevy_mod_mipmap_generator](https://github.com/DGriffin91/bevy_mod_mipmap_generator) is a third-party crate that automatically generates mipmaps for textures that don't have them on the CPU.

## Additional context

* cart and others on rendering-dev [commented on this](https://discord.com/channels/691052431525675048/743663924229963868/1341919438831751290)
* Bevy already has some [mipmap generation code](https://github.com/bevyengine/bevy/blob/c818c92143e56ef3b51836af423319a5a61b15ad/crates/bevy_core_pipeline/src/experimental/mip_generation/mod.rs)
* [wgpu example](https://github.com/gfx-rs/wgpu/blob/7e42040fa5b455438e35115ae3ccf8635bed7d50/examples/features/src/mipmap/mod.rs#L77) demonstrating GPU mipmap generation

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.