Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion crates/viewer/re_renderer/src/renderer/rectangles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ pub struct RectangleOptions {
/// Tint that is multiplied to the rect, supports pre-multiplied alpha.
pub multiplicative_tint: Rgba,

/// Force drawing the rectangle with alpha blending enabled even if `multiplicative_tint` is opaque.
/// (Note that we'll draw without pre-multiplied alpha here, assuming all alpha is unmultiplied)
/// TODO(#12223): This is only really needed if you know you have a texture that you know has a meaningful alpha channel.
pub force_draw_with_transparency: bool,

pub depth_offset: DepthOffset,

/// Optional outline mask.
Expand All @@ -216,6 +221,7 @@ impl Default for RectangleOptions {
texture_filter_magnification: TextureFilterMag::Nearest,
texture_filter_minification: TextureFilterMin::Linear,
multiplicative_tint: Rgba::WHITE,
force_draw_with_transparency: false,
depth_offset: 0,
outline_mask: OutlineMaskPreference::NONE,
}
Expand Down Expand Up @@ -332,6 +338,7 @@ mod gpu_data {
multiplicative_tint,
depth_offset,
outline_mask,
force_draw_with_transparency: _,
} = options;

let sample_type = match texture_format.sample_type(None, None) {
Expand Down Expand Up @@ -535,7 +542,8 @@ impl RectangleDrawData {
},
),
draw_outline_mask: rectangle.options.outline_mask.is_some(),
has_transparency: rectangle.options.multiplicative_tint.a() < 1.0, // TODO(#12223): what about textures with alpha?
has_transparency: rectangle.options.multiplicative_tint.a() < 1.0
|| rectangle.options.force_draw_with_transparency, // TODO(#12223): what about textures with alpha?
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub fn textured_rect_from_image(
texture_filter_magnification,
texture_filter_minification,
multiplicative_tint,
force_draw_with_transparency: false,
depth_offset: ent_context.depth_offset,
outline_mask: ent_context.highlight.overall,
},
Expand Down
2 changes: 2 additions & 0 deletions crates/viewer/re_view_spatial/src/visualizers/video/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ fn visualize_video_frame_texture(
outline_mask: highlight.overall,
depth_offset,
multiplicative_tint,
force_draw_with_transparency: false,
},
};
visualizer_data.add_pickable_rect(
Expand Down Expand Up @@ -237,6 +238,7 @@ fn show_video_playback_issue(
outline_mask: highlight.overall,
#[expect(clippy::disallowed_methods)] // Ok to just dim it
multiplicative_tint: egui::Rgba::from_gray(0.5),
force_draw_with_transparency: true,
..Default::default()
},
};
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 21 additions & 4 deletions crates/viewer/re_view_spatial/tests/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use re_test_context::external::egui_kittest::SnapshotOptions;
use re_test_viewport::TestContextExt as _;
use re_video::{VideoCodec, VideoDataDescription};
use re_viewer_context::{TimeControlCommand, ViewClass as _};
use re_viewport_blueprint::ViewBlueprint;
use re_viewport_blueprint::{ViewBlueprint, ViewProperty};

fn workspace_dir() -> std::path::PathBuf {
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
Expand Down Expand Up @@ -266,10 +266,27 @@ fn test_video(video_type: VideoType, codec: VideoCodec) {
}
}

let view_id = test_context.setup_viewport_blueprint(|_ctx, blueprint| {
blueprint.add_view_at_root(ViewBlueprint::new_with_root_wildcard(
let view_id = test_context.setup_viewport_blueprint(|ctx, blueprint| {
let view_id = blueprint.add_view_at_root(ViewBlueprint::new_with_root_wildcard(
re_view_spatial::SpatialView2D::identifier(),
))
));

// Set a background color other than black so we can see the effect of transparency on errors & lack thereof on the video.
let property = ViewProperty::from_archetype::<
re_sdk_types::blueprint::archetypes::Background,
>(ctx.blueprint_db(), ctx.blueprint_query, view_id);
property.save_blueprint_component(
ctx,
&re_sdk_types::blueprint::archetypes::Background::descriptor_kind(),
&re_sdk_types::blueprint::components::BackgroundKind::SolidColor,
);
property.save_blueprint_component(
ctx,
&re_sdk_types::blueprint::archetypes::Background::descriptor_color(),
&re_sdk_types::components::Color::from_rgb(200, 100, 200),
);

view_id
});

// Decoding videos can take quite a while!
Expand Down
Loading