Kai422kx commited on
Commit
af8981a
·
1 Parent(s): 4f6b78d
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. app.py +2 -2
  2. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0000.jpg +0 -0
  3. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0001.jpg +0 -0
  4. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0002.jpg +0 -0
  5. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0003.jpg +0 -0
  6. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0004.jpg +0 -0
  7. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0005.jpg +0 -0
  8. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0006.jpg +0 -0
  9. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0007.jpg +0 -0
  10. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0008.jpg +0 -0
  11. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0009.jpg +0 -0
  12. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0010.jpg +0 -0
  13. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0011.jpg +0 -0
  14. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0012.jpg +0 -0
  15. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0013.jpg +0 -0
  16. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0014.jpg +0 -0
  17. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0015.jpg +0 -0
  18. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0016.jpg +0 -0
  19. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0017.jpg +0 -0
  20. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0018.jpg +0 -0
  21. gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0019.jpg +0 -0
  22. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0000.jpg +0 -0
  23. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0001.jpg +0 -0
  24. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0002.jpg +0 -0
  25. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0003.jpg +0 -0
  26. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0004.jpg +0 -0
  27. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0005.jpg +0 -0
  28. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0006.jpg +0 -0
  29. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0007.jpg +0 -0
  30. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0008.jpg +0 -0
  31. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0009.jpg +0 -0
  32. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0010.jpg +0 -0
  33. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0011.jpg +0 -0
  34. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0012.jpg +0 -0
  35. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0013.jpg +0 -0
  36. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0014.jpg +0 -0
  37. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0015.jpg +0 -0
  38. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0016.jpg +0 -0
  39. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0017.jpg +0 -0
  40. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0018.jpg +0 -0
  41. gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0019.jpg +0 -0
  42. submodules/diff-gaussian-rasterization/.gitignore +0 -3
  43. submodules/diff-gaussian-rasterization/.gitmodules +0 -3
  44. submodules/diff-gaussian-rasterization/CMakeLists.txt +0 -36
  45. submodules/diff-gaussian-rasterization/LICENSE.md +0 -83
  46. submodules/diff-gaussian-rasterization/README.md +0 -19
  47. submodules/diff-gaussian-rasterization/cuda_rasterizer/auxiliary.h +0 -175
  48. submodules/diff-gaussian-rasterization/cuda_rasterizer/backward.cu +0 -657
  49. submodules/diff-gaussian-rasterization/cuda_rasterizer/backward.h +0 -65
  50. submodules/diff-gaussian-rasterization/cuda_rasterizer/config.h +0 -19
app.py CHANGED
@@ -10,8 +10,8 @@ import re
10
 
11
  import spaces
12
 
13
- subprocess.run(shlex.split("pip install wheel/diff_gaussian_rasterization-0.0.0-cp310-cp310-linux_x86_64.whl"))
14
- subprocess.run(shlex.split("pip install wheel/simple_knn-0.0.0-cp310-cp310-linux_x86_64.whl"))
15
  # subprocess.run(shlex.split("pip install wheel/curope-0.0.0-cp310-cp310-linux_x86_64.whl"))
16
 
17
  GRADIO_CACHE_FOLDER = './gradio_cache_folder'
 
10
 
11
  import spaces
12
 
13
+ subprocess.run(shlex.split("pip install wheel/diff_gaussian_rasterization-0.0.0-cp310-cp310-linux_x86_64.whl --force-reinstall"))
14
+ subprocess.run(shlex.split("pip install wheel/simple_knn-0.0.0-cp310-cp310-linux_x86_64.whl --force-reinstall"))
15
  # subprocess.run(shlex.split("pip install wheel/curope-0.0.0-cp310-cp310-linux_x86_64.whl"))
16
 
