Volume Grid Isosurface mesh issue
まだ誰も着手していません。
- 主要言語
- C++
- スター
- 2.2k
- フォーク
- 242
- 平均マージ
- 11分
- マージ済み PR(30日)
- 1
説明
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:
By swizzling the grid dimensions passed into MarchingCube we get the following (correct) result instead:
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!
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
src/volume_grid_scalar_quantity.cpp から始め、MarchingCube の呼び出しと座標変換が示されている createIsosurfaceProgram() と registerIsosurfaceAsMesh() を調べます。両方のパスにおけるグリッド次元の順序を、ボリュームバッファのレイアウトと比較します。volume-grid の等値面が、両方の用途で正しい向きとセル順序でレンダリングされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cpp
- 領域
- computer-graphics
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 48/100