Florian-Barthel/splatviz

GaussianModel.load_ply seems to only manage max_sh=0 or 3 degree

Closed this issue · 2 comments

Hi @Florian-Barthel ,

Thanks a lot for the great work, I was trying to use this viewer with ply file trained with sh degree=1, but was not able to.

Looking at the load_ply method of GaussianModel class, it seems that the max sh_degree managed is either 0 or 3.
https://github.com/Florian-Barthel/splatviz/blob/main/gaussian-splatting/scene/gaussian_model.py#L275

        if len(extra_f_names) == 0:
            self.max_sh_degree = 0
        if len(extra_f_names) == 45:
            self.max_sh_degree = 3
        assert len(extra_f_names)==3*(self.max_sh_degree + 1) ** 2 - 3

When doing this change, it rendered:

        if len(extra_f_names) == 0:
            self.max_sh_degree = 0
        if len(extra_f_names) == 9:
            self.max_sh_degree = 1
        if len(extra_f_names) == 45:
            self.max_sh_degree = 3

Maybe it'd be added to the load function ?

Hi,
yes it seems like a good idea to add this. Probably it also makes sense to add a case for sh == 2, like:

if len(extra_f_names) == 0:
    self.max_sh_degree = 0
if len(extra_f_names) == 9:
    self.max_sh_degree = 1
if len(extra_f_names) == 24:
    self.max_sh_degree = 2
if len(extra_f_names) == 45:
    self.max_sh_degree = 3

I will add it tomorrow. You can also do a PR if want.

Thanks for taking this into account :), I am a bit late for any PR ..