hbb1/2d-gaussian-splatting

Clarification on normal Vector Initialization in forward.cu Line 207

zzg-zzg opened this issue · 2 comments

Dear Authors,

I hope this message finds you well. I am currently working with your project and have a question regarding a specific part of the code in [forward.cu.]

In the following code snippet, I noticed that the normal vector is explicitly set to {0.0, 0.0, 1.0} when transMat_precomp is not nullptr:

// Compute transformation matrix
glm::mat3 T;
float3 normal;
if (transMat_precomp == nullptr)
{
compute_transmat(((float3*)orig_points)[idx], scales[idx], rotations[idx], projmatrix, viewmatrix, W, H, T, normal);
float3 T_ptr = (float3)transMats;
T_ptr[idx * 3 + 0] = {T[0][0], T[0][1], T[0][2]};
T_ptr[idx * 3 + 1] = {T[1][0], T[1][1], T[1][2]};
T_ptr[idx * 3 + 2] = {T[2][0], T[2][1], T[2][2]};
}
else
{
glm::vec3 T_ptr = (glm::vec3)transMat_precomp;
T = glm::mat3(
T_ptr[idx * 3 + 0],
T_ptr[idx * 3 + 1],
T_ptr[idx * 3 + 2]
);
normal = make_float3(0.0, 0.0, 1.0); // why?
}

I am particularly curious about the line where normal is set to {0.0, 0.0, 1.0} when transMat_precomp is used. Could you please explain the reasoning behind this initialization? How does this affect the overall computation, and why is it different from the case where compute_transmat is called?

Thank you very much for your time and assistance. I appreciate your help in understanding this part of the code.

Best regards

hbb1 commented

It is just not supported as the comment says.

  if pipe.compute_cov3D_python:
      # currently don't support normal consistency loss if use precomputed covariance
      splat2world = pc.get_covariance(scaling_modifier)

If you are asking why we don't support normal rendering when using transMat_precomp, then the reasons behind are:

  1. I didn't find cov3D_precomp has many use cases.
  2. support normal rendering requires additional interface changes.
  3. one can also pass the normal as the color for rendering normal.
  4. I am too lazy to do so.

Thank you for your reply. I understand it now. I just want to confirm that I haven't misunderstood the correct way to compute the normal vector.