hbb1/diff-surfel-rasterization

Please explain compute_aabb

AlexRoss-WHS opened this issue ยท 5 comments

Hi, thank you for providing the code and for your great paper!
Could you please explain the compute_aabb function to me?

__device__ bool compute_aabb(
glm::mat3 T,
float2& point_image,
float2 & extent
) {
float3 T0 = {T[0][0], T[0][1], T[0][2]};
float3 T1 = {T[1][0], T[1][1], T[1][2]};
float3 T3 = {T[2][0], T[2][1], T[2][2]};
// Compute AABB
float3 temp_point = {1.0f, 1.0f, -1.0f};
float distance = sumf3(T3 * T3 * temp_point);
float3 f = (1 / distance) * temp_point;
if (distance == 0.0) return false;
point_image = {
sumf3(f * T0 * T3),
sumf3(f * T1 * T3)
};
float2 temp = {
sumf3(f * T0 * T0),
sumf3(f * T1 * T1)
};
float2 half_extend = point_image * point_image - temp;
extent = sqrtf2(maxf2(1e-4, half_extend));
return true;

I can't quite understand how it is derived.

I can't understand this part either. If you understand, please let me know. Thank you @AlexRoss-WHS

hbb1 commented

image

Thank you for answering my question perfectly @hbb1

Thank you @hbb1 for taking the time for such a detailed answer! Now that I understand the code and maths I think there are two small typos in your answer:

  1. It sould be $b = -2 * \text{sum}(f T_0 T_3)$
  2. and ${x_1 + x_2 \over 2} ={ -b \over 2 a}$
hbb1 commented

Hi, everyone. @CanCanZeng @AlexRoss-WHS @FantasticOven2
In case you are not aware of it, there is a bug in the current AABB computation. We should directly calculate 3 sigma AABB in the object space instead of calculating 1 sigma AABB and multiplying it with 3 in the screen space. The reason is here #15