gaussian-splatting icon indicating copy to clipboard operation
gaussian-splatting copied to clipboard

Question about `render.py`

Open hyoseok1223 opened this issue 8 months ago • 8 comments

Thank you for great work, I have some questions in render.py

  • Below line, say frustum culled, but in this dictionary is not culled any thing, only filter by radii. frustum culling is did in differentiable rasterization right?
  • In view space, i think view direction is -Z, so if do frustum culling, we only get -z_near ~ z_far? ( ex - -0.01 ~-100.0 )
    • I see threshold is 0.2 in here, is it in canonical space ( 0~1 ) ? if z=0.2 is not view direction ( i think for example it is thresholded by <-0.2 which mean in frustum
  • In render.py, what is viewspace_points mean? really i think it is camera space gaussian xyz point coordinate but value screenspace_points just all zero. why use viewspace_points expression?

https://github.com/graphdeco-inria/gaussian-splatting/blob/f11001b46c5c73a0a7d553353c898efd68412abe/gaussian_renderer/init.py#L95C5-L100C28

    # Those Gaussians that were frustum culled or had a radius of 0 were not visible.
    # They will be excluded from value updates used in the splitting criteria.
    return {"render": rendered_image,
            "viewspace_points": screenspace_points,
            "visibility_filter" : radii > 0,
            "radii": radii}

hyoseok1223 avatar Oct 30 '23 05:10 hyoseok1223

  1. yes culling is done during rasterization
  2. z values are in euclidean space
  3. screenspace_points is passed to rasterizer function which fills this variable with the image coordinates (uv) of the gaussians

kwea123 avatar Nov 04 '23 09:11 kwea123

@kwea123 Hi, Thank your for your explanation. But Why the elements in varible 'screenspace_points' after rendered are still all with zero? Could you explain it more clearly?I'm still confused. Thank you!

MobiusLqm avatar Jan 05 '24 15:01 MobiusLqm

@MobiusLqm oh sorry, that variable is only used to keep the gradient w.r.t. uv, the content itself is still zero. The values are stored in this variable https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/cuda_rasterizer/rasterizer_impl.cu#L265 but with this code it is very hard to extract them. You need to compute the correct offset from https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/cuda_rasterizer/rasterizer_impl.cu#L158-L165 then get it from the variable geomBuffer on this line https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/diff_gaussian_rasterization/init.py#L86

kwea123 avatar Jan 06 '24 07:01 kwea123

@MobiusLqm oh sorry, that variable is only used to keep the gradient w.r.t. uv, the content itself is still zero. The values are stored in this variable https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/cuda_rasterizer/rasterizer_impl.cu#L265 but with this code it is very hard to extract them. You need to compute the correct offset from https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/cuda_rasterizer/rasterizer_impl.cu#L158-L165 then get it from the variable geomBuffer on this line https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/diff_gaussian_rasterization/init.py#L86

@kwea123 Greate thanks for your explanation, I really appreciate it. I will check it later.

MobiusLqm avatar Jan 06 '24 09:01 MobiusLqm

@MobiusLqm oh sorry, that variable is only used to keep the gradient w.r.t. uv, the content itself is still zero. The values are stored in this variable https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/cuda_rasterizer/rasterizer_impl.cu#L265 but with this code it is very hard to extract them. You need to compute the correct offset from https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/cuda_rasterizer/rasterizer_impl.cu#L158-L165 then get it from the variable geomBuffer on this line https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/diff_gaussian_rasterization/init.py#L86

How exactly does it "retain the gradient with respect to uv"? I was under the impression that means2D is ultimately passed to this section of the code. However, it appears that it isn't utilized there at all. Could you guide me on how to further trace its usage or impact?

ShaySheng avatar Feb 15 '24 15:02 ShaySheng

  1. yes culling is done during rasterization
  2. z values are in euclidean space
  3. screenspace_points is passed to rasterizer function which fills this variable with the image coordinates (uv) of the gaussians

Hi!Thank your good tutorials about 3D GS ^-^! I think means2D stores gradients about NDC space, but not image space.

atomicAdd(&dL_dmean2D[global_id].x, dL_dG * dG_ddelx * ddelx_dx); atomicAdd(&dL_dmean2D[global_id].y, dL_dG * dG_ddely * ddely_dy);

ShaohuaL avatar Feb 27 '24 02:02 ShaohuaL

@MobiusLqm oh sorry, that variable is only used to keep the gradient w.r.t. uv, the content itself is still zero. The values are stored in this variable https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/cuda_rasterizer/rasterizer_impl.cu#L265 but with this code it is very hard to extract them. You need to compute the correct offset from https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/cuda_rasterizer/rasterizer_impl.cu#L158-L165 then get it from the variable geomBuffer on this line https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/diff_gaussian_rasterization/init.py#L86

How exactly does it "retain the gradient with respect to uv"? I was under the impression that means2D is ultimately passed to this section of the code. However, it appears that it isn't utilized there at all. Could you guide me on how to further trace its usage or impact?

I have the same question with you. Have you figured it out?

JerryPW avatar Mar 16 '24 05:03 JerryPW

@MobiusLqm oh sorry, that variable is only used to keep the gradient w.r.t. uv, the content itself is still zero. The values are stored in this variable https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/cuda_rasterizer/rasterizer_impl.cu#L265 but with this code it is very hard to extract them. You need to compute the correct offset from https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/cuda_rasterizer/rasterizer_impl.cu#L158-L165 then get it from the variable geomBuffer on this line https://github.com/graphdeco-inria/diff-gaussian-rasterization/blob/main/diff_gaussian_rasterization/init.py#L86

How exactly does it "retain the gradient with respect to uv"? I was under the impression that means2D is ultimately passed to this section of the code. However, it appears that it isn't utilized there at all. Could you guide me on how to further trace its usage or impact?

I have the same question with you. Have you figured it out?

sorry. I didn't figure it out. this issue is not related with my current project .

MobiusLqm avatar Mar 16 '24 05:03 MobiusLqm