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

About gaussian coverage #14

Open
djx99 opened this issue Aug 30, 2024 · 3 comments
Open

About gaussian coverage #14

djx99 opened this issue Aug 30, 2024 · 3 comments

Comments

@djx99
Copy link

djx99 commented Aug 30, 2024

When I plot out the Gaussian, I notice that there are some blank areas, but the pixels in those blank areas actually have values.

image
image

My understanding is that instead of directly calculating whether the Gaussian (3* sigma) covers a single pixel, it calculates whether the outer circle of the Gaussian covers the tiled area where the pixel is located. That is, the pixel is equally likely to be affected by the Gaussian outside of its 3* sigma?
Is my understanding correct, and is this simplified and accelerated approach common in 3DGS tasks?

@ChaosAdmStudent
Copy link

What do you mean by the "outer circle of the Gaussian"? If you look at the rasterization CUDA kernel:

// process gaussians in the current batch for this pixel
        int batch_size = min(BLOCK_SIZE, range.y - batch_start);
        for (int t = 0; (t < batch_size) && !done; ++t) {
            const float3 conic = conic_batch[t];
            const float3 xy_opac = xy_opacity_batch[t];
            const float opac = xy_opac.z;
            const float2 delta = {xy_opac.x - px, xy_opac.y - py};
            const float sigma = 0.5f * (conic.x * delta.x * delta.x +
                                        conic.z * delta.y * delta.y) +
                                conic.y * delta.x * delta.y;
            const float alpha = min(1.f, opac * __expf(-sigma));
            if (sigma < 0.f || alpha < 1.f / 255.f) {
                continue;
            }

            int32_t g = id_batch[t];
            const float vis = alpha;
            const float3 c = colors[g];
            pix_out.x = pix_out.x + c.x * vis;
            pix_out.y = pix_out.y + c.y * vis;
            pix_out.z = pix_out.z + c.z * vis;
            // T = next_T;
            cur_idx = batch_start + t;
        }

The calculated sigma takes into account both covariance and the pixel distance from gaussian. If the sigma is too large, exp(-sigma) will be very small and consequently alpha will be small. They have a condition which says if alpha < 1/255 , they don't add that gaussian's color to the pixel's render.

Whether or not this condition on alpha is valid outside the 3*sigma range for the gaussian, I am not sure. I would like to know that as well! :)

@xiaoliua1
Copy link

How do you plot these gaussians? You wirte this visualizing code or it already exists somewhere in this project?

@djx99
Copy link
Author

djx99 commented Oct 29, 2024

no, I just use matplotlib.patches.Ellipse through trained scaling and rotation.
image
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants