Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialising Cloud with rotated GlobalTransform messes up rendering #108

Closed
teodosin opened this issue Jun 2, 2024 · 0 comments · Fixed by #109
Closed

Initialising Cloud with rotated GlobalTransform messes up rendering #108

teodosin opened this issue Jun 2, 2024 · 0 comments · Fixed by #109
Labels
bug Something isn't working

Comments

@teodosin
Copy link

teodosin commented Jun 2, 2024

This is something I noticed just now after trying to load in my own gcloud files. They're generated with Polycam, and their Z axis is inverted from the one that this plugin uses. My quick method of rotating the cloud was with the following function:

fn setup_gaussian(
    mut commands: Commands,
    asset_server: Res<AssetServer>,
){
    commands.spawn((
        GaussianSplattingBundle {
            cloud: asset_server.load("Trii.gcloud"),
            settings: GaussianCloudSettings {

                global_transform: GlobalTransform::from(Mat4 {
                    x_axis: Vec4::new(1.0, 0.0, 0.0, 0.0),
                    y_axis: Vec4::new(0.0, -1.0, 0.0, 0.0),
                    z_axis: Vec4::new(0.0, 0.0, -1.0, 0.0),
                    w_axis: Vec4::new(0.0, 0.0, 0.0, 1.0),
                }),
                ..Default::default()
            },
            ..Default::default()
        },
    ));
    commands.spawn((
        Camera3dBundle::default(),
        PanOrbitCamera::default(),
    ));
}

Initialising the GlobalTransform of the cloud with a 4x4 matrix. The rotation is successful, but the splats get culled at odd angles where they're definitely supposed to be visible. It seems like the rendering is not respecting the GlobalTransform component on the cloud and assumes it's always default.

Before
image

After. Same angle, but the trees are getting cut off from their roots or trunks and a bunch of other gaussians are getting culled unnecessarily.
image

For context, the same angle in Polycam's web viewer.
image

This angle makes it seem like the issue is with the sorting algorithm. The trees are getting cut off where the hill behind them begins.
image

A related but separate issue: should GaussianClouds use the Transform component like built-in Bevy primitives?

@mosure mosure added the bug Something isn't working label Jun 5, 2024
mosure added a commit that referenced this issue Jun 9, 2024
* fix: #108 - cloud transform rotation and scale

* fix: lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants