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§

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

Macros§

Functions§