Closed hardikdava closed 4 months ago
Sorry that not planning yet. Contributions are welcomed!
On Mon, Apr 29, 2024 at 14:39 Hardik Dava @.***> wrote:
Great work @yzslab https://github.com/yzslab , is it possible to add support for rotation and scalling of spherical harmonics data with the transformation of 3dgs model?
— Reply to this email directly, view it on GitHub https://github.com/yzslab/gaussian-splatting-lightning/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEJZCPLHIMYFPESFZ3OFEDY7XTLFAVCNFSM6AAAAABG5XGE6WVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3DQMRUGM2DGOI . You are receiving this because you were mentioned.Message ID: @.***>
Rotate the first extra degree has been implemented. The calculation of the higher SH degrees are far more tedious, so only one degree currently.
@yzslab thanks a lot. Can you give me the direction how to achieve the rotation for 3 sh degree? I would like to try it out.
@yzslab thanks a lot. Can you give me the direction how to achieve the rotation for 3 sh degree? I would like to try it out.
Already provided in the code comment: https://github.com/yzslab/gaussian-splatting-lightning/blob/098b0b7bb808f1127294d7248d0ee76452742be0/utils/gaussian_transform.py#L86-L96
@yzslab It's not possible to rotate higher degree of spherical harmonics without knowing camera matrix. Am I right?
P.S. I want to do it offline. Trained model -> rotate -> visualize
@yzslab It's not possible to rotate higher degree of spherical harmonics without knowing camera matrix. Am I right?
P.S. I want to do it offline.
Trained model -> rotate -> visualize
The camera matrix isn't required. The R
is the matrix that rotate your scene.
@yzslab I tried your implementation and it's working perfectly for 1st degree. But still missing implementation for 2nd and higher degree.
@yzslab I tried your implementation and it's working perfect for 1st degree. But still missing implementation for 2nd and higher degree.
The calculation of the higher SH degrees are far more tedious.
But rotating the view direction vectors are more easier: R.T @ (means3D' - camera_center)
. I think you can modifying the rasterizer to get correct colors by this way.
@yzslab I tried your implementation and it's working perfect for 1st degree. But still missing implementation for 2nd and higher degree.
The calculation of the higher SH degrees are far more tedious. But rotating the view direction vectors are more easier:
R.T @ (means3D' - camera_center)
. I think you can modifying the rasterizer to get correct colors by this way.
Just need to modify the rasterizer to accept a rotation matrix R
as a parameter, and apply it when calculating colors.
@yzslab I think there is an error with your formula. It will create dim mismatch error. Can you recheck it once?
@yzslab I think there is an error with your formula. It will create dim mismatch error. Can you recheck it once?
Would you mind providing more details?
@yzslab I think there is an error with your formula. It will create dim mismatch error. Can you recheck it once?
Would you mind providing more details?
The means3D' - camera_center
is a column vector.
@yzslab I am using modified version of gsplat
rasterizer. I have rotated first degree as you implemented. I modified the color computation as you suggested and I am getting following error:
viewdirs = camera.camera_to_worlds.detach()[..., :3, :3].T @ (means_crop.detach() - camera.camera_to_worlds.detach()[..., :3, 3])
RuntimeError: mat1 and mat2 shapes cannot be multiplied (9x1 and 82214x3)
@yzslab I am using modified version of
gsplat
rasterizer. I have rotated first degree as you implemented. I modified the color computation as you suggested and I am getting following error:viewdirs = camera.camera_to_worlds.detach()[..., :3, :3].T @ (means_crop.detach() - camera.camera_to_worlds.detach()[..., :3, 3]) RuntimeError: mat1 and mat2 shapes cannot be multiplied (9x1 and 82214x3)
The means3D
and camera_center
in Python code are row vectors. So the correct calculation in code should be:
(means3D` - camera_center) @ R
NOTE:
R
isn't the camera matrix, should be the one rotating your scene.have rotated first degree
Besides, you should not rotate SHs and the view direction together. Rotation should be applied either for SHs or view directions.
@yzslab You are right. I got it working for applying Rotation directly to view direction. How can I achieve rotation without modifying the rasterizer? Is it possible?
How can I achieve rotation without modifying the rasterizer? Is it possible?
I think rotating the SHs is the only way to achieve this.
@yzslab can you send me references on how can rotate SH for higher degree if you have it?
@yzslab can you send me references on how can rotate SH for higher degree if you have it?
I think the theory is the same as the 1st extra degree. Someone mentioned that it could be done with Wigner D-matrix: https://github.com/graphdeco-inria/gaussian-splatting/issues/176#issuecomment-1711876624 Here is an implementation: https://github.com/graphdeco-inria/gaussian-splatting/issues/176#issuecomment-2060513169 I don't know whether it is correct. The results of the 1st extra degree are differ to the calculation here.
@yzslab I tried the mentioned method. But It's not yielding good result.
@yzslab I tried the mentioned method. But It's not yielding good result.
Thanks to MstXy, this problem has been solved now: https://github.com/graphdeco-inria/gaussian-splatting/issues/176#issuecomment-2147223570 I validated that the latest one is correct.
@yzslab Thanks for the support. I have also verified the result.
Great work @yzslab , is it possible to add support for rotation and scalling of spherical harmonics data with the transformation of 3dgs model?