Skip to content

Commit

Permalink
feat: hdr camera support (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosure authored Nov 6, 2024
1 parent c3d1fa6 commit 968e648
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "MIT OR Apache-2.0"
Expand Down
12 changes: 10 additions & 2 deletions src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ fn queue_gaussians(

let draw_custom = transparent_3d_draw_functions.read().id::<DrawGaussians>();

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;
};
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand All @@ -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![
Expand All @@ -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,
})],
Expand Down

0 comments on commit 968e648

Please sign in to comment.