Commit 6094bf8e authored by ashawkey's avatar ashawkey
Browse files

add some notes

parent 0e2fca65
...@@ -18,6 +18,7 @@ class cuBVH(): ...@@ -18,6 +18,7 @@ class cuBVH():
if torch.is_tensor(vertices): vertices = vertices.detach().cpu().numpy() if torch.is_tensor(vertices): vertices = vertices.detach().cpu().numpy()
if torch.is_tensor(triangles): triangles = triangles.detach().cpu().numpy() if torch.is_tensor(triangles): triangles = triangles.detach().cpu().numpy()
# check inputs
assert triangles.shape[0] > 8, "BVH needs at least 8 triangles." assert triangles.shape[0] > 8, "BVH needs at least 8 triangles."
# implementation # implementation
......
...@@ -24,6 +24,7 @@ import cubvh ...@@ -24,6 +24,7 @@ import cubvh
### build BVH from mesh ### build BVH from mesh
mesh = trimesh.load('example.ply') mesh = trimesh.load('example.ply')
# NOTE: you need to normalize the mesh first, since the max distance is hard-coded to 10.
BVH = cubvh.cuBVH(mesh.vertices, mesh.faces) # build with numpy.ndarray/torch.Tensor BVH = cubvh.cuBVH(mesh.vertices, mesh.faces) # build with numpy.ndarray/torch.Tensor
### query ray-mesh intersection ### query ray-mesh intersection
......
...@@ -411,6 +411,7 @@ public: ...@@ -411,6 +411,7 @@ public:
for (uint32_t i = 0; i < N_STAB_RAYS; ++i) { for (uint32_t i = 0; i < N_STAB_RAYS; ++i) {
// Use a Fibonacci lattice (with random offset) to regularly // Use a Fibonacci lattice (with random offset) to regularly
// distribute the stab rays over the sphere. // distribute the stab rays over the sphere.
// ref: http://extremelearning.com.au/how-to-evenly-distribute-points-on-a-sphere-more-effectively-than-the-canonical-fibonacci-lattice/
Vector3f d = fibonacci_dir<N_STAB_RAYS>(i, offset); Vector3f d = fibonacci_dir<N_STAB_RAYS>(i, offset);
// If any of the stab rays goes outside the mesh, the SDF is positive. // If any of the stab rays goes outside the mesh, the SDF is positive.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment