bevyengine / bevyengine/bevy

More and better `Image` API

Open
#5,452 1 comment 1 reaction 0 assignees View on GitHub
A-Rendering C-Feature
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?

I've been trying to do some pre-processing on textures to implement better material handling in bevy_fbx. But a show stopper is the ability to mix/match and modify textures.

I need a better API to be able to do that.

## What solution would you like?

A few API changes could help.
- Create a wrapper type `EditImage` you could convert an `Image` into, that implement's the `image` crate's [`GenericImage`](https://docs.rs/image/latest/image/trait.GenericImage.html) trait.
- implements methods on `Image` to convert into `EditImage` if the `Image` format supports it, there should be an infaliable `EditImage::into_image(self)`.
- I don't think much more is needed. I've been having issues with DDS on the bistro scene, but I think trying to do image modifications on compressed format is hopeless and inadvisable at runtime.
- In the very long future, we could imagine a new asset pipeline that is capable of generating new assets based on intermediate processing steps in bevy, so that it's not necessary to do this at run time every time the game is loaded; furthermore, it would also not be needed to write special pre-processing code, it would be integrated into the asset loading pipeline, and a special option would output post-processed assets.

## What alternative(s) have you considered?

It's possible to get the raw `Vec` from the `Image`, and try to figure out the proper `DynamicImage` from the texture descriptor, then build a `DynamicImage`, do the operations on it, finally rebuild the previous image from the descriptor.

It might sound hard, but it's actually much more annoying in practice :D

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.