Skip to content

Commit

Permalink
fixed missing imports
Browse files Browse the repository at this point in the history
  • Loading branch information
KeKsBoTer committed Mar 8, 2024
1 parent 1326e6a commit fab9b16
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ use std::time::{Duration, Instant};
use wgpu::{util::DeviceExt, Backends, Extent3d};

use cgmath::{
Deg, EuclideanSpace, MetricSpace, Point3, Quaternion,
Vector2, Vector3,
Deg, EuclideanSpace, MetricSpace, Point3, Quaternion, UlpsEq, Vector2, Vector3
};
use egui::Color32;
use num_traits::One;
Expand Down Expand Up @@ -464,6 +463,7 @@ impl WindowContext {
usage: wgpu::TextureUsages::TEXTURE_BINDING,
view_formats: &[],
},
wgpu::util::TextureDataOrder::LayerMajor,
bytemuck::cast_slice(&env_map_data.as_slice()),
);
self.display.set_env_map(&self.wgpu_context.device,Some(&env_texture.create_view(&Default::default())));
Expand Down
6 changes: 3 additions & 3 deletions src/shaders/preprocess.wgsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

const KERNEL_SIZE:f32 = 0.3;
//const MAX_SH_DEG:u32 = <injected>u;

const SH_C0:f32 = 0.28209479177387814;
Expand Down Expand Up @@ -255,9 +255,9 @@ fn preprocess(@builtin(global_invocation_id) gid: vec3<u32>, @builtin(num_workgr
let T = W * J;
let cov = transpose(T) * Vrk * T;

let diagonal1 = cov[0][0] + 0.3;
let diagonal1 = cov[0][0] + KERNEL_SIZE;
let offDiagonal = cov[0][1];
let diagonal2 = cov[1][1] + 0.3;
let diagonal2 = cov[1][1] + KERNEL_SIZE;

let mid = 0.5 * (diagonal1 + diagonal2);
let radius = length(vec2<f32>((diagonal1 - diagonal2) / 2.0, offDiagonal));
Expand Down
12 changes: 1 addition & 11 deletions src/shaders/preprocess_f32.wgsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

//const MAX_SH_DEG:u32 = <injected>u;
const KERNEL_SIZE:f32 = 0.1;
const KERNEL_SIZE:f32 = 0.3;

const SH_C0:f32 = 0.28209479177387814;

Expand Down Expand Up @@ -206,16 +206,6 @@ fn preprocess(@builtin(global_invocation_id) gid: vec3<u32>, @builtin(num_workgr
let T = W * J;
let cov = transpose(T) * Vrk * T;

// according to Mip-Splatting by Yu et al. 2023
let det_0 = max(1e-6, cov[0][0] * cov[1][1] - cov[0][1] * cov[0][1]);
let det_1 = max(1e-6, (cov[0][0] + KERNEL_SIZE) * (cov[1][1] + KERNEL_SIZE) - cov[0][1] * cov[0][1]);
var coef = sqrt(det_0 / (det_1 + 1e-6) + 1e-6);

if det_0 <= 1e-6 || det_1 <= 1e-6 {
coef = 0.0;
}
opacity *= coef;

let diagonal1 = cov[0][0] + KERNEL_SIZE;
let offDiagonal = cov[0][1];
let diagonal2 = cov[1][1] + KERNEL_SIZE;
Expand Down

0 comments on commit fab9b16

Please sign in to comment.