Fix the invalid labeling encoding causing memory issues
Fixes an issue of invalid memory accesses.
The crux of the problem is using incorrect value in the material relabeler. The Vec3d result variable was uninitialized and the values from this vector were erroneously used to fill in the map, which caused new materials to always appear, causing the indexing issues later.