nannou-org / nannou

A Creative Coding Framework for Rust.
https://nannou.cc/
6.04k stars 305 forks source link

`nannou_egui` colours too light / incorrect gamma handling #958

Open mitchmindtree opened 10 months ago

mitchmindtree commented 10 months ago

940 lands an epic final stable release of nannou prior to diving into the Great Bevy Refactor #953. However unfortunately, a recent version of egui changed some assumptions about the colour format of the egui pipeline's target texture, and the required changes are a little more than we can afford time for at the moment.

From memory, the issue has something to do with egui's fragment shader and some assumptions they make around web targets vs desktop targets. nannou uniquely runs into this as we don't target the window surface texture directly (which is normally sRGB, i.e. gamma adjusted) like most egui apps do - instead we draw to an intermediary frame with a linear colour format.

There are no direct plans for fixing nannou_egui under the 0.19 release - instead, as a part of #953, the plan is to take advantage of and collaborate with the existing bevy_egui plugin. We may run into similar issues if bevy_egui makes similar assumptions to egui itself w.r.t. target textures, however even so we're likely better off upstreaming a solution to bevy_egui than continuing to maintain our own egui rendering implementation.

tychedelia commented 10 months ago

Interestingly bevy_egui seems to do this conversion in the opposite direction. As far as I can tell, they're rendering into the window swap chain provided by bevy.