JonathonLuiten / diff-gaussian-rasterization-w-depth

Other
158 stars 24 forks source link

Is GaussianRasterizationSettings.viewmatrix not differentiable? #10

Open YufengJin opened 2 months ago

YufengJin commented 2 months ago

It seems that the viewmatrix (w2c) in GaussianRasterizationSettings is not differentiable. When traversing through grad_fn.next_functions.

            # l1 + dssim 
            loss.backward()

            grad_fn = loss.grad_fn
            while grad_fn is not None:
                print(grad_fn)
                grad_fn = grad_fn.next_functions[0][0]

output:

<AddBackward0 object at 0x7f97e9d962b0>
<AddBackward0 object at 0x7f97e9d96310>
<MulBackward0 object at 0x7f97e9d962b0>
<MeanBackward0 object at 0x7f97e9d96310>
<AbsBackward0 object at 0x7f97e9d962b0>
<SubBackward0 object at 0x7f97e9d96310>
<MaskedSelectBackward0 object at 0x7f97e9d962b0>
<torch.autograd.function._RasterizeGaussiansBackward object at 0x7f97e9d7c140>
<AccumulateGrad object at 0x7f97e9d962b0>

I couldn't find the gradient function for viewmatrix. Do I need to edit the backward function of GaussianRasterization to compute the gradient of the camera view? Are there any other methods available? Thanks.

slothfulxtx commented 3 weeks ago

We implement a Swiss army knife for differentiable gaussian rasterization, here's our repo. https://github.com/slothfulxtx/diff-gaussian-rasterization You can find the differentiable camera pose rendering process.