Crate solstrale

Source
Expand description

A multithreaded Monte Carlo path tracing library, that as such has features like:

  • Global illumination
  • Caustics
  • Reflection
  • Refraction
  • Soft shadows

Additionally, the library has:

  • Loading of obj models with included materials
  • Multithreaded Bvh creation to greatly speed up rendering
  • Post-processing of rendered images by:
  • Bump mapping
  • Light attenuation

§Example:

let camera = CameraConfig {
    vertical_fov_degrees: 20.,
    aperture_size: 0.1,
    look_from: Vec3::new(0., 0., 4.),
    look_at: Vec3::new(0., 0., 0.),
    up: Vec3::new(0., 1., 0.),
};
let mut world = Vec::new();
let yellow = Lambertian::new(SolidColor::new(1., 1., 0.), None);
let light = DiffuseLight::new(10., 10., 10., None);
world.push(Sphere::new(Vec3::new(0., 0., 0.), 0.5, yellow));

let scene = Scene {
    world: Bvh::new(world),
    camera,
    background_color: Vec3::new(0.2, 0.3, 0.5),
    render_config: RenderConfig::default(),
};

let (output_sender, output_receiver) = channel();
let (_, abort_receiver) = channel();

thread::spawn(move || {
    ray_trace(scene, &output_sender, &abort_receiver).unwrap();
});

for render_output in output_receiver {
    let _image = render_output.render_image;
}

§Example output

bedroom2 conference happy sponza-bump2

§Credits

The ray tracing is inspired by the excellent Ray Tracing in One Weekend Book Series by Peter Shirley

Modules§

camera
Provides a camera used by raytracer to shoot rays into the scene
geo
Basic geometric constructs
hittable
Objects that are hittable by rays shot by the ray tracer. Some of these hittable objects are containers for other objects
loader
Module containing object model loaders
material
Materials to be applied to hittable objects
pdf
Probability density functions
post
Post processors for applying effects to the raw rendered image
random
A wrapper for the random number generator to be used by ray tracer.
renderer
The renderer takes a Scene as input, renders it and reports RenderProgress
util
Various small helpers used by the raytracer

Macros§

combine_aabbs
Combines the given Aabb arguments into a single Aabb encapsulating all

Functions§

ray_trace
Executes the ray tracing with the given Scene and reports RenderProgress on the output Sender. Listens to abort Receiver for aborting a started ray trace operation