-
Notifications
You must be signed in to change notification settings - Fork 381
Description
#15 raised a very interesting question that remains unanswered. However, in reality, the function name is quite misleading. The final code significantly relaxes the positional requirements for Gaussians, which is necessary: Imagine a scenario where the center of a Gaussian is not within the current view frustum, but the Gaaussian's diameter is large enough to affect many pixels within the current view frustum. In this case, we should not cull this Gaussian from rendering.
Additionally, I noticed that the calculations in Lines 149-152 of in_frustum
duplicate code found elsewhere, such as Lines 196-200 in forward.cu
. Therefore, I recommend deleting Lines 149-151 in in_frustum
.
diff-gaussian-rasterization/cuda_rasterizer/auxiliary.h
Lines 139 to 165 in 59f5f77
__forceinline__ __device__ bool in_frustum(int idx, | |
const float* orig_points, | |
const float* viewmatrix, | |
const float* projmatrix, | |
bool prefiltered, | |
float3& p_view) | |
{ | |
float3 p_orig = { orig_points[3 * idx], orig_points[3 * idx + 1], orig_points[3 * idx + 2] }; | |
// Bring points to screen space | |
float4 p_hom = transformPoint4x4(p_orig, projmatrix); | |
float p_w = 1.0f / (p_hom.w + 0.0000001f); | |
float3 p_proj = { p_hom.x * p_w, p_hom.y * p_w, p_hom.z * p_w }; | |
p_view = transformPoint4x3(p_orig, viewmatrix); | |
if (p_view.z <= 0.2f)// || ((p_proj.x < -1.3 || p_proj.x > 1.3 || p_proj.y < -1.3 || p_proj.y > 1.3))) | |
{ | |
if (prefiltered) | |
{ | |
printf("Point is filtered although prefiltered is set. This shouldn't happen!"); | |
__trap(); | |
} | |
return false; | |
} | |
return true; | |
} | |
diff-gaussian-rasterization/cuda_rasterizer/forward.cu
Lines 196 to 200 in 59f5f77
// Transform point by projecting | |
float3 p_orig = { orig_points[3 * idx], orig_points[3 * idx + 1], orig_points[3 * idx + 2] }; | |
float4 p_hom = transformPoint4x4(p_orig, projmatrix); | |
float p_w = 1.0f / (p_hom.w + 0.0000001f); | |
float3 p_proj = { p_hom.x * p_w, p_hom.y * p_w, p_hom.z * p_w }; |