Skip to content

Bug in buildHashAllocAndVisibleTypePP: offset missing. #145

@Algomorph

Description

@Algomorph

Because your voxel coordinates represent voxel centers, i.e. they're projected directly onto the image and then rounded to get the depth, your actual hash blocks actually start with a 1/2 voxel offset from the whole coordinate.

You don't take this into account when allocating hash blocks, which results in missing blocks in certain situations and contributes drift/noise. The easy fix is to add the offset to the segment along camera ray that's marched on during hash block allocation.

Simply replace these lines:

pt_buff = pt_camera_f * (1.0f - mu / norm); pt_buff.w = 1.0f;
point = TO_VECTOR3(invM_d * pt_buff) * oneOverVoxelSize;
pt_buff = pt_camera_f * (1.0f + mu / norm); pt_buff.w = 1.0f;
point_e = TO_VECTOR3(invM_d * pt_buff) * oneOverVoxelSize;

With this:

        pt_buff = pt_camera_f * (1.0f - mu / norm); pt_buff.w = 1.0f;
	point = TO_VECTOR3(invM_d * pt_buff) * oneOverVoxelSize + Vector3f(1.0f / (2.0f * VOXEL_BLOCK_SIZE));

	pt_buff = pt_camera_f * (1.0f + mu / norm); pt_buff.w = 1.0f;
	point_e = TO_VECTOR3(invM_d * pt_buff) * oneOverVoxelSize + Vector3f(1.0f / (2.0f * VOXEL_BLOCK_SIZE));

Also, your variable names could be a bit more descriptive and not use acronyms, and calling the inverse of hash block size in meters "oneOverVoxelSize" is misleading. I suggest "oneOverVoxelBlockSize_Meters".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions