Skip to content

Performant ray tracing on CPU and GPU

JuliaGeometry/Raycore.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raycore.jl

Build Status

High-performance ray-triangle intersection engine with BVH acceleration for CPU and GPU.

Features

  • Fast BVH acceleration for ray-triangle intersection
  • CPU and GPU support via KernelAbstractions.jl
  • Analysis tools: centroid calculation, illumination analysis, view factors for radiosity
  • Makie integration for visualization

Getting Started

using Pkg
Pkg.add(url="https://github.com/JuliaGeometry/Raycore.jl")

Basic Ray Intersection

using Raycore, GeometryBasics, LinearAlgebra

# Create geometry
sphere = Tesselation(Sphere(Point3f(0, 0, 2), 1.0f0), 20)

# Build BVH acceleration structure
bvh = BVHAccel([sphere])

# Cast rays and find intersections
ray = Ray(o=Point3f(0, 0, 0), d=Vec3f(0, 0, 1))
hit_found, triangle, distance, bary_coords = closest_hit(bvh, ray)

if hit_found
    hit_point = ray.o + ray.d * distance
    println("Hit at distance $distance: $hit_point")
end

Analysis Features

# Calculate scene centroid from a viewing direction
viewdir = normalize(Vec3f(0, 0, -1))
hitpoints, centroid = get_centroid(bvh, viewdir)

# Analyze illumination
illumination = get_illumination(bvh, viewdir)

# Compute view factors for radiosity
vf_matrix = view_factors(bvh; rays_per_triangle=1000)

Documentation

Ray tracing example

About

Performant ray tracing on CPU and GPU

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages