nmwsharp / nmwsharp/polyscope

Volume Grid Isosurface mesh issue

Đang mở
#285 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
C++
Star
2.2k
Fork
242
Merge trung bình
11 phút
Pull request đã merge (30 ngày)
1

Mô tả

Hi,

I've run into an issue with the isosurface generation for volume grid scalar quantities. The problem appears to be that the change made to fix the frame transformation for #253 wasn't propagated into the grid dimensions passed to the MarchingCube library, resulting in the grid cells being interpreted in the wrong order.

The following shows a volume grid of the Stanford Bunny and its isosurface visualization with the 2.2.1 release:
Polyscope_Isosurface_Issue

By swizzling the grid dimensions passed into MarchingCube we get the following (correct) result instead:
Polyscope_Isosurface_Fix

The patch for the above fix is:

diff --git a/src/volume_grid_scalar_quantity.cpp b/src/volume_grid_scalar_quantity.cpp                                 
index cde441a..603841f 100644                                                                                          
--- a/src/volume_grid_scalar_quantity.cpp                                                                              
+++ b/src/volume_grid_scalar_quantity.cpp                                                                              
@@ -165,8 +165,8 @@ void VolumeGridNodeScalarQuantity::createIsosurfaceProgram() {                                     
                                                                                                                       
   // Extract the isosurface from the level set of the scalar field                                                    
   MC::mcMesh isosurfaceMesh;                                                                                          
-  MC::marching_cube(&values.data.front(), isosurfaceLevel.get(), parent.getGridNodeDim().x, parent.getGridNodeDim().y,
-                    parent.getGridNodeDim().z, isosurfaceMesh);                                                       
+  MC::marching_cube(&values.data.front(), isosurfaceLevel.get(), parent.getGridNodeDim().z, parent.getGridNodeDim().y,
+                    parent.getGridNodeDim().x, isosurfaceMesh);                                                       
                                                                                                                       
   // Transform the result to be aligned with our volume's spatial layout                                              
   glm::vec3 scale = parent.gridSpacing();                                                                             
@@ -215,8 +215,8 @@ SurfaceMesh* VolumeGridNodeScalarQuantity::registerIsosurfaceAsMesh(std::string                    
                                                                                                                       
   // extract the mesh                                                                                                 
   MC::mcMesh isosurfaceMesh;                                                                                          
-  MC::marching_cube(&values.data.front(), isosurfaceLevel.get(), parent.getGridNodeDim().x, parent.getGridNodeDim().y,
-                    parent.getGridNodeDim().z, isosurfaceMesh);                                                       
+  MC::marching_cube(&values.data.front(), isosurfaceLevel.get(), parent.getGridNodeDim().z, parent.getGridNodeDim().y,
+                    parent.getGridNodeDim().x, isosurfaceMesh);                                                       
   glm::vec3 scale = parent.gridSpacing();                                                                             
   for (auto& p : isosurfaceMesh.vertices) {                                                                           
     // swizzle to account for change of coordinate/buffer ordering in the MC lib                                      

I'm not sure how you prefer to manage the repo, but if you'd like me to open a PR for the fix I'm happy to. Thanks!

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu trong src/volume_grid_scalar_quantity.cpp, kiểm tra createIsosurfaceProgram() và registerIsosurfaceAsMesh(), nơi các lệnh gọi MarchingCube và phép biến đổi tọa độ được thể hiện. So sánh thứ tự các chiều của lưới trong cả hai nhánh với bố cục của bộ đệm thể tích. Hoàn thành khi các isosurface của volume-grid được kết xuất với hướng và thứ tự ô chính xác trong cả hai trường hợp sử dụng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp
Lĩnh vực
computer-graphics
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.