Skip to content

Gorilla-Lab-SCUT/raycastmesh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ray Casting Mesh

A CUDA Mesh RayTracer with BVH acceleration. Copy from here, add face_id of mesh as output.

Install

git clone https://github.com/Gorilla-Lab-SCUT/raycastmesh
cd raycastmesh
pip install .

Usage

Example code:

import numpy as np
import trimesh

import torch
import raycastmesh

# build BVH from mesh
mesh = trimesh.load('example.ply')
RT = raycastmesh.RayTracer(mesh.vertices, mesh.faces) # build with numpy.ndarray

# get rays
rays_o, rays_d = get_ray(pose, intrinsics, H, W) # [N, 3], [N, 3], query with torch.Tensor (on cuda)

# query ray-mesh intersection
intersections, face_normals, depth, face_ids = RT.trace(rays_o, rays_d) # [N, 3], [N, 3], [N,], [N,]

Acknowledgement

About

ray cast mesh to get normal, depth and face_ids

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published