Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.
1#define_import_path bevy_gaussian_splatting::gaussian_3d
4#ifdef GAUSSIAN_3D
5#import bevy_gaussian_splatting::bindings::{
6 view,
7 gaussian_uniforms,
8}
9#import bevy_gaussian_splatting::helpers::{
10 cov2d,
11 get_rotation_matrix,
12 get_scale_matrix,
16#ifdef PACKED
17 #ifdef PRECOMPUTE_COVARIANCE_3D
18 #import bevy_gaussian_splatting::packed::{
19 get_cov3d,
20 }
21 #else
22 #import bevy_gaussian_splatting::packed::{
23 get_rotation,
24 get_scale,
25 }
26 #endif
27#else ifdef BUFFER_STORAGE
28 #ifdef PRECOMPUTE_COVARIANCE_3D
29 #import bevy_gaussian_splatting::planar::{
30 get_cov3d,
31 }
32 #else
33 #import bevy_gaussian_splatting::planar::{
34 get_rotation,
35 get_scale,
36 }
37 #endif
38#else ifdef BUFFER_TEXTURE
39 #ifdef PRECOMPUTE_COVARIANCE_3D
40 #import bevy_gaussian_splatting::texture::{
41 get_cov3d,
42 }
43 #else
44 #import bevy_gaussian_splatting::texture::{
45 get_rotation,
46 get_scale,
47 }
48 #endif
49#endif
52fn compute_cov3d(scale: vec3<f32>, rotation: vec4<f32>) -> array<f32, 6> {
53 let S = get_scale_matrix(scale);
55 let T = mat3x3<f32>(
56 gaussian_uniforms.transform[0].xyz,
57 gaussian_uniforms.transform[1].xyz,
58 gaussian_uniforms.transform[2].xyz,
59 );
61 let R = get_rotation_matrix(rotation);
63 let M = S * R;
64 let Sigma = transpose(M) * M;
65 let TS = T * Sigma * transpose(T);
67 return array<f32, 6>(
68 TS[0][0],
69 TS[0][1],
70 TS[0][2],
71 TS[1][1],
72 TS[1][2],
73 TS[2][2],
74 );
77fn compute_cov2d_3dgs(
78 position: vec3<f32>,
79 index: u32,
80) -> vec3<f32> {
81#ifdef PRECOMPUTE_COVARIANCE_3D
82 let cov3d = get_cov3d(index);
83#else
84 let rotation = get_rotation(index);
85 let scale = get_scale(index);
87 let cov3d = compute_cov3d(scale, rotation);
88#endif
90 return cov2d(position, cov3d);
93#endif // GAUSSIAN_3D
Contents