17
  GRADIO_CACHE_FOLDER = './gradio_cache_folder'
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0000.jpg DELETED
Binary file (113 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0001.jpg DELETED
Binary file (105 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0002.jpg DELETED
Binary file (120 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0003.jpg DELETED
Binary file (131 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0004.jpg DELETED
Binary file (128 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0005.jpg DELETED
Binary file (113 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0006.jpg DELETED
Binary file (130 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0007.jpg DELETED
Binary file (111 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0008.jpg DELETED
Binary file (91.9 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0009.jpg DELETED
Binary file (131 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0010.jpg DELETED
Binary file (131 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0011.jpg DELETED
Binary file (149 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0012.jpg DELETED
Binary file (98.3 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0013.jpg DELETED
Binary file (100 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0014.jpg DELETED
Binary file (98.3 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0015.jpg DELETED
Binary file (88.2 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0016.jpg DELETED
Binary file (86.2 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0017.jpg DELETED
Binary file (118 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0018.jpg DELETED
Binary file (120 kB)
 
gradio_cache_folder/1fd0addf-d42a-4fa4-866d-51457a3458a3/0019.jpg DELETED
Binary file (122 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0000.jpg DELETED
Binary file (113 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0001.jpg DELETED
Binary file (105 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0002.jpg DELETED
Binary file (120 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0003.jpg DELETED
Binary file (131 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0004.jpg DELETED
Binary file (128 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0005.jpg DELETED
Binary file (113 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0006.jpg DELETED
Binary file (130 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0007.jpg DELETED
Binary file (111 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0008.jpg DELETED
Binary file (91.9 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0009.jpg DELETED
Binary file (131 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0010.jpg DELETED
Binary file (131 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0011.jpg DELETED
Binary file (149 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0012.jpg DELETED
Binary file (98.3 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0013.jpg DELETED
Binary file (100 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0014.jpg DELETED
Binary file (98.3 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0015.jpg DELETED
Binary file (88.2 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0016.jpg DELETED
Binary file (86.2 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0017.jpg DELETED
Binary file (118 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0018.jpg DELETED
Binary file (120 kB)
 
gradio_cache_folder/fe0d52a7-6668-4a47-b0d7-fe7ad7c7cd4f/0019.jpg DELETED
Binary file (122 kB)
 
submodules/diff-gaussian-rasterization/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- build/
2
- diff_gaussian_rasterization.egg-info/
3
- dist/
 
 
 
 
submodules/diff-gaussian-rasterization/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "third_party/glm"]
2
- path = third_party/glm
3
- url = https://github.com/g-truc/glm.git
 
 
 
 
submodules/diff-gaussian-rasterization/CMakeLists.txt DELETED
@@ -1,36 +0,0 @@
1
- #
2
- # Copyright (C) 2023, Inria
3
- # GRAPHDECO research group, https://team.inria.fr/graphdeco
4
- # All rights reserved.
5
- #
6
- # This software is free for non-commercial, research and evaluation use
7
- # under the terms of the LICENSE.md file.
8
- #
9
- # For inquiries contact [email protected]
10
- #
11
-
12
- cmake_minimum_required(VERSION 3.20)
13
-
14
- project(DiffRast LANGUAGES CUDA CXX)
15
-
16
- set(CMAKE_CXX_STANDARD 17)
17
- set(CMAKE_CXX_EXTENSIONS OFF)
18
- set(CMAKE_CUDA_STANDARD 17)
19
-
20
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
21
-
22
- add_library(CudaRasterizer
23
- cuda_rasterizer/backward.h
24
- cuda_rasterizer/backward.cu
25
- cuda_rasterizer/forward.h
26
- cuda_rasterizer/forward.cu
27
- cuda_rasterizer/auxiliary.h
28
- cuda_rasterizer/rasterizer_impl.cu
29
- cuda_rasterizer/rasterizer_impl.h
30
- cuda_rasterizer/rasterizer.h
31
- )
32
-
33
- set_target_properties(CudaRasterizer PROPERTIES CUDA_ARCHITECTURES "70;75;86")
34
-
35
- target_include_directories(CudaRasterizer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/cuda_rasterizer)
36
- target_include_directories(CudaRasterizer PRIVATE third_party/glm ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
submodules/diff-gaussian-rasterization/LICENSE.md DELETED
@@ -1,83 +0,0 @@
1
- Gaussian-Splatting License
2
- ===========================
3
-
4
- **Inria** and **the Max Planck Institut for Informatik (MPII)** hold all the ownership rights on the *Software* named **gaussian-splatting**.
5
- The *Software* is in the process of being registered with the Agence pour la Protection des
6
- Programmes (APP).
7
-
8
- The *Software* is still being developed by the *Licensor*.
9
-
10
- *Licensor*'s goal is to allow the research community to use, test and evaluate
11
- the *Software*.
12
-
13
- ## 1. Definitions
14
-
15
- *Licensee* means any person or entity that uses the *Software* and distributes
16
- its *Work*.
17
-
18
- *Licensor* means the owners of the *Software*, i.e Inria and MPII
19
-
20
- *Software* means the original work of authorship made available under this
21
- License ie gaussian-splatting.
22
-
23
- *Work* means the *Software* and any additions to or derivative works of the
24
- *Software* that are made available under this License.
25
-
26
-
27
- ## 2. Purpose
28
- This license is intended to define the rights granted to the *Licensee* by
29
- Licensors under the *Software*.
30
-
31
- ## 3. Rights granted
32
-
33
- For the above reasons Licensors have decided to distribute the *Software*.
34
- Licensors grant non-exclusive rights to use the *Software* for research purposes
35
- to research users (both academic and industrial), free of charge, without right
36
- to sublicense.. The *Software* may be used "non-commercially", i.e., for research
37
- and/or evaluation purposes only.
38
-
39
- Subject to the terms and conditions of this License, you are granted a
40
- non-exclusive, royalty-free, license to reproduce, prepare derivative works of,
41
- publicly display, publicly perform and distribute its *Work* and any resulting
42
- derivative works in any form.
43
-
44
- ## 4. Limitations
45
-
46
- **4.1 Redistribution.** You may reproduce or distribute the *Work* only if (a) you do
47
- so under this License, (b) you include a complete copy of this License with
48
- your distribution, and (c) you retain without modification any copyright,
49
- patent, trademark, or attribution notices that are present in the *Work*.
50
-
51
- **4.2 Derivative Works.** You may specify that additional or different terms apply
52
- to the use, reproduction, and distribution of your derivative works of the *Work*
53
- ("Your Terms") only if (a) Your Terms provide that the use limitation in
54
- Section 2 applies to your derivative works, and (b) you identify the specific
55
- derivative works that are subject to Your Terms. Notwithstanding Your Terms,
56
- this License (including the redistribution requirements in Section 3.1) will
57
- continue to apply to the *Work* itself.
58
-
59
- **4.3** Any other use without of prior consent of Licensors is prohibited. Research
60
- users explicitly acknowledge having received from Licensors all information
61
- allowing to appreciate the adequacy between of the *Software* and their needs and
62
- to undertake all necessary precautions for its execution and use.
63
-
64
- **4.4** The *Software* is provided both as a compiled library file and as source
65
- code. In case of using the *Software* for a publication or other results obtained
66
- through the use of the *Software*, users are strongly encouraged to cite the
67
- corresponding publications as explained in the documentation of the *Software*.
68
-
69
- ## 5. Disclaimer
70
-
71
- THE USER CANNOT USE, EXPLOIT OR DISTRIBUTE THE *SOFTWARE* FOR COMMERCIAL PURPOSES
72
- WITHOUT PRIOR AND EXPLICIT CONSENT OF LICENSORS. YOU MUST CONTACT INRIA FOR ANY
73
- UNAUTHORIZED USE: [email protected] . ANY SUCH ACTION WILL
74
- CONSTITUTE A FORGERY. THIS *SOFTWARE* IS PROVIDED "AS IS" WITHOUT ANY WARRANTIES
75
- OF ANY NATURE AND ANY EXPRESS OR IMPLIED WARRANTIES, WITH REGARDS TO COMMERCIAL
76
- USE, PROFESSIONNAL USE, LEGAL OR NOT, OR OTHER, OR COMMERCIALISATION OR
77
- ADAPTATION. UNLESS EXPLICITLY PROVIDED BY LAW, IN NO EVENT, SHALL INRIA OR THE
78
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
79
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
80
- GOODS OR SERVICES, LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
81
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
82
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING FROM, OUT OF OR
83
- IN CONNECTION WITH THE *SOFTWARE* OR THE USE OR OTHER DEALINGS IN THE *SOFTWARE*.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
submodules/diff-gaussian-rasterization/README.md DELETED
@@ -1,19 +0,0 @@
1
- # Differential Gaussian Rasterization
2
-
3
- Used as the rasterization engine for the paper "3D Gaussian Splatting for Real-Time Rendering of Radiance Fields". If you can make use of it in your own research, please be so kind to cite us.
4
-
5
- <section class="section" id="BibTeX">
6
- <div class="container is-max-desktop content">
7
- <h2 class="title">BibTeX</h2>
8
- <pre><code>@Article{kerbl3Dgaussians,
9
- author = {Kerbl, Bernhard and Kopanas, Georgios and Leimk{\"u}hler, Thomas and Drettakis, George},
10
- title = {3D Gaussian Splatting for Real-Time Radiance Field Rendering},
11
- journal = {ACM Transactions on Graphics},
12
- number = {4},
13
- volume = {42},
14
- month = {July},
15
- year = {2023},
16
- url = {https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/}
17
- }</code></pre>
18
- </div>
19
- </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
submodules/diff-gaussian-rasterization/cuda_rasterizer/auxiliary.h DELETED
@@ -1,175 +0,0 @@
1
- /*
2
- * Copyright (C) 2023, Inria
3
- * GRAPHDECO research group, https://team.inria.fr/graphdeco
4
- * All rights reserved.
5
- *
6
- * This software is free for non-commercial, research and evaluation use
7
- * under the terms of the LICENSE.md file.
8
- *
9
- * For inquiries contact [email protected]
10
- */
11
-
12
- #ifndef CUDA_RASTERIZER_AUXILIARY_H_INCLUDED
13
- #define CUDA_RASTERIZER_AUXILIARY_H_INCLUDED
14
-
15
- #include "config.h"
16
- #include "stdio.h"
17
-
18
- #define BLOCK_SIZE (BLOCK_X * BLOCK_Y)
19
- #define NUM_WARPS (BLOCK_SIZE/32)
20
-
21
- // Spherical harmonics coefficients
22
- __device__ const float SH_C0 = 0.28209479177387814f;
23
- __device__ const float SH_C1 = 0.4886025119029199f;
24
- __device__ const float SH_C2[] = {
25
- 1.0925484305920792f,
26
- -1.0925484305920792f,
27
- 0.31539156525252005f,
28
- -1.0925484305920792f,
29
- 0.5462742152960396f
30
- };
31
- __device__ const float SH_C3[] = {
32
- -0.5900435899266435f,
33
- 2.890611442640554f,
34
- -0.4570457994644658f,
35
- 0.3731763325901154f,
36
- -0.4570457994644658f,
37
- 1.445305721320277f,
38
- -0.5900435899266435f
39
- };
40
-
41
- __forceinline__ __device__ float ndc2Pix(float v, int S)
42
- {
43
- return ((v + 1.0) * S - 1.0) * 0.5;
44
- }
45
-
46
- __forceinline__ __device__ void getRect(const float2 p, int max_radius, uint2& rect_min, uint2& rect_max, dim3 grid)
47
- {
48
- rect_min = {
49
- min(grid.x, max((int)0, (int)((p.x - max_radius) / BLOCK_X))),
50
- min(grid.y, max((int)0, (int)((p.y - max_radius) / BLOCK_Y)))
51
- };
52
- rect_max = {
53
- min(grid.x, max((int)0, (int)((p.x + max_radius + BLOCK_X - 1) / BLOCK_X))),
54
- min(grid.y, max((int)0, (int)((p.y + max_radius + BLOCK_Y - 1) / BLOCK_Y)))
55
- };
56
- }
57
-
58
- __forceinline__ __device__ float3 transformPoint4x3(const float3& p, const float* matrix)
59
- {
60
- float3 transformed = {
61
- matrix[0] * p.x + matrix[4] * p.y + matrix[8] * p.z + matrix[12],
62
- matrix[1] * p.x + matrix[5] * p.y + matrix[9] * p.z + matrix[13],
63
- matrix[2] * p.x + matrix[6] * p.y + matrix[10] * p.z + matrix[14],
64
- };
65
- return transformed;
66
- }
67
-
68
- __forceinline__ __device__ float4 transformPoint4x4(const float3& p, const float* matrix)
69
- {
70
- float4 transformed = {
71
- matrix[0] * p.x + matrix[4] * p.y + matrix[8] * p.z + matrix[12],
72
- matrix[1] * p.x + matrix[5] * p.y + matrix[9] * p.z + matrix[13],
73
- matrix[2] * p.x + matrix[6] * p.y + matrix[10] * p.z + matrix[14],
74
- matrix[3] * p.x + matrix[7] * p.y + matrix[11] * p.z + matrix[15]
75
- };
76
- return transformed;
77
- }
78
-
79
- __forceinline__ __device__ float3 transformVec4x3(const float3& p, const float* matrix)
80
- {
81
- float3 transformed = {
82
- matrix[0] * p.x + matrix[4] * p.y + matrix[8] * p.z,
83
- matrix[1] * p.x + matrix[5] * p.y + matrix[9] * p.z,
84
- matrix[2] * p.x + matrix[6] * p.y + matrix[10] * p.z,
85
- };
86
- return transformed;
87
- }
88
-
89
- __forceinline__ __device__ float3 transformVec4x3Transpose(const float3& p, const float* matrix)
90
- {
91
- float3 transformed = {
92
- matrix[0] * p.x + matrix[1] * p.y + matrix[2] * p.z,
93
- matrix[4] * p.x + matrix[5] * p.y + matrix[6] * p.z,
94
- matrix[8] * p.x + matrix[9] * p.y + matrix[10] * p.z,
95
- };
96
- return transformed;
97
- }
98
-
99
- __forceinline__ __device__ float dnormvdz(float3 v, float3 dv)
100
- {
101
- float sum2 = v.x * v.x + v.y * v.y + v.z * v.z;
102
- float invsum32 = 1.0f / sqrt(sum2 * sum2 * sum2);
103
- float dnormvdz = (-v.x * v.z * dv.x - v.y * v.z * dv.y + (sum2 - v.z * v.z) * dv.z) * invsum32;
104
- return dnormvdz;
105
- }
106
-
107
- __forceinline__ __device__ float3 dnormvdv(float3 v, float3 dv)
108
- {
109
- float sum2 = v.x * v.x + v.y * v.y + v.z * v.z;
110
- float invsum32 = 1.0f / sqrt(sum2 * sum2 * sum2);
111
-
112
- float3 dnormvdv;
113
- dnormvdv.x = ((+sum2 - v.x * v.x) * dv.x - v.y * v.x * dv.y - v.z * v.x * dv.z) * invsum32;
114
- dnormvdv.y = (-v.x * v.y * dv.x + (sum2 - v.y * v.y) * dv.y - v.z * v.y * dv.z) * invsum32;
115
- dnormvdv.z = (-v.x * v.z * dv.x - v.y * v.z * dv.y + (sum2 - v.z * v.z) * dv.z) * invsum32;
116
- return dnormvdv;
117
- }
118
-
119
- __forceinline__ __device__ float4 dnormvdv(float4 v, float4 dv)
120
- {
121
- float sum2 = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w;
122
- float invsum32 = 1.0f / sqrt(sum2 * sum2 * sum2);
123
-
124
- float4 vdv = { v.x * dv.x, v.y * dv.y, v.z * dv.z, v.w * dv.w };
125
- float vdv_sum = vdv.x + vdv.y + vdv.z + vdv.w;
126
- float4 dnormvdv;
127
- dnormvdv.x = ((sum2 - v.x * v.x) * dv.x - v.x * (vdv_sum - vdv.x)) * invsum32;
128
- dnormvdv.y = ((sum2 - v.y * v.y) * dv.y - v.y * (vdv_sum - vdv.y)) * invsum32;
129
- dnormvdv.z = ((sum2 - v.z * v.z) * dv.z - v.z * (vdv_sum - vdv.z)) * invsum32;
130
- dnormvdv.w = ((sum2 - v.w * v.w) * dv.w - v.w * (vdv_sum - vdv.w)) * invsum32;
131
- return dnormvdv;
132
- }
133
-
134
- __forceinline__ __device__ float sigmoid(float x)
135
- {
136
- return 1.0f / (1.0f + expf(-x));
137
- }
138
-
139
- __forceinline__ __device__ bool in_frustum(int idx,
140
- const float* orig_points,
141
- const float* viewmatrix,
142
- const float* projmatrix,
143
- bool prefiltered,
144
- float3& p_view)
145
- {
146
- float3 p_orig = { orig_points[3 * idx], orig_points[3 * idx + 1], orig_points[3 * idx + 2] };
147
-
148
- // Bring points to screen space
149
- float4 p_hom = transformPoint4x4(p_orig, projmatrix);
150
- float p_w = 1.0f / (p_hom.w + 0.0000001f);
151
- float3 p_proj = { p_hom.x * p_w, p_hom.y * p_w, p_hom.z * p_w };
152
- p_view = transformPoint4x3(p_orig, viewmatrix);
153
-
154
- if (p_view.z <= 0.01f)// || ((p_proj.x < -1.3 || p_proj.x > 1.3 || p_proj.y < -1.3 || p_proj.y > 1.3)))
155
- {
156
- if (prefiltered)
157
- {
158
- printf("Point is filtered although prefiltered is set. This shouldn't happen!");
159
- __trap();
160
- }
161
- return false;
162
- }
163
- return true;
164
- }
165
-
166
- #define CHECK_CUDA(A, debug) \
167
- A; if(debug) { \
168
- auto ret = cudaDeviceSynchronize(); \
169
- if (ret != cudaSuccess) { \
170
- std::cerr << "\n[CUDA ERROR] in " << __FILE__ << "\nLine " << __LINE__ << ": " << cudaGetErrorString(ret); \
171
- throw std::runtime_error(cudaGetErrorString(ret)); \
172
- } \
173
- }
174
-
175
- #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
submodules/diff-gaussian-rasterization/cuda_rasterizer/backward.cu DELETED
@@ -1,657 +0,0 @@
1
- /*
2
- * Copyright (C) 2023, Inria
3
- * GRAPHDECO research group, https://team.inria.fr/graphdeco
4
- * All rights reserved.
5
- *
6
- * This software is free for non-commercial, research and evaluation use
7
- * under the terms of the LICENSE.md file.
8
- *
9
- * For inquiries contact [email protected]
10
- */
11
-
12
- #include "backward.h"
13
- #include "auxiliary.h"
14
- #include <cooperative_groups.h>
15
- #include <cooperative_groups/reduce.h>
16
- namespace cg = cooperative_groups;
17
-
18
- // Backward pass for conversion of spherical harmonics to RGB for
19
- // each Gaussian.
20
- __device__ void computeColorFromSH(int idx, int deg, int max_coeffs, const glm::vec3* means, glm::vec3 campos, const float* shs, const bool* clamped, const glm::vec3* dL_dcolor, glm::vec3* dL_dmeans, glm::vec3* dL_dshs)
21
- {
22
- // Compute intermediate values, as it is done during forward
23
- glm::vec3 pos = means[idx];
24
- glm::vec3 dir_orig = pos - campos;
25
- glm::vec3 dir = dir_orig / glm::length(dir_orig);
26
-
27
- glm::vec3* sh = ((glm::vec3*)shs) + idx * max_coeffs;
28
-
29
- // Use PyTorch rule for clamping: if clamping was applied,
30
- // gradient becomes 0.
31
- glm::vec3 dL_dRGB = dL_dcolor[idx];
32
- dL_dRGB.x *= clamped[3 * idx + 0] ? 0 : 1;
33
- dL_dRGB.y *= clamped[3 * idx + 1] ? 0 : 1;
34
- dL_dRGB.z *= clamped[3 * idx + 2] ? 0 : 1;
35
-
36
- glm::vec3 dRGBdx(0, 0, 0);
37
- glm::vec3 dRGBdy(0, 0, 0);
38
- glm::vec3 dRGBdz(0, 0, 0);
39
- float x = dir.x;
40
- float y = dir.y;
41
- float z = dir.z;
42
-
43
- // Target location for this Gaussian to write SH gradients to
44
- glm::vec3* dL_dsh = dL_dshs + idx * max_coeffs;
45
-
46
- // No tricks here, just high school-level calculus.
47
- float dRGBdsh0 = SH_C0;
48
- dL_dsh[0] = dRGBdsh0 * dL_dRGB;
49
- if (deg > 0)
50
- {
51
- float dRGBdsh1 = -SH_C1 * y;
52
- float dRGBdsh2 = SH_C1 * z;
53
- float dRGBdsh3 = -SH_C1 * x;
54
- dL_dsh[1] = dRGBdsh1 * dL_dRGB;
55
- dL_dsh[2] = dRGBdsh2 * dL_dRGB;
56
- dL_dsh[3] = dRGBdsh3 * dL_dRGB;
57
-
58
- dRGBdx = -SH_C1 * sh[3];
59
- dRGBdy = -SH_C1 * sh[1];
60
- dRGBdz = SH_C1 * sh[2];
61
-
62
- if (deg > 1)
63
- {
64
- float xx = x * x, yy = y * y, zz = z * z;
65
- float xy = x * y, yz = y * z, xz = x * z;
66
-
67
- float dRGBdsh4 = SH_C2[0] * xy;
68
- float dRGBdsh5 = SH_C2[1] * yz;
69
- float dRGBdsh6 = SH_C2[2] * (2.f * zz - xx - yy);
70
- float dRGBdsh7 = SH_C2[3] * xz;
71
- float dRGBdsh8 = SH_C2[4] * (xx - yy);
72
- dL_dsh[4] = dRGBdsh4 * dL_dRGB;
73
- dL_dsh[5] = dRGBdsh5 * dL_dRGB;
74
- dL_dsh[6] = dRGBdsh6 * dL_dRGB;
75
- dL_dsh[7] = dRGBdsh7 * dL_dRGB;
76
- dL_dsh[8] = dRGBdsh8 * dL_dRGB;
77
-
78
- dRGBdx += SH_C2[0] * y * sh[4] + SH_C2[2] * 2.f * -x * sh[6] + SH_C2[3] * z * sh[7] + SH_C2[4] * 2.f * x * sh[8];
79
- dRGBdy += SH_C2[0] * x * sh[4] + SH_C2[1] * z * sh[5] + SH_C2[2] * 2.f * -y * sh[6] + SH_C2[4] * 2.f * -y * sh[8];
80
- dRGBdz += SH_C2[1] * y * sh[5] + SH_C2[2] * 2.f * 2.f * z * sh[6] + SH_C2[3] * x * sh[7];
81
-
82
- if (deg > 2)
83
- {
84
- float dRGBdsh9 = SH_C3[0] * y * (3.f * xx - yy);
85
- float dRGBdsh10 = SH_C3[1] * xy * z;
86
- float dRGBdsh11 = SH_C3[2] * y * (4.f * zz - xx - yy);
87
- float dRGBdsh12 = SH_C3[3] * z * (2.f * zz - 3.f * xx - 3.f * yy);
88
- float dRGBdsh13 = SH_C3[4] * x * (4.f * zz - xx - yy);
89
- float dRGBdsh14 = SH_C3[5] * z * (xx - yy);
90
- float dRGBdsh15 = SH_C3[6] * x * (xx - 3.f * yy);
91
- dL_dsh[9] = dRGBdsh9 * dL_dRGB;
92
- dL_dsh[10] = dRGBdsh10 * dL_dRGB;
93
- dL_dsh[11] = dRGBdsh11 * dL_dRGB;
94
- dL_dsh[12] = dRGBdsh12 * dL_dRGB;
95
- dL_dsh[13] = dRGBdsh13 * dL_dRGB;
96
- dL_dsh[14] = dRGBdsh14 * dL_dRGB;
97
- dL_dsh[15] = dRGBdsh15 * dL_dRGB;
98
-
99
- dRGBdx += (
100
- SH_C3[0] * sh[9] * 3.f * 2.f * xy +
101
- SH_C3[1] * sh[10] * yz +
102
- SH_C3[2] * sh[11] * -2.f * xy +
103
- SH_C3[3] * sh[12] * -3.f * 2.f * xz +
104
- SH_C3[4] * sh[13] * (-3.f * xx + 4.f * zz - yy) +
105
- SH_C3[5] * sh[14] * 2.f * xz +
106
- SH_C3[6] * sh[15] * 3.f * (xx - yy));
107
-
108
- dRGBdy += (
109
- SH_C3[0] * sh[9] * 3.f * (xx - yy) +
110
- SH_C3[1] * sh[10] * xz +
111
- SH_C3[2] * sh[11] * (-3.f * yy + 4.f * zz - xx) +
112
- SH_C3[3] * sh[12] * -3.f * 2.f * yz +
113
- SH_C3[4] * sh[13] * -2.f * xy +
114
- SH_C3[5] * sh[14] * -2.f * yz +
115
- SH_C3[6] * sh[15] * -3.f * 2.f * xy);
116
-
117
- dRGBdz += (
118
- SH_C3[1] * sh[10] * xy +
119
- SH_C3[2] * sh[11] * 4.f * 2.f * yz +
120
- SH_C3[3] * sh[12] * 3.f * (2.f * zz - xx - yy) +
121
- SH_C3[4] * sh[13] * 4.f * 2.f * xz +
122
- SH_C3[5] * sh[14] * (xx - yy));
123
- }
124
- }
125
- }
126
-
127
- // The view direction is an input to the computation. View direction
128
- // is influenced by the Gaussian's mean, so SHs gradients
129
- // must propagate back into 3D position.
130
- glm::vec3 dL_ddir(glm::dot(dRGBdx, dL_dRGB), glm::dot(dRGBdy, dL_dRGB), glm::dot(dRGBdz, dL_dRGB));
131
-
132
- // Account for normalization of direction
133
- float3 dL_dmean = dnormvdv(float3{ dir_orig.x, dir_orig.y, dir_orig.z }, float3{ dL_ddir.x, dL_ddir.y, dL_ddir.z });
134
-
135
- // Gradients of loss w.r.t. Gaussian means, but only the portion
136
- // that is caused because the mean affects the view-dependent color.
137
- // Additional mean gradient is accumulated in below methods.
138
- dL_dmeans[idx] += glm::vec3(dL_dmean.x, dL_dmean.y, dL_dmean.z);
139
- }
140
-
141
- // Backward version of INVERSE 2D covariance matrix computation
142
- // (due to length launched as separate kernel before other
143
- // backward steps contained in preprocess)
144
- __global__ void computeCov2DCUDA(int P,
145
- const float3* means,
146
- const int* radii,
147
- const float* cov3Ds,
148
- const float h_x, float h_y,
149
- const float tan_fovx, float tan_fovy,
150
- const float* view_matrix,
151
- const float* dL_dconics,
152
- float3* dL_dmeans,
153
- float* dL_dcov)
154
- {
155
- auto idx = cg::this_grid().thread_rank();
156
- if (idx >= P || !(radii[idx] > 0))
157
- return;
158
-
159
- // Reading location of 3D covariance for this Gaussian
160
- const float* cov3D = cov3Ds + 6 * idx;
161
-
162
- // Fetch gradients, recompute 2D covariance and relevant
163
- // intermediate forward results needed in the backward.
164
- float3 mean = means[idx];
165
- float3 dL_dconic = { dL_dconics[4 * idx], dL_dconics[4 * idx + 1], dL_dconics[4 * idx + 3] };
166
- float3 t = transformPoint4x3(mean, view_matrix);
167
-
168
- const float limx = 1.3f * tan_fovx;
169
- const float limy = 1.3f * tan_fovy;
170
- const float txtz = t.x / t.z;
171
- const float tytz = t.y / t.z;
172
- t.x = min(limx, max(-limx, txtz)) * t.z;
173
- t.y = min(limy, max(-limy, tytz)) * t.z;
174
-
175
- const float x_grad_mul = txtz < -limx || txtz > limx ? 0 : 1;
176
- const float y_grad_mul = tytz < -limy || tytz > limy ? 0 : 1;
177
-
178
- glm::mat3 J = glm::mat3(h_x / t.z, 0.0f, -(h_x * t.x) / (t.z * t.z),
179
- 0.0f, h_y / t.z, -(h_y * t.y) / (t.z * t.z),
180
- 0, 0, 0);
181
-
182
- glm::mat3 W = glm::mat3(
183
- view_matrix[0], view_matrix[4], view_matrix[8],
184
- view_matrix[1], view_matrix[5], view_matrix[9],
185
- view_matrix[2], view_matrix[6], view_matrix[10]);
186
-
187
- glm::mat3 Vrk = glm::mat3(
188
- cov3D[0], cov3D[1], cov3D[2],
189
- cov3D[1], cov3D[3], cov3D[4],
190
- cov3D[2], cov3D[4], cov3D[5]);
191
-
192
- glm::mat3 T = W * J;
193
-
194
- glm::mat3 cov2D = glm::transpose(T) * glm::transpose(Vrk) * T;
195
-
196
- // Use helper variables for 2D covariance entries. More compact.
197
- float a = cov2D[0][0] += 0.3f;
198
- float b = cov2D[0][1];
199
- float c = cov2D[1][1] += 0.3f;
200
-
201
- float denom = a * c - b * b;
202
- float dL_da = 0, dL_db = 0, dL_dc = 0;
203
- float denom2inv = 1.0f / ((denom * denom) + 0.0000001f);
204
-
205
- if (denom2inv != 0)
206
- {
207
- // Gradients of loss w.r.t. entries of 2D covariance matrix,
208
- // given gradients of loss w.r.t. conic matrix (inverse covariance matrix).
209
- // e.g., dL / da = dL / d_conic_a * d_conic_a / d_a
210
- dL_da = denom2inv * (-c * c * dL_dconic.x + 2 * b * c * dL_dconic.y + (denom - a * c) * dL_dconic.z);
211
- dL_dc = denom2inv * (-a * a * dL_dconic.z + 2 * a * b * dL_dconic.y + (denom - a * c) * dL_dconic.x);
212
- dL_db = denom2inv * 2 * (b * c * dL_dconic.x - (denom + 2 * b * b) * dL_dconic.y + a * b * dL_dconic.z);
213
-
214
- // Gradients of loss L w.r.t. each 3D covariance matrix (Vrk) entry,
215
- // given gradients w.r.t. 2D covariance matrix (diagonal).
216
- // cov2D = transpose(T) * transpose(Vrk) * T;
217
- dL_dcov[6 * idx + 0] = (T[0][0] * T[0][0] * dL_da + T[0][0] * T[1][0] * dL_db + T[1][0] * T[1][0] * dL_dc);
218
- dL_dcov[6 * idx + 3] = (T[0][1] * T[0][1] * dL_da + T[0][1] * T[1][1] * dL_db + T[1][1] * T[1][1] * dL_dc);
219
- dL_dcov[6 * idx + 5] = (T[0][2] * T[0][2] * dL_da + T[0][2] * T[1][2] * dL_db + T[1][2] * T[1][2] * dL_dc);
220
-
221
- // Gradients of loss L w.r.t. each 3D covariance matrix (Vrk) entry,
222
- // given gradients w.r.t. 2D covariance matrix (off-diagonal).
223
- // Off-diagonal elements appear twice --> double the gradient.
224
- // cov2D = transpose(T) * transpose(Vrk) * T;
225
- dL_dcov[6 * idx + 1] = 2 * T[0][0] * T[0][1] * dL_da + (T[0][0] * T[1][1] + T[0][1] * T[1][0]) * dL_db + 2 * T[1][0] * T[1][1] * dL_dc;
226
- dL_dcov[6 * idx + 2] = 2 * T[0][0] * T[0][2] * dL_da + (T[0][0] * T[1][2] + T[0][2] * T[1][0]) * dL_db + 2 * T[1][0] * T[1][2] * dL_dc;
227
- dL_dcov[6 * idx + 4] = 2 * T[0][2] * T[0][1] * dL_da + (T[0][1] * T[1][2] + T[0][2] * T[1][1]) * dL_db + 2 * T[1][1] * T[1][2] * dL_dc;
228
- }
229
- else
230
- {
231
- for (int i = 0; i < 6; i++)
232
- dL_dcov[6 * idx + i] = 0;
233
- }
234
-
235
- // Gradients of loss w.r.t. upper 2x3 portion of intermediate matrix T
236
- // cov2D = transpose(T) * transpose(Vrk) * T;
237
- float dL_dT00 = 2 * (T[0][0] * Vrk[0][0] + T[0][1] * Vrk[0][1] + T[0][2] * Vrk[0][2]) * dL_da +
238
- (T[1][0] * Vrk[0][0] + T[1][1] * Vrk[0][1] + T[1][2] * Vrk[0][2]) * dL_db;
239
- float dL_dT01 = 2 * (T[0][0] * Vrk[1][0] + T[0][1] * Vrk[1][1] + T[0][2] * Vrk[1][2]) * dL_da +
240
- (T[1][0] * Vrk[1][0] + T[1][1] * Vrk[1][1] + T[1][2] * Vrk[1][2]) * dL_db;
241
- float dL_dT02 = 2 * (T[0][0] * Vrk[2][0] + T[0][1] * Vrk[2][1] + T[0][2] * Vrk[2][2]) * dL_da +
242
- (T[1][0] * Vrk[2][0] + T[1][1] * Vrk[2][1] + T[1][2] * Vrk[2][2]) * dL_db;
243
- float dL_dT10 = 2 * (T[1][0] * Vrk[0][0] + T[1][1] * Vrk[0][1] + T[1][2] * Vrk[0][2]) * dL_dc +
244
- (T[0][0] * Vrk[0][0] + T[0][1] * Vrk[0][1] + T[0][2] * Vrk[0][2]) * dL_db;
245
- float dL_dT11 = 2 * (T[1][0] * Vrk[1][0] + T[1][1] * Vrk[1][1] + T[1][2] * Vrk[1][2]) * dL_dc +
246
- (T[0][0] * Vrk[1][0] + T[0][1] * Vrk[1][1] + T[0][2] * Vrk[1][2]) * dL_db;
247
- float dL_dT12 = 2 * (T[1][0] * Vrk[2][0] + T[1][1] * Vrk[2][1] + T[1][2] * Vrk[2][2]) * dL_dc +
248
- (T[0][0] * Vrk[2][0] + T[0][1] * Vrk[2][1] + T[0][2] * Vrk[2][2]) * dL_db;
249
-
250
- // Gradients of loss w.r.t. upper 3x2 non-zero entries of Jacobian matrix
251
- // T = W * J
252
- float dL_dJ00 = W[0][0] * dL_dT00 + W[0][1] * dL_dT01 + W[0][2] * dL_dT02;
253
- float dL_dJ02 = W[2][0] * dL_dT00 + W[2][1] * dL_dT01 + W[2][2] * dL_dT02;
254
- float dL_dJ11 = W[1][0] * dL_dT10 + W[1][1] * dL_dT11 + W[1][2] * dL_dT12;
255
- float dL_dJ12 = W[2][0] * dL_dT10 + W[2][1] * dL_dT11 + W[2][2] * dL_dT12;
256
-
257
- float tz = 1.f / t.z;
258
- float tz2 = tz * tz;
259
- float tz3 = tz2 * tz;
260
-
261
- // Gradients of loss w.r.t. transformed Gaussian mean t
262
- float dL_dtx = x_grad_mul * -h_x * tz2 * dL_dJ02;
263
- float dL_dty = y_grad_mul * -h_y * tz2 * dL_dJ12;
264
- float dL_dtz = -h_x * tz2 * dL_dJ00 - h_y * tz2 * dL_dJ11 + (2 * h_x * t.x) * tz3 * dL_dJ02 + (2 * h_y * t.y) * tz3 * dL_dJ12;
265
-
266
- // Account for transformation of mean to t
267
- // t = transformPoint4x3(mean, view_matrix);
268
- float3 dL_dmean = transformVec4x3Transpose({ dL_dtx, dL_dty, dL_dtz }, view_matrix);
269
-
270
- // Gradients of loss w.r.t. Gaussian means, but only the portion
271
- // that is caused because the mean affects the covariance matrix.
272
- // Additional mean gradient is accumulated in BACKWARD::preprocess.
273
- dL_dmeans[idx] = dL_dmean;
274
- }
275
-
276
- // Backward pass for the conversion of scale and rotation to a
277
- // 3D covariance matrix for each Gaussian.
278
- __device__ void computeCov3D(int idx, const glm::vec3 scale, float mod, const glm::vec4 rot, const float* dL_dcov3Ds, glm::vec3* dL_dscales, glm::vec4* dL_drots)
279
- {
280
- // Recompute (intermediate) results for the 3D covariance computation.
281
- glm::vec4 q = rot;// / glm::length(rot);
282
- float r = q.x;
283
- float x = q.y;
284
- float y = q.z;
285
- float z = q.w;
286
-
287
- glm::mat3 R = glm::mat3(
288
- 1.f - 2.f * (y * y + z * z), 2.f * (x * y - r * z), 2.f * (x * z + r * y),
289
- 2.f * (x * y + r * z), 1.f - 2.f * (x * x + z * z), 2.f * (y * z - r * x),
290
- 2.f * (x * z - r * y), 2.f * (y * z + r * x), 1.f - 2.f * (x * x + y * y)
291
- );
292
-
293
- glm::mat3 S = glm::mat3(1.0f);
294
-
295
- glm::vec3 s = mod * scale;
296
- S[0][0] = s.x;
297
- S[1][1] = s.y;
298
- S[2][2] = s.z;
299
-
300
- glm::mat3 M = S * R;
301
-
302
- const float* dL_dcov3D = dL_dcov3Ds + 6 * idx;
303
-
304
- glm::vec3 dunc(dL_dcov3D[0], dL_dcov3D[3], dL_dcov3D[5]);
305
- glm::vec3 ounc = 0.5f * glm::vec3(dL_dcov3D[1], dL_dcov3D[2], dL_dcov3D[4]);
306
-
307
- // Convert per-element covariance loss gradients to matrix form
308
- glm::mat3 dL_dSigma = glm::mat3(
309
- dL_dcov3D[0], 0.5f * dL_dcov3D[1], 0.5f * dL_dcov3D[2],
310
- 0.5f * dL_dcov3D[1], dL_dcov3D[3], 0.5f * dL_dcov3D[4],
311
- 0.5f * dL_dcov3D[2], 0.5f * dL_dcov3D[4], dL_dcov3D[5]
312
- );
313
-
314
- // Compute loss gradient w.r.t. matrix M
315
- // dSigma_dM = 2 * M
316
- glm::mat3 dL_dM = 2.0f * M * dL_dSigma;
317
-
318
- glm::mat3 Rt = glm::transpose(R);
319
- glm::mat3 dL_dMt = glm::transpose(dL_dM);
320
-
321
- // Gradients of loss w.r.t. scale
322
- glm::vec3* dL_dscale = dL_dscales + idx;
323
- dL_dscale->x = glm::dot(Rt[0], dL_dMt[0]);
324
- dL_dscale->y = glm::dot(Rt[1], dL_dMt[1]);
325
- dL_dscale->z = glm::dot(Rt[2], dL_dMt[2]);
326
-
327
- dL_dMt[0] *= s.x;
328
- dL_dMt[1] *= s.y;
329
- dL_dMt[2] *= s.z;
330
-
331
- // Gradients of loss w.r.t. normalized quaternion
332
- glm::vec4 dL_dq;
333
- dL_dq.x = 2 * z * (dL_dMt[0][1] - dL_dMt[1][0]) + 2 * y * (dL_dMt[2][0] - dL_dMt[0][2]) + 2 * x * (dL_dMt[1][2] - dL_dMt[2][1]);
334
- dL_dq.y = 2 * y * (dL_dMt[1][0] + dL_dMt[0][1]) + 2 * z * (dL_dMt[2][0] + dL_dMt[0][2]) + 2 * r * (dL_dMt[1][2] - dL_dMt[2][1]) - 4 * x * (dL_dMt[2][2] + dL_dMt[1][1]);
335
- dL_dq.z = 2 * x * (dL_dMt[1][0] + dL_dMt[0][1]) + 2 * r * (dL_dMt[2][0] - dL_dMt[0][2]) + 2 * z * (dL_dMt[1][2] + dL_dMt[2][1]) - 4 * y * (dL_dMt[2][2] + dL_dMt[0][0]);
336
- dL_dq.w = 2 * r * (dL_dMt[0][1] - dL_dMt[1][0]) + 2 * x * (dL_dMt[2][0] + dL_dMt[0][2]) + 2 * y * (dL_dMt[1][2] + dL_dMt[2][1]) - 4 * z * (dL_dMt[1][1] + dL_dMt[0][0]);
337
-
338
- // Gradients of loss w.r.t. unnormalized quaternion
339
- float4* dL_drot = (float4*)(dL_drots + idx);
340
- *dL_drot = float4{ dL_dq.x, dL_dq.y, dL_dq.z, dL_dq.w };//dnormvdv(float4{ rot.x, rot.y, rot.z, rot.w }, float4{ dL_dq.x, dL_dq.y, dL_dq.z, dL_dq.w });
341
- }
342
-
343
- // Backward pass of the preprocessing steps, except
344
- // for the covariance computation and inversion
345
- // (those are handled by a previous kernel call)
346
- template<int C>
347
- __global__ void preprocessCUDA(
348
- int P, int D, int M,
349
- const float3* means,
350
- const int* radii,
351
- const float* shs,
352
- const bool* clamped,
353
- const glm::vec3* scales,
354
- const glm::vec4* rotations,
355
- const float scale_modifier,
356
- const float* proj,
357
- const glm::vec3* campos,
358
- const float3* dL_dmean2D,
359
- glm::vec3* dL_dmeans,
360
- float* dL_dcolor,
361
- float* dL_dcov3D,
362
- float* dL_dsh,
363
- glm::vec3* dL_dscale,
364
- glm::vec4* dL_drot)
365
- {
366
- auto idx = cg::this_grid().thread_rank();
367
- if (idx >= P || !(radii[idx] > 0))
368
- return;
369
-
370
- float3 m = means[idx];
371
-
372
- // Taking care of gradients from the screenspace points
373
- float4 m_hom = transformPoint4x4(m, proj);
374
- float m_w = 1.0f / (m_hom.w + 0.0000001f);
375
-
376
- // Compute loss gradient w.r.t. 3D means due to gradients of 2D means
377
- // from rendering procedure
378
- glm::vec3 dL_dmean;
379
- float mul1 = (proj[0] * m.x + proj[4] * m.y + proj[8] * m.z + proj[12]) * m_w * m_w;
380
- float mul2 = (proj[1] * m.x + proj[5] * m.y + proj[9] * m.z + proj[13]) * m_w * m_w;
381
- dL_dmean.x = (proj[0] * m_w - proj[3] * mul1) * dL_dmean2D[idx].x + (proj[1] * m_w - proj[3] * mul2) * dL_dmean2D[idx].y;
382
- dL_dmean.y = (proj[4] * m_w - proj[7] * mul1) * dL_dmean2D[idx].x + (proj[5] * m_w - proj[7] * mul2) * dL_dmean2D[idx].y;
383
- dL_dmean.z = (proj[8] * m_w - proj[11] * mul1) * dL_dmean2D[idx].x + (proj[9] * m_w - proj[11] * mul2) * dL_dmean2D[idx].y;
384
-
385
- // That's the second part of the mean gradient. Previous computation
386
- // of cov2D and following SH conversion also affects it.
387
- dL_dmeans[idx] += dL_dmean;
388
-
389
- // Compute gradient updates due to computing colors from SHs
390
- if (shs)
391
- computeColorFromSH(idx, D, M, (glm::vec3*)means, *campos, shs, clamped, (glm::vec3*)dL_dcolor, (glm::vec3*)dL_dmeans, (glm::vec3*)dL_dsh);
392
-
393
- // Compute gradient updates due to computing covariance from scale/rotation
394
- if (scales)
395
- computeCov3D(idx, scales[idx], scale_modifier, rotations[idx], dL_dcov3D, dL_dscale, dL_drot);
396
- }
397
-
398
- // Backward version of the rendering procedure.
399
- template <uint32_t C>
400
- __global__ void __launch_bounds__(BLOCK_X * BLOCK_Y)
401
- renderCUDA(
402
- const uint2* __restrict__ ranges,
403
- const uint32_t* __restrict__ point_list,
404
- int W, int H,
405
- const float* __restrict__ bg_color,
406
- const float2* __restrict__ points_xy_image,
407
- const float4* __restrict__ conic_opacity,
408
- const float* __restrict__ colors,
409
- const float* __restrict__ final_Ts,
410
- const uint32_t* __restrict__ n_contrib,
411
- const float* __restrict__ dL_dpixels,
412
- float3* __restrict__ dL_dmean2D,
413
- float4* __restrict__ dL_dconic2D,
414
- float* __restrict__ dL_dopacity,
415
- float* __restrict__ dL_dcolors)
416
- {
417
- // We rasterize again. Compute necessary block info.
418
- auto block = cg::this_thread_block();
419
- const uint32_t horizontal_blocks = (W + BLOCK_X - 1) / BLOCK_X;
420
- const uint2 pix_min = { block.group_index().x * BLOCK_X, block.group_index().y * BLOCK_Y };
421
- const uint2 pix_max = { min(pix_min.x + BLOCK_X, W), min(pix_min.y + BLOCK_Y , H) };
422
- const uint2 pix = { pix_min.x + block.thread_index().x, pix_min.y + block.thread_index().y };
423
- const uint32_t pix_id = W * pix.y + pix.x;
424
- const float2 pixf = { (float)pix.x, (float)pix.y };
425
-
426
- const bool inside = pix.x < W&& pix.y < H;
427
- const uint2 range = ranges[block.group_index().y * horizontal_blocks + block.group_index().x];
428
-
429
- const int rounds = ((range.y - range.x + BLOCK_SIZE - 1) / BLOCK_SIZE);
430
-
431
- bool done = !inside;
432
- int toDo = range.y - range.x;
433
-
434
- __shared__ int collected_id[BLOCK_SIZE];
435
- __shared__ float2 collected_xy[BLOCK_SIZE];
436
- __shared__ float4 collected_conic_opacity[BLOCK_SIZE];
437
- __shared__ float collected_colors[C * BLOCK_SIZE];
438
-
439
- // In the forward, we stored the final value for T, the
440
- // product of all (1 - alpha) factors.
441
- const float T_final = inside ? final_Ts[pix_id] : 0;
442
- float T = T_final;
443
-
444
- // We start from the back. The ID of the last contributing
445
- // Gaussian is known from each pixel from the forward.
446
- uint32_t contributor = toDo;
447
- const int last_contributor = inside ? n_contrib[pix_id] : 0;
448
-
449
- float accum_rec[C] = { 0 };
450
- float dL_dpixel[C];
451
- if (inside)
452
- for (int i = 0; i < C; i++)
453
- dL_dpixel[i] = dL_dpixels[i * H * W + pix_id];
454
-
455
- float last_alpha = 0;
456
- float last_color[C] = { 0 };
457
-
458
- // Gradient of pixel coordinate w.r.t. normalized
459
- // screen-space viewport corrdinates (-1 to 1)
460
- const float ddelx_dx = 0.5 * W;
461
- const float ddely_dy = 0.5 * H;
462
-
463
- // Traverse all Gaussians
464
- for (int i = 0; i < rounds; i++, toDo -= BLOCK_SIZE)
465
- {
466
- // Load auxiliary data into shared memory, start in the BACK
467
- // and load them in revers order.
468
- block.sync();
469
- const int progress = i * BLOCK_SIZE + block.thread_rank();
470
- if (range.x + progress < range.y)
471
- {
472
- const int coll_id = point_list[range.y - progress - 1];
473
- collected_id[block.thread_rank()] = coll_id;
474
- collected_xy[block.thread_rank()] = points_xy_image[coll_id];
475
- collected_conic_opacity[block.thread_rank()] = conic_opacity[coll_id];
476
- for (int i = 0; i < C; i++)
477
- collected_colors[i * BLOCK_SIZE + block.thread_rank()] = colors[coll_id * C + i];
478
- }
479
- block.sync();
480
-
481
- // Iterate over Gaussians
482
- for (int j = 0; !done && j < min(BLOCK_SIZE, toDo); j++)
483
- {
484
- // Keep track of current Gaussian ID. Skip, if this one
485
- // is behind the last contributor for this pixel.
486
- contributor--;
487
- if (contributor >= last_contributor)
488
- continue;
489
-
490
- // Compute blending values, as before.
491
- const float2 xy = collected_xy[j];
492
- const float2 d = { xy.x - pixf.x, xy.y - pixf.y };
493
- const float4 con_o = collected_conic_opacity[j];
494
- const float power = -0.5f * (con_o.x * d.x * d.x + con_o.z * d.y * d.y) - con_o.y * d.x * d.y;
495
- if (power > 0.0f)
496
- continue;
497
-
498
- const float G = exp(power);
499
- const float alpha = min(0.99f, con_o.w * G);
500
- if (alpha < 1.0f / 255.0f)
501
- continue;
502
-
503
- T = T / (1.f - alpha);
504
- const float dchannel_dcolor = alpha * T;
505
-
506
- // Propagate gradients to per-Gaussian colors and keep
507
- // gradients w.r.t. alpha (blending factor for a Gaussian/pixel
508
- // pair).
509
- float dL_dalpha = 0.0f;
510
- const int global_id = collected_id[j];
511
- for (int ch = 0; ch < C; ch++)
512
- {
513
- const float c = collected_colors[ch * BLOCK_SIZE + j];
514
- // Update last color (to be used in the next iteration)
515
- accum_rec[ch] = last_alpha * last_color[ch] + (1.f - last_alpha) * accum_rec[ch];
516
- last_color[ch] = c;
517
-
518
- const float dL_dchannel = dL_dpixel[ch];
519
- dL_dalpha += (c - accum_rec[ch]) * dL_dchannel;
520
- // Update the gradients w.r.t. color of the Gaussian.
521
- // Atomic, since this pixel is just one of potentially
522
- // many that were affected by this Gaussian.
523
- atomicAdd(&(dL_dcolors[global_id * C + ch]), dchannel_dcolor * dL_dchannel);
524
- }
525
- dL_dalpha *= T;
526
- // Update last alpha (to be used in the next iteration)
527
- last_alpha = alpha;
528
-
529
- // Account for fact that alpha also influences how much of
530
- // the background color is added if nothing left to blend
531
- float bg_dot_dpixel = 0;
532
- for (int i = 0; i < C; i++)
533
- bg_dot_dpixel += bg_color[i] * dL_dpixel[i];
534
- dL_dalpha += (-T_final / (1.f - alpha)) * bg_dot_dpixel;
535
-
536
-
537
- // Helpful reusable temporary variables
538
- const float dL_dG = con_o.w * dL_dalpha;
539
- const float gdx = G * d.x;
540
- const float gdy = G * d.y;
541
- const float dG_ddelx = -gdx * con_o.x - gdy * con_o.y;
542
- const float dG_ddely = -gdy * con_o.z - gdx * con_o.y;
543
-
544
- // Update gradients w.r.t. 2D mean position of the Gaussian
545
- atomicAdd(&dL_dmean2D[global_id].x, dL_dG * dG_ddelx * ddelx_dx);
546
- atomicAdd(&dL_dmean2D[global_id].y, dL_dG * dG_ddely * ddely_dy);
547
-
548
- // Update gradients w.r.t. 2D covariance (2x2 matrix, symmetric)
549
- atomicAdd(&dL_dconic2D[global_id].x, -0.5f * gdx * d.x * dL_dG);
550
- atomicAdd(&dL_dconic2D[global_id].y, -0.5f * gdx * d.y * dL_dG);
551
- atomicAdd(&dL_dconic2D[global_id].w, -0.5f * gdy * d.y * dL_dG);
552
-
553
- // Update gradients w.r.t. opacity of the Gaussian
554
- atomicAdd(&(dL_dopacity[global_id]), G * dL_dalpha);
555
- }
556
- }
557
- }
558
-
559
- void BACKWARD::preprocess(
560
- int P, int D, int M,
561
- const float3* means3D,
562
- const int* radii,
563
- const float* shs,
564
- const bool* clamped,
565
- const glm::vec3* scales,
566
- const glm::vec4* rotations,
567
- const float scale_modifier,
568
- const float* cov3Ds,
569
- const float* viewmatrix,
570
- const float* projmatrix,
571
- const float focal_x, float focal_y,
572
- const float tan_fovx, float tan_fovy,
573
- const glm::vec3* campos,
574
- const float3* dL_dmean2D,
575
- const float* dL_dconic,
576
- glm::vec3* dL_dmean3D,
577
- float* dL_dcolor,
578
- float* dL_dcov3D,
579
- float* dL_dsh,
580
- glm::vec3* dL_dscale,
581
- glm::vec4* dL_drot)
582
- {
583
- // Propagate gradients for the path of 2D conic matrix computation.
584
- // Somewhat long, thus it is its own kernel rather than being part of
585
- // "preprocess". When done, loss gradient w.r.t. 3D means has been
586
- // modified and gradient w.r.t. 3D covariance matrix has been computed.
587
- computeCov2DCUDA << <(P + 255) / 256, 256 >> > (
588
- P,
589
- means3D,
590
- radii,
591
- cov3Ds,
592
- focal_x,
593
- focal_y,
594
- tan_fovx,
595
- tan_fovy,
596
- viewmatrix,
597
- dL_dconic,
598
- (float3*)dL_dmean3D,
599
- dL_dcov3D);
600
-
601
- // Propagate gradients for remaining steps: finish 3D mean gradients,
602
- // propagate color gradients to SH (if desireD), propagate 3D covariance
603
- // matrix gradients to scale and rotation.
604
- preprocessCUDA<NUM_CHANNELS> << < (P + 255) / 256, 256 >> > (
605
- P, D, M,
606
- (float3*)means3D,
607
- radii,
608
- shs,
609
- clamped,
610
- (glm::vec3*)scales,
611
- (glm::vec4*)rotations,
612
- scale_modifier,
613
- projmatrix,
614
- campos,
615
- (float3*)dL_dmean2D,
616
- (glm::vec3*)dL_dmean3D,
617
- dL_dcolor,
618
- dL_dcov3D,
619
- dL_dsh,
620
- dL_dscale,
621
- dL_drot);
622
- }
623
-
624
- void BACKWARD::render(
625
- const dim3 grid, const dim3 block,
626
- const uint2* ranges,
627
- const uint32_t* point_list,
628
- int W, int H,
629
- const float* bg_color,
630
- const float2* means2D,
631
- const float4* conic_opacity,
632
- const float* colors,
633
- const float* final_Ts,
634
- const uint32_t* n_contrib,
635
- const float* dL_dpixels,
636
- float3* dL_dmean2D,
637
- float4* dL_dconic2D,
638
- float* dL_dopacity,
639
- float* dL_dcolors)
640
- {
641
- renderCUDA<NUM_CHANNELS> << <grid, block >> >(
642
- ranges,
643
- point_list,
644
- W, H,
645
- bg_color,
646
- means2D,
647
- conic_opacity,
648
- colors,
649
- final_Ts,
650
- n_contrib,
651
- dL_dpixels,
652
- dL_dmean2D,
653
- dL_dconic2D,
654
- dL_dopacity,
655
- dL_dcolors
656
- );
657
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
submodules/diff-gaussian-rasterization/cuda_rasterizer/backward.h DELETED
@@ -1,65 +0,0 @@
1
- /*
2
- * Copyright (C) 2023, Inria
3
- * GRAPHDECO research group, https://team.inria.fr/graphdeco
4
- * All rights reserved.
5
- *
6
- * This software is free for non-commercial, research and evaluation use
7
- * under the terms of the LICENSE.md file.
8
- *
9
- * For inquiries contact [email protected]
10
- */
11
-
12
- #ifndef CUDA_RASTERIZER_BACKWARD_H_INCLUDED
13
- #define CUDA_RASTERIZER_BACKWARD_H_INCLUDED
14
-
15
- #include <cuda.h>
16
- #include "cuda_runtime.h"
17
- #include "device_launch_parameters.h"
18
- #define GLM_FORCE_CUDA
19
- #include <glm/glm.hpp>
20
-
21
- namespace BACKWARD
22
- {
23
- void render(
24
- const dim3 grid, dim3 block,
25
- const uint2* ranges,
26
- const uint32_t* point_list,
27
- int W, int H,
28
- const float* bg_color,
29
- const float2* means2D,
30
- const float4* conic_opacity,
31
- const float* colors,
32
- const float* final_Ts,
33
- const uint32_t* n_contrib,
34
- const float* dL_dpixels,
35
- float3* dL_dmean2D,
36
- float4* dL_dconic2D,
37
- float* dL_dopacity,
38
- float* dL_dcolors);
39
-
40
- void preprocess(
41
- int P, int D, int M,
42
- const float3* means,
43
- const int* radii,
44
- const float* shs,
45
- const bool* clamped,
46
- const glm::vec3* scales,
47
- const glm::vec4* rotations,
48
- const float scale_modifier,
49
- const float* cov3Ds,
50
- const float* view,
51
- const float* proj,
52
- const float focal_x, float focal_y,
53
- const float tan_fovx, float tan_fovy,
54
- const glm::vec3* campos,
55
- const float3* dL_dmean2D,
56
- const float* dL_dconics,
57
- glm::vec3* dL_dmeans,
58
- float* dL_dcolor,
59
- float* dL_dcov3D,
60
- float* dL_dsh,
61
- glm::vec3* dL_dscale,
62
- glm::vec4* dL_drot);
63
- }
64
-
65
- #endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
submodules/diff-gaussian-rasterization/cuda_rasterizer/config.h DELETED
@@ -1,19 +0,0 @@
1
- /*
2
- * Copyright (C) 2023, Inria
3
- * GRAPHDECO research group, https://team.inria.fr/graphdeco
4
- * All rights reserved.
5
- *
6
- * This software is free for non-commercial, research and evaluation use
7
- * under the terms of the LICENSE.md file.
8
- *
9
- * For inquiries contact [email protected]
10
- */
11
-
12
- #ifndef CUDA_RASTERIZER_CONFIG_H_INCLUDED
13
- #define CUDA_RASTERIZER_CONFIG_H_INCLUDED
14
-
15
- #define NUM_CHANNELS 3 // Default 3, RGB
16
- #define BLOCK_X 16
17
- #define BLOCK_Y 16
18
-
19
- #endif