{'fraction_non_alphanumeric': 0.031678016680694775, 'fraction_numerical': 0.006542199097100008, 'mean_word_length': 4.691051600261267, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Rendering and Tracking the Directional TSDF: Modeling Surface Orientation for Coherent Maps

Dense real-time tracking and mapping from RGB-D images is an important tool for many robotic applications, such as navigation or grasping. The recently presented Directional Truncated Signed Distance Function (DTSDF) is an augmentation of the regular TSDF and shows potential for more coherent maps and improved tracking performance. In this work, we present methods for rendering depth- and color maps from the DTSDF, making it a true drop-in replacement for the regular TSDF in established trackers. We evaluate and show, that our method increases re-usability of mapped scenes. Furthermore, we add color integration which notably improves color-correctness at adjacent surfaces.


I. INTRODUCTION
Since its first appearance in KinectFusion [1], GPU accelerated TSDF algorithms have become a de-facto standard in scene reconstruction from depth images, leveraging inexpensive sensors and massive parallel processing on GPUs for good real-time performance. By modeling the closest distance to the next surface with a signed distance function (SDF), geometry can be reconstructed by finding the zerotransition from positive (i.e. in front of the surface) to negative (i.e. behind the surface) values. In practice, this function is obtained by fusing measurements into a regular grid, the so called voxels, and interpolating between them. The necessity to store both front-and backside of the surface implies, however, that there is a minimum thickness of objects that can be represented. Especially with thin objects, integration of new measurements might interfere with and contradict old data belonging to a different surface, leading to a corrupted model. We have explored this issue and introduced the concept of the Directional Truncated Signed Distance Function (DTSDF) in our previous work [2]. The DTSDF uses six TSDF volumes, one for each positive and negative coordinate axis, to store surface sections with different orientations. We proposed a method for fusing depth images into this data structure and for extracting meshes with a modified marching cubes algorithm. The latter is, however, not applicable for real-time tracking applications.
Instead, in this work we propose methods for rendering virtual camera views, which allows to use standard geometric ICP for real-time sensor motion tracking. Moreover, we introduce color integration into the DTSDF, which helps preserving color details of adjacent object surfaces, especially along sharp edges. With these additions, the DTSDF This research has been supported by MBZIRC 2017 price money. becomes a true replacement for the regular TSDF with only minor modifications to the fusion and rendering algorithms. We evaluate our method on well-known datasets and show, that the DTSDF has advantages in tracking certain types of sequences and is better at preserving the overall map for later reuse.

II. RELATED WORK
In 3D reconstruction and SLAM feature-based, sparse, and dense methods are distinguished. Our work belongs to the category of dense methods that describe closed surfaces, separate objects, and even free space [3].
Research focus in this field has shifted in recent years towards learned representations. Occupancy networks [4] learn a binary descriptor describing the occupancy of space, i.e. whether a point lies inside an object or not. In DeepSDF by Park et al. [5], a representation is learned, which like our work allows querying the signed distance to the closest object for arbitrary points in space. Neural Radiance Fields (NeRF) [6], [7] use deep networks to regress density and color. While these approaches show impressive results, use less memory to store the model or even enable scene completion, they have some shortcomings. The limited model size results in a lack of detail for large scenes. Also training and inference times are still several orders of magnitude higher, making them unusable for real-time applications. Hence, the classic TSDF fusion algorithms are still state-of-the-art in live mapping scenarios.
Since its first occurrence, the TSDF fusion algorithm has seen widespread use cases and is mostly used without changes to the representation. There have been attempts to augment it, though. Dong et al. [8] created a hybrid data structure, combining the TSDF with probabilistic surfels. Multiple overlapping TSDF sub-volumes are used in pose graphs for large-scale SLAM, enabling re-aligning parts of the map on loop closure detection for consistency [9], [10]. This approach is similar to the DTSDF in that it maintains several overlapping representations, but does not fix the TSDF's inability to represent thin objects observed from opposite sides within the same volume. While this may not be an issue for some applications, object scans and walkaround type scenes profit from this capability.
Zhang et al. [11] give an overview of current RGB-D SLAM algorithms. The typical method for localizing the sensor pose in the TSDF is frame-to-model geometric ICP [1], where a back-projected point cloud from the previous position is used with the point-to-plane metric and Gauss Newton for minimizing the registration error. There are modified versions, such as the extended ICP tracker [12], which uses the Huber-norm and has advanced outlier detection. But the regular ICP is still most commonly used.
Photometric ICP instead uses a registration loss that is based on RGB values [13]. This is helpful in geometrically ambiguous scenes, e.g. planar surfaces. Hybrid approaches combine both schemes [9], [14], [15]. Common for the ICP family of algorithms is, that they use depth maps and rendered images generated from the model for registering current input images.
The direct volume matching line of algorithms directly performs registration within the SDF. Point-to-SDF [16], [17] and SDF-to-SDF [18] approaches can be distinguished. Millane et al. [19] recently proposed a method for extracting and matching local features directly on the SDF.
Further hybrid approaches utilize other tracking sources. BundleFusion [15] is an advanced method that uses ICP error minimization and visual SIFT features in a global bundle adjustment, and then de-and reintegrates parts of scene to keep an overall representation consistent.
The goal of this work is to make DTSDF usable as replacement or supplement for the regular TSDF. To be able to profit from established tracking methods without further modifications we • introduce color fusion into the DTSDF, • present an efficient method for generating rendered views of the DTSDF, • use these rendered views to track sensor motion with the ICP algorithm.

III. FUSION AND WEIGHTS
Formally, the signed distance function Φ : R 3 −→ (d, w d , c, w c ) maps an arbitrary point in space to a tuple comprising signed distance to the closest surface d, distance weight w d , RGB color c and color weight w c , where the weights represent the confidence of the integrated information. As reconstruction only requires information close to the actual surface, the TSDF only maps points within a truncation band around the actual surface. In practice, the TSDF is stored as a evenly-spaced grid of voxels and Φ is estimated by linear interpolation between the stored tuples.
Fusion is the process of integrating new observations into the voxels as weighted cumulative moving average, where weights denote the certainty of the added information. While there is no definite weighting scheme, most implementations use a combination of factors to compensate for measurement noise and for uncertainty by down-weighting voxels behind the surface [1], [20], [21]. In addition to these factors, the fusion weight in [2] includes a direction factor w D dir = n, v D to linearly blend surfaces which fall into multiple directions over the whole span of [0, π/4]. Then, all w D dir are explicitly compared to threshold cos θ and fused, if larger. Instead, we propose the membership function which has two advantages: firstly, it only blends overlapping parts up to θ with the full [0, 1] range (cf. Fig. 2), whereas the old weight had an effective range of [4θ/π, 1] and no exclusive area. Secondly, it makes explicit thresholding superfluous.  Color is fused analogous to distances, but with a different weight. Again, there are different variants throughout literature. Dryanovski et al. [22] use the same constant weight for depth and color to save computation time. Whelan et al. [14] use angle between depth normal and view ray to downweight steep observation angles, which Bylow et al. [20] use in combination with the depth weight. This factor is also included in our depth weight. We argue that using the depth fusion weight for colors is important, as the uncertainty is reflected in the choice of voxels associated with pixels. Our color weight is where w new d is the depth fusion weight, p the depth point and x the voxel position. The additional factor reduces the confidence for voxels further away from the surface, as multiple colors from various observations may blend together here and there is no equivalent to the point-to-plane metric, which mitigates this issue for depth fusion.
Free space, that is space between camera and observed surface, is not explicitly mapped to save memory. Nonetheless, due to noise, sensor error, or dynamic objects it can happen that spurious measurements are mapped in space, that is unoccupied in reality, and it is important to remove these artifacts. When the computed distance Eq. (3) is larger than the truncation range τ , the voxel is located in free space and updated with a SDF value of 1 and a constant weight. No directional weight is used in this case, as the goal is to carve everything in free space. Special care has to be taken at depth discontinuities: carving can corrupt voxels of edges, because aliasing and small tracking inaccuracies associate the voxel with a more distant surface. Therefore, carving is only applied if there is no depth difference of more than τ in a radius of two pixels to the associated depth pixel. To free up memory, voxels that are erroneously allocated but become free space by repeated carving can be recycled in an asynchronous process, as has been done in [23].
The signed distance ∈ [−1, 1] for a voxel position x is computed with the point-to-plane metric for depth point p with normal n and truncation range τ , which helps keeping the SDF consistent with varying observation angles as opposed to the point-to-point metric [20]. While in our previous work [2] we explored ray casting similarly to Klingensmith et al. [24] for fusing individual depth pixels along the view-or normal direction, this method often shows bad results with noisy real-world data. For tracking applications, voxel projection, like in the original KinectFusion, has proven more robust. During voxel projection fusion, all allocated voxels in the view frustum are projected into the current camera frame, associated with a depth (and color) pixel, and updated by these values.

IV. DTSDF RAYCAST RENDERING
Rendering real-time views of the model from arbitrary positions is useful for visualization and also tracking. Instead of developing specialized tracking methods for the DTSDF, our approach is to render a map of depth points and use known and tested ICP-based algorithms [1], [12], [13], [9] to register input depth images. The rendering process involves casting a ray per pixel of the virtual depth camera and extracting the iso-surface, i.e. the first transition from positive to negative SDF values. This involves probing the TSDF along the ray at regular intervals, until the distance turns negative and then multiple small steps, determined by the interpolated SDF value, to minimize the absolute distance value. Similar to the meshing presented in [2] the question is: how to combine up to six SDF values from partially overlapping directions?
By its mathematical definition, the signed distance function can represent any given object. In other words, the six directions could, given a fine enough resolution, be combined into a single, conflict-free TSDF. But in practice, the combination is not straight forward: overlapping free and occupied space from different volumes has to be combined in accordance with the orientation of mapped surfaces, while considering corner cases, real-world noise and imperfections. Also, the practical use is limited. Ray-cast rendering relies on the width of the truncation range for finding zero-transitions, which for thin objects can be easily missed. Instead, we made an important observation: For a DTSDF and a fixed camera position, a combined conflict-free regular TSDF with the same voxel resolution can be computed.
The basic intuition behind this lemma is, that surfaces the camera perceives from the backside are not relevant from a given position. Fig. 3 depicts a comparison of both variants. For the camera position in Fig. 3b, the free space above the object is not required and the wider band of negative SDF values makes it easier to ray-cast.
Computing the true combination of directions is complicated and contains many corner cases. Instead we propose a simple weighting scheme as approximation. For a point x ∈ R 3 and direction D, let n D be the normalized SDF gradient (∂Φ D /∂x, ∂Φ D /∂y, ∂Φ D /∂z) at x, w D d the stored distance weight and r the normalized view ray from camera center to x. Then the combination weight for direction D is defined as The first factor in Eq. (4) ensures that only gradients that actually comply with the direction they are stored in are used, with according weights to blend between directions. The second factor ensures that only directions with eligible surfaces are used, which is the main reason for using the DTSDF. The approximation is not perfect and certain constellations work only under the premise, that all direction's SDF weights are similar. On the other hand, it has shown to be more robust in practice than other, more sophisticated attempts we've tried. These per-direction weights can be used to directly look up the combined SDF value at any point in space as weighted sum, but ray-casting becomes very slow, because many TSDF lookups and memory reads have to be performed, especially for the gradient computation. The massive parallel computation also results in many cache misses, so the algorithm becomes memory bound. As suggested in Lemma 1, a view-dependent combined TSDF can be pre-computed by calculating the combined SDF for every voxel in the view frustum. This combined TSDF can then be used like a regular TSDF, but only for ray-casting from the pose used during combination. As a bonus, this opens up yet another class of tracking algorithms: the direct volume matching type, that perform registration directly within the SDF [16], [17], [18].
To always use the most recent observations, all voxels that received new information during fusion also need to be updated in the combined TSDF. But for static scenes this is not always necessary. Instead, we use conditional combination. Only meeting one of the following criteria triggers an update of the combined TSDF: boot up (5) framesSinceLastUpdate > 50, stale state (6) pose − lastPose translation > 0.05 m, translation (7) pose − lastPose angle > 0.05 The boot up condition Eq. (5) ensures, that during the first frames where the map is still uncertain, always the most recent data is used for tracking. Eq. (6) enforces regular updates in case the camera does not move. Eq. (7, 8) are a relaxation of Lemma 1, that states minor changes in the camera pose don't change the combined TSDF, similar to small-motion assumption on which the data association for ICP is based [1]. We experimentally chose the thresholds relatively small, so as not to violate the underlying assumption. A more thorough investigation on the impact of these limits would be interesting. On the tested sequences, the update is triggered on average around every third frame. By also selecting voxels slightly beyond the camera frustum (±1/8 image size), motions of the camera will not leave the scope of the combined TSDF before triggering a recalculation. Voxels that receive data for the first time are always directly added to the combined TSDF.
To prevent empty voxels in the absence of gradients in all directions (e.g. at edges), the weights are used instead. Among other changes, the implementation now uses the stdgpu library by Stotko [27] to replace several components, especially the original hash map, which could not allocate blocks with colliding hash values within the same iteration.
Unlike the previous DTSDF implementation presented in [2] where 6 separate TSDF volumes were used for the different directions, here only a single TSDF is utilized. The hash index is extended from (x, y, z) ∈ Z 3 to (x, y, z, D) ∈ Z 3 × Directions. This simplifies many functions and better utilizes the statically allocated memory on the GPU: For most scenes the DTSDF has an imbalance of direction-usage, which wastes a lot of memory in the old scheme. Resizing the volumes is an option, but requires additional overhead which can be simply avoided by the aforementioned modification.
The time for computing the rendering TSDF is crucial for real-time usage of our method. It can be significantly sped up by taking advantage of the lookup positions being only integer voxel positions. Hence, no trilinear interpolation is required and the gradient can be computed with just looking up the SDF values stored in the 6 neighboring voxels. We further managed to halve the time by pre-caching the TSDF lookups for all voxels of the same block in shared memory. At the very most, for every direction there are the current block and its six neighboring blocks, so a total of 48 are looked up at the beginning.
As a proof of concept, we use the pipeline depicted in Fig. 1 with the default geometric ICP tracker.
VI. EVALUATION   Fig. 4 clearly shows the DTSDF's advantage in color separation. While in the regular TSDF (Fig. 4a) the colors blend because of fusion from two surfaces into the same voxels, the DTSDF retains different colors across edges (Fig. 4c). Fig. 4d shows which directions contribute to which rendered pixel.
The datasets used in our evaluation are the Stanford 3D Scene Data (totempole, etc.) [28], ICL NUIM [29], Zhou [30] and the TUM RGB-D benchmark [31]. The sequences ICL lr0 and ICL office kt1 are skipped, because they contain a geometrically ambiguous segment which is not trackable with geometric ICP.

A. ICP Tracking
For comparing the tracking performance, we evaluate the regular TSDF (marked state-of-the-art, SoTA) against the DTSDF by running scenes from the aforementioned datasets and comparing the tracking results against the provided ground-truth trajectory using the relative pose error (RPE) with a window size of 30 frames (1 s). Note that this study does not try to compare to complete SLAM algorithm with loop closure detection and correction, but showcases the performance of the DTSDF relative to the regular TSDF as an enhanced data structure. All settings are equal across both modes and the tracker uses the default geometric ICP algorithm.
As expected, tracking does benefit from the DTSDF in scenes, where the camera observes thin structure from different angles. Otherwise, there is no significant difference.
The first test on artificially generated sequences from the ICL NUIM and Zhou datasets is reported in Tab. I for different voxel sizes. Note that the noise-augmented sequences are being used. The tracking performance is similar for most sequences, which is likely due to the mapped environments, which are convex rooms where the regular TSDF does not display its issues. The Zhou office sequences, a scene of cluttered office desks scanned from different directions, provides an environment where the DTSDF actually has an advantage, which is reflected in the RPE. Tab. II does the same comparison on the turntable-like dataset used in the original DTSDF paper [2]. In those sequences the camera orbits around a center point and only the model is visible, which is challenging to track due to the details and high percentage of thin structure wrt. to the whole scene. The RPE distinctly shows the strength of the DTSDF.
Tab. III shows the results with real-world scans from the TUM dataset, with very similar results. Large planar surfaces with sharp corners (structure notex sequences) seem to benefit from the DTSDF. Here, the measurements have to be considered with care, as the underlying ground-truth is not perfect.

B. Map Reusability
Overall, the tracking results show, that the DTSDF generally only has an advantage in sequences, where the camera observes structure from different sides. In those sequences, the performance is significantly better, especially with increasing voxel size, as the problems of the regular TSDF increase as well. In all other sequences the performance is very similar, which is also due to the fact that the fusion process makes the locally visible area compliant: given enough observations from the current viewpoint, all conflicts in the representation will be evened out due to the running   average (unless the conflicting side has been observed a long time, resulting in a high weight). In many cases this does not become apparent during tracking, but for the reusability of the overwritten parts of the completed map it is important to test these effects. To this end, we propose the postfusion per-frame error: after completing fusion of the entire sequence, for every estimated pose, a depth map is rendered again and compared to the corresponding input depth image by computing the pixel-wise mean absolute error (MAE). Fig. 5 shows on the example of the fr3 long office sequence that although the tracking performance is very similar, the DTSDF is better at retaining the map. Tab. IV lists the post-fusion MAE of a selection of sequences (a complete list can be found in the Appendix Tab. V). One can observe that in most cases there is not too much difference, especially in concave rooms like the ICL sequences. The effect usually only affects small parts of the model, like a corner or a computer monitor. Consequently, for the mean error over the whole image the effect is not that significant, but visible nonetheless. Objectscanning type sequence with the camera orbiting around objects generally seem to profit from the DTSDF more (c.f. Fig. 6). Decreasing the voxel size certainly does mitigate some of these issues for the SoTA, but ultimately the effect highlighted by the lower left rectangle remains for thin surfaces. Also, as Tab. I, III show, halving the voxel size instead of using the DTSDF will require more memory and computation time.

C. Runtime and Memory Consumption
All experiments were performed on an Intel i7-8700K with 3.70GHz and a GeForce RTX 3090. The CPU part of the code runs entirely on a single core. By reducing the changes to rendering the DTSDF while keeping the rest of the pipeline original, the runtime only differs in allocation, fusion and rendering. Fig. 7 breaks down and compares runtimes for different voxels sizes. One can observe that the additional overhead is quite small. Note that for this example conditional combination was activated, and a rendering TSDF was computed for 35-40% of the frames with the conditions specified in Eq. (5)- (8). As expected, the memory usage of the DTSDF is higher, as surfaces can overlap in up to three directions. In Fig. 8 the ratio of additional memory required by the DTSDF w.r.t. the regular TSDF is displayed for ICL NUIM scenes. For smaller voxels, the amount for extra memory is quite small. With increasing voxel size, the ratio increases as blocks are allocated in chunks of 8 × 8 × 8 voxels and more surfaces with different orientations fall into the same block, though the actual number of blocks is significantly smaller. Fig. 9 plots the memory ratio for various sequences of the datasets fused with 5 mm voxel size. It is also noticeable, that synthetic datasets (ICL, Zhou) use less memory than real ones. This is probably noise-related, as the depthnoise augmented ICL sequences also have a higher ratio, which suggests that with a more conservative allocation scheme memory can be saved. At the moment even for stray measurements blocks are allocated, as long as they have a valid normal. As surfaces can be fused into up to three directions, determined by Eq. (1), an interesting question is how the alignment of the map coordinate frame to the scene affects memory usage. For this, we pre-computed initial  poses for each sequence by identifying the largest planes of the sequence. In the best case scenario (Fig. 9a), the coordinate axes are parallel; in the worst case (Fig. 9b), tilted 45°to the identified planes. Noticeably, the alignment does have an effect, but not very significant. This is, however, highly dependent on the scenes and voxel sizes, because it induces only a one-time cost. Automating this process at the initialization phase of mapping is recommended.
Overall for the majority of scenes the DTSDF requires around 1.5 to 2 times as much memory as the regular TSDF.

VII. CONCLUSIONS
In this work, we introduced the tools to use the DTSDF as a drop-in replacement for regular TSDF for mapping, tracking, and visualization applications. The ability to simply extract a regular TSDF for a given pose enables using it for a variety of tasks and with many algorithms that have been developed over the years.
We have shown that the DTSDF has advantages over the state-of-the-art for certain types sequences, like object scans, in both quality and quantity. Moreover, with the post-fusion MAE metric we shown that, while the regular TSDF is usable for local maps, reusability and revisiting of mapped places becomes problematic, if conflicting information from different surfaces corrupts the model. With reasonable memory-and computation overhead, better results and a more consistent map can be obtained by the proposed DTSDF method.