Improve texture filtering by doing it in gamma space#7311
Conversation
|
Preview available at https://egui-pr-preview.github.io/pr/7311-emilkinterpolate-textures-in-gamma-space |
Wumpf
left a comment
There was a problem hiding this comment.
"academically" this still pains me that this is necessary but it's perfectly in line with what was discussed before and the improved results speak for themselves! 👍
When updating Rerun, we should check whether its map view is still looking as before - we are blending re_renderer rendered stuff on top of egui (the map itself) there and I'm not sure if this affects that or not.
| /// This enables the application to reference the texture inside an image ui element. | ||
| /// This effectively enables off-screen rendering inside the egui UI. Texture must have | ||
| /// the texture format [`wgpu::TextureFormat::Rgba8UnormSrgb`]. | ||
| /// the texture format [`wgpu::TextureFormat::Rgba8Unorm`]. |
There was a problem hiding this comment.
huh I guess there's a future work item here that iff Rgba8UnormSrgb is passed in, we create an Rgba8Unorm view either way (telling the user that we do that)
If I remember correctly WebGPU standard now guarantees this working on the minspec.
There was a problem hiding this comment.
Can you even know what format the given texture has?
There was a problem hiding this comment.
yeah that's exposed by now. Wasn't back when the code was written!
There was a problem hiding this comment.
.. right we should check that now that we can
There was a problem hiding this comment.
right. this is a TextureView not a texture, but it's supposed to expose these things https://www.w3.org/TR/webgpu/#gputextureview
But alas wgpu doesn't do that yet. Tomorrow is a wgpu release and I want this badly, let's whip that up quickly..
### Related * Includes emilk/egui#7311 ### What The image differences are rather minor, except _cursive_ text looks slightly better now. Also, the Rerun logo looks a bit nicer Before/After:   ### Map view @Wumpf was worried about the map view looking different, but it looks fine to me (eye-balling it)
Without any conversion, an old saved value appears as a completely different color because it's assumed to be a gamma-premultiplied value (which it wasn't when serialized with egui < 0.32). This then lead e.g. the color picker to do wrong conversions and mess up the tint color. We now check if the session was written with the latest or an old version and fix the misinterpreted color values if needed. Note that while the values are correct after conversion, the image can still appear darker due to the blending changes in egui. Relates to: emilk/egui#5824 Relates to: emilk/egui#7311
This makes some transparent images look a lot nicer when blended:
Cursive text will also look nicer.
This unfortunately changes the contract of what
register_native_textureexpects