From 968e6482c16c71354a8b0bd21e94bf0f2ec6b081 Mon Sep 17 00:00:00 2001 From: Mitchell Mosure Date: Wed, 6 Nov 2024 17:28:57 -0600 Subject: [PATCH] feat: hdr camera support (#125) --- Cargo.toml | 2 +- src/render/mod.rs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 57ad29f6..01f0c11b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bevy_gaussian_splatting" description = "bevy gaussian splatting render pipeline plugin" -version = "2.7.3" +version = "2.7.4" edition = "2021" authors = ["mosure "] license = "MIT OR Apache-2.0" diff --git a/src/render/mod.rs b/src/render/mod.rs index c0cbf8cc..05a7571e 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -315,7 +315,7 @@ fn queue_gaussians( let draw_custom = transparent_3d_draw_functions.read().id::(); - for (view_entity, _view, _) in &mut views { + for (view_entity, view, _) in &mut views { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else { continue; }; @@ -343,6 +343,7 @@ fn queue_gaussians( gaussian_mode: settings.gaussian_mode, rasterize_mode: settings.rasterize_mode, sample_count: msaa.samples(), + hdr: view.hdr, }; let pipeline = pipelines.specialize(&pipeline_cache, &custom_pipeline, key); @@ -625,6 +626,7 @@ pub struct GaussianCloudPipelineKey { pub gaussian_mode: GaussianMode, pub rasterize_mode: GaussianCloudRasterize, pub sample_count: u32, + pub hdr: bool, } impl SpecializedRenderPipeline for GaussianCloudPipeline { @@ -633,6 +635,12 @@ impl SpecializedRenderPipeline for GaussianCloudPipeline { fn specialize(&self, key: Self::Key) -> RenderPipelineDescriptor { let shader_defs = shader_defs(key); + let format = if key.hdr { + TextureFormat::Rgba16Float + } else { + TextureFormat::Rgba8UnormSrgb + }; + RenderPipelineDescriptor { label: Some("gaussian cloud render pipeline".into()), layout: vec![ @@ -652,7 +660,7 @@ impl SpecializedRenderPipeline for GaussianCloudPipeline { shader_defs, entry_point: "fs_main".into(), targets: vec![Some(ColorTargetState { - format: TextureFormat::Rgba8UnormSrgb, + format, blend: Some(BlendState::PREMULTIPLIED_ALPHA_BLENDING), write_mask: ColorWrites::ALL, })],