Skip to content
This repository has been archived by the owner on Dec 3, 2022. It is now read-only.
/ raytracing Public archive

A CUDA Mesh RayTracer with BVH acceleration, with python bindings and a GUI.

License

Notifications You must be signed in to change notification settings

ashawkey/raytracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RayTracer

A CUDA Mesh RayTracer with BVH acceleration.

Install

git clone https://github.com/ashawkey/raytracing
cd raytracing
pip install .

Usage

Example for a mesh normal renderer:

python renderer.py # default, show a dodecahedron
python renderer.py --mesh example.ply # show any mesh file
gui.mp4

Example code:

import numpy as np
import trimesh

import torch
import raytracing

# build BVH from mesh
mesh = trimesh.load('example.ply')
RT = raytracing.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 = RT.trace(rays_o, rays_d) # [N, 3], [N, 3], [N,]

Acknowledgement

About

A CUDA Mesh RayTracer with BVH acceleration, with python bindings and a GUI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published