ahojnnes ยท GitHub

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 MeshPainter class and associated GLSL shaders to efficiently render 3D meshes with normals and colors.
Changelog
  • src/colmap/ui/CMakeLists.txt
    • Added mesh_painter.h and mesh_painter.cc to the UI library build.
  • 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_ to write_surface_mesh_action_ and updated its connected slot.
    • Modified Fusion callback to directly write fused points to a PLY file and load them into the model_viewer_widget_.
    • Updated PoissonMeshing and DelaunayMeshing to load generated meshes into the model_viewer_widget_ and trigger the write_surface_mesh_action_.
    • Simplified WriteFusedPoints and ShowMeshingInfo (now WriteSurfaceMesh) to primarily trigger rendering and enable meshing buttons.
  • src/colmap/ui/dense_reconstruction_widget.h
    • Removed unused includes (fusion.h, options_widget.h).
    • Renamed show_meshing_info_action_ to write_surface_mesh_action_.
    • Removed fused_points_ and fused_points_visibility_ members.
  • src/colmap/ui/main_window.cc
    • Included render_options.h and ply.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 ImportFrom to ImportPointCloud and added ImportSurfaceMesh to handle loading respective file types.
    • Modified RenderSelectedReconstruction to handle cases where no reconstruction is loaded but a point cloud or surface mesh is present.
  • src/colmap/ui/main_window.h
    • Renamed ImportFrom method to ImportPointCloud and added ImportSurfaceMesh.
    • Updated corresponding QAction members for new import functionalities.
  • src/colmap/ui/mesh_painter.cc
    • Added new C++ source file implementing MeshPainter for OpenGL mesh rendering, including setup, data upload, and rendering with wireframe support.
  • src/colmap/ui/mesh_painter.h
    • Added new header file defining the MeshPainter class, including a Data struct for vertex attributes (position, normal, color) and rendering methods.
  • src/colmap/ui/model_viewer_widget.cc
    • Included render_options.h.
    • Integrated point_cloud_painter_ and mesh_painter_ for rendering.
    • Updated paintGL to render both point clouds and meshes.
    • Modified ReloadReconstruction to upload point cloud and surface mesh data.
    • Cleared point_cloud and surface_mesh on ClearReconstruction.
    • Initialized point_cloud_painter_ and mesh_painter_ in SetupPainters.
    • Added UploadPointCloudData and UploadSurfaceMeshData methods to prepare data for rendering.
  • src/colmap/ui/model_viewer_widget.h
    • Included mesh_painter.h and ply.h.
    • Added std::optional<std::vector<PlyPoint>> point_cloud and std::optional<PlyMesh> surface_mesh members.
    • Declared UploadPointCloudData and UploadSurfaceMeshData methods.
    • Added point_cloud_painter_ and mesh_painter_ members.
  • src/colmap/ui/movie_grabber_widget.cc
    • Included render_options.h.
  • src/colmap/ui/render_options.h
    • Added mesh_wireframe boolean option to control mesh rendering.
  • src/colmap/ui/render_options_widget.cc
    • Included render_options.h.
    • Added a UI option for mesh_wireframe in the render options widget.
  • src/colmap/ui/resources.qrc
    • Added references to new GLSL shader files (mesh.v.glsl, mesh.g.glsl, mesh.f.glsl).
  • 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 ReadPlyMesh to 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.
  • src/colmap/util/ply.h
    • Extended PlyMeshVertex struct to include r, g, b color components with default gray values.
    • Added a new constructor for PlyMeshVertex to initialize with color.
  • src/colmap/util/ply_test.cc
    • Included <fstream> for file operations in tests.
    • Added new test cases for PlyMeshVertex constructors, including the new color constructor.
    • Added tests for reading text and binary PLY meshes with vertex colors and extra properties, ensuring correct parsing.
Activity
  • The pull request introduces new functionality for viewing surface meshes directly within the COLMAP UI.
  • The author ahojnnes has 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.
Using Gemini Code Assist

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

  1. 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. โ†ฉ

Read the original on github.com โ†—