This is my personal modification to the code in the data preprocessing section of project DeepSDF, which works for the latest version of Pangolin (0.9.2).
Tested only on the Windows 11 64-bit platform.
Similar to the DeepSDF repository, the preprocessing code is in C++ and has the following requirements:
To make it easier to configure the environment, requirements are in DeepSDF_Preprocessing/third-party directory. With these dependencies, the build process follows the standard CMake procedure:
cd path\to\DeepSDF_Proprecessing
mkdir build
cd build
cmake ..
make -j
Once this is done there should be two executables in the DeepSDF_Preprocessing/bin directory, one for surface sampling and one for SDF sampling. With the binaries, the dataset can be preprocessed using preprocess_data.py. To preprocess the mesh data for testing, run:
.\bin\Release\PreprocessMesh.exe -m test\chair.obj -o test\sample_chair.npz --ply test\sample_chair.ply
The following modifications are based on this issue:
- Replaced
pangolin::getcalls withstd::getcalls. - Changed
prog.SetUniform("ttt", 1.0, 0, 0, 1);toprog.SetUniform("ttt", 1.0, 0.0, 0.0, 1.0);. - Updated the CMakeLists.txt file:
- Added
set(CMAKE_CXX_STANDARD 17). - Used two header-only libraries: CLI11 and nanoflann.
- Extended the
target_link_librariestotarget_link_libraries(PreprocessMesh PRIVATE pango_core pango_display pango_geometry pango_glgeometry cnpy Eigen3::Eigen).
- Added
The following modifications are based on this issue:
- Commented out the
gl_PrimitiveIDvariable declaration.
The following modifications are from my own changes:
- Added
#undef FARbefore#include<zlib.h>incnpy.h. - Added
#include <wtypes.h>and#define uint UINTinUtils.h. - Commented out the uniform names
ToWorld, slant_thr, tttbecause they are never used in shader.
Similar to the issues listed in #19, #25, and #35, the preprocess_data.py script from DeepSDF failed to generate .npz files on my local development environment. To address this, I developed a simple batch processing tool using the C++17 standard, which includes the following features:
- Relies only on the C++ standard library and the nlohmann library.
- Processes data in batches (default: 8), and the batch size can be adjusted based on device performance and UI responsiveness.
- Requires compilation, unlike the Python script.
The data can be preprocessed, but there are still some bugs. If anyone knows how to fix them, please open an issue. Here are the bugs:
OpenGL Error: GL_INVALID_ENUM: An unacceptable value is specified for an enumerated argument. (1280) In: path\to\DeepSDF_Proprecessing\third-party\pangolin\include\pangolin/gl/gl.hpp, line 202
Attribute name doesn't exist for program (normal)
The OpenGL error does not interrupt execution; it only continuously triggers warnings. To reduce excessive error messages, I commented out the cerr section in the inline GLint GlSlProgram::GetAttributeHandle function within glsl.hpp during Pangolin configuration.
DeepSDF_Preprocessing is relased under the MIT License. See the LICENSE file for more details.
