Summary of Changes
Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the COLMAP UI by integrating native support for 3D surface mesh visualization. It streamlines the workflow for users by allowing them to directly import and view meshed models, including those generated by COLMAP's dense reconstruction pipeline, without relying on external software. The changes also introduce a wireframe rendering option and robust improvements to PLY file parsing to support diverse mesh data.
Highlights
- Surface Mesh Visualization: Introduced the ability to visualize surface meshes directly within the COLMAP viewer, eliminating the need for external tools like Meshlab.
- New Import Options: Replaced the generic 'Import model from...' action with specific 'Import point cloud' and 'Import surface mesh' options in the File menu, providing clearer functionality.
- Automatic Mesh Loading: Meshed models (Poisson or Delaunay) generated during dense reconstruction are now automatically loaded and displayed in the viewer upon completion.
- Wireframe Rendering: Added a new rendering option to display imported surface meshes in wireframe mode.
- PLY File Parsing Improvements: Enhanced the PLY file reader to correctly parse vertex color properties and handle various data types and endianness for both ASCII and binary mesh files.
- New MeshPainter Class: Implemented a dedicated
MeshPainterclass and associated GLSL shaders to efficiently render 3D meshes with normals and colors.
- src/colmap/ui/CMakeLists.txt
- Added
mesh_painter.handmesh_painter.ccto the UI library build.
- Added
- src/colmap/ui/automatic_reconstruction_widget.cc
- Modified dense reconstruction completion message to reflect in-viewer visualization for point clouds and surface meshes.
- Added logic to automatically load Poisson or Delaunay meshed models into the viewer if available after dense reconstruction.
- src/colmap/ui/dense_reconstruction_widget.cc
- Included
render_options.h. - Renamed
show_meshing_info_action_towrite_surface_mesh_action_and updated its connected slot. - Modified
Fusioncallback to directly write fused points to a PLY file and load them into themodel_viewer_widget_. - Updated
PoissonMeshingandDelaunayMeshingto load generated meshes into themodel_viewer_widget_and trigger thewrite_surface_mesh_action_. - Simplified
WriteFusedPointsandShowMeshingInfo(nowWriteSurfaceMesh) to primarily trigger rendering and enable meshing buttons.
- Included
- src/colmap/ui/dense_reconstruction_widget.h
- Removed unused includes (
fusion.h,options_widget.h). - Renamed
show_meshing_info_action_towrite_surface_mesh_action_. - Removed
fused_points_andfused_points_visibility_members.
- Removed unused includes (
- src/colmap/ui/main_window.cc
- Included
render_options.handply.h. - Replaced 'Import model from...' action with separate 'Import point cloud' and 'Import surface mesh' actions.
- Updated the File menu to include new import actions.
- Refactored project opening logic for clarity.
- Renamed
ImportFromtoImportPointCloudand addedImportSurfaceMeshto handle loading respective file types. - Modified
RenderSelectedReconstructionto handle cases where no reconstruction is loaded but a point cloud or surface mesh is present.
- Included
- src/colmap/ui/main_window.h
- Renamed
ImportFrommethod toImportPointCloudand addedImportSurfaceMesh. - Updated corresponding
QActionmembers for new import functionalities.
- Renamed
- src/colmap/ui/mesh_painter.cc
- Added new C++ source file implementing
MeshPainterfor OpenGL mesh rendering, including setup, data upload, and rendering with wireframe support.
- Added new C++ source file implementing
- src/colmap/ui/mesh_painter.h
- Added new header file defining the
MeshPainterclass, including aDatastruct for vertex attributes (position, normal, color) and rendering methods.
- Added new header file defining the
- src/colmap/ui/model_viewer_widget.cc
- Included
render_options.h. - Integrated
point_cloud_painter_andmesh_painter_for rendering. - Updated
paintGLto render both point clouds and meshes. - Modified
ReloadReconstructionto upload point cloud and surface mesh data. - Cleared
point_cloudandsurface_meshonClearReconstruction. - Initialized
point_cloud_painter_andmesh_painter_inSetupPainters. - Added
UploadPointCloudDataandUploadSurfaceMeshDatamethods to prepare data for rendering.
- Included
- src/colmap/ui/model_viewer_widget.h
- Included
mesh_painter.handply.h. - Added
std::optional<std::vector<PlyPoint>> point_cloudandstd::optional<PlyMesh> surface_meshmembers. - Declared
UploadPointCloudDataandUploadSurfaceMeshDatamethods. - Added
point_cloud_painter_andmesh_painter_members.
- Included
- src/colmap/ui/movie_grabber_widget.cc
- Included
render_options.h.
- Included
- src/colmap/ui/render_options.h
- Added
mesh_wireframeboolean option to control mesh rendering.
- Added
- src/colmap/ui/render_options_widget.cc
- Included
render_options.h. - Added a UI option for
mesh_wireframein the render options widget.
- Included
- src/colmap/ui/resources.qrc
- Added references to new GLSL shader files (
mesh.v.glsl,mesh.g.glsl,mesh.f.glsl).
- Added references to new GLSL shader files (
- src/colmap/ui/shaders/mesh.f.glsl
- Added new GLSL fragment shader for mesh rendering, including lighting and wireframe logic.
- src/colmap/ui/shaders/mesh.g.glsl
- Added new GLSL geometry shader for mesh rendering, passing barycentric coordinates for wireframe effect.
- src/colmap/ui/shaders/mesh.v.glsl
- Added new GLSL vertex shader for mesh rendering, transforming vertex positions and normals.
- src/colmap/util/ply.cc
- Enhanced
ReadPlyMeshto correctly parse vertex properties (x, y, z, r, g, b) and face indices from both ASCII and binary PLY files. - Added logic to track vertex property indices and byte positions, handling different data types and endianness.
- Enhanced
- src/colmap/util/ply.h
- Extended
PlyMeshVertexstruct to includer,g,bcolor components with default gray values. - Added a new constructor for
PlyMeshVertexto initialize with color.
- Extended
- src/colmap/util/ply_test.cc
- Included
<fstream>for file operations in tests. - Added new test cases for
PlyMeshVertexconstructors, including the new color constructor. - Added tests for reading text and binary PLY meshes with vertex colors and extra properties, ensuring correct parsing.
- Included
- The pull request introduces new functionality for viewing surface meshes directly within the COLMAP UI.
- The author
ahojnneshas implemented new UI elements for importing meshes and point clouds. - Rendering logic for meshes, including a wireframe mode, has been added.
- The underlying PLY file parsing has been updated to support vertex colors and various data types.
- Screenshots in the PR description demonstrate the new mesh viewing capabilities.
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with ๐ and ๐ on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. โฉ