Viewer: Auto resolution follows the magnification; minified frames are averaged (#417)
Cause: Auto dropped to Half below 75 % magnification, so text between 50 % and 75 % was rendered with fewer pixels than the screen shows and looked soft. Below 100 % the frame texture was minified with a plain bilinear sampler and no mip levels (Full at 46 % skipped most frame pixels), so edges stair-stepped. Fix: - Auto renders the pixels the magnification needs, as in After Effects: the coarsest whole factor that still gives every screen pixel a rendered one (Full above 50 %, Half down to 33.3 %, Third down to 25 %, Quarter below). - GPU frames: the display texture carries a full mip chain, each level the 2 x 2 mean of the one above (display.wgsl `mip`, same bind group layout as `display`), sampled trilinearly with Viewer Zoom Quality More Accurate (Faster keeps the nearest pixel of the full-size frame). - CPU frames (egui-wgpu textures have no mips): uploaded averaged down by the whole factor that leaves about one texel per screen pixel, the same box average as the texture-limit fit (#201), re-uploaded when the magnification calls for another factor; drawn with texture coordinates that keep each texel over its pixels when the size isn't a multiple. Show Channel / exposure textures follow. Tests: gpu tests::display_frames_are_mipmapped (level count and level 1 = 2 x 2 means of level 0), viewer_tools auto_resolution_follows_the_magnification (60 % was Half) and minified_frames_keep_their_texels_in_place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
94e4afe8de
commit
9d85d4f116
@@ -231,8 +231,9 @@ pub struct EffectcraftApp {
|
||||
/// When the project last changed, and its revision then (see [`Self::editing`]).
|
||||
last_edit: (f64, u64),
|
||||
pub(crate) toast: Option<(String, f64)>,
|
||||
/// Texture of the last CPU frame shown in the viewer and the key it came from.
|
||||
pub(crate) viewer_tex: Option<(egui::TextureHandle, FrameKey)>,
|
||||
/// Texture of the last CPU frame shown in the viewer, the key it came from and the factor it
|
||||
/// was averaged down by for the magnification (`panels::viewer::minify_factor`).
|
||||
pub(crate) viewer_tex: Option<(egui::TextureHandle, FrameKey, usize)>,
|
||||
/// The frames the other (passive) Composition viewers show, by viewer id.
|
||||
pub(crate) passive_tex: std::collections::HashMap<u32, (FrameKey, panels::viewers::PassiveTexture)>,
|
||||
/// The last GPU frame shown: its egui texture id (registered with egui-wgpu), key and texture.
|
||||
@@ -550,7 +551,7 @@ impl EffectcraftApp {
|
||||
}
|
||||
self.viewer_native = None;
|
||||
self.passive_tex.retain(|_, (_, texture)| matches!(texture, panels::viewers::PassiveTexture::Cpu(_)));
|
||||
self.viewer_shown = self.viewer_tex.as_ref().map(|(texture, key)| (texture.id(), *key));
|
||||
self.viewer_shown = self.viewer_tex.as_ref().map(|(texture, key, _)| (texture.id(), *key));
|
||||
self.viewer_image = None;
|
||||
// Old completion closures retain only their detached slot, not the replacement.
|
||||
self.viewer_readback = Default::default();
|
||||
@@ -615,7 +616,7 @@ impl EffectcraftApp {
|
||||
|
||||
/// The size of the viewer frame's texture (CPU frames; fitted to the GPU's texture limit).
|
||||
pub fn viewer_texture_size(&self) -> Option<[usize; 2]> {
|
||||
self.viewer_tex.as_ref().map(|(t, _)| t.size())
|
||||
self.viewer_tex.as_ref().map(|(t, _, _)| t.size())
|
||||
}
|
||||
|
||||
/// The viewer's current pixels as 8-bit premultiplied RGBA, reading a GPU frame back the
|
||||
|
||||
Reference in New Issue
Block a user