Zen Photon:

Photon Garden Raytracer Impementation.

Rustic Zen renders artworks from a scene definition by simulating individual photons and tracing their path as they bounce through a 2D. space.

Photons are generated by Lights and interact with Objects. Each interaction results in either the photon being absorbed, or being allowed to continue with a new direction, based on the rules defined by the Object's Material.

What this library Provides:

This library holds only the rendering framework and models for defining a scene. Functionality for defining a scene, i.e. generative and animation algorithms are not provided here. The focus of Rustic-Zen is providing the raytrace algorithms for rendering a static scene.

Rustic-Zen provides a single basic shader, for backwards compatiblity with prior art. It is expected that dedicated library users will use the exposed Material trait to create your own shaders.

Example usage:

``` rust extern crate rusticzen; use rusticzen::prelude::; fn main() { // Set up constants. let width: f64 = 3440.0; let height: f64 = 1440.0; let rays = 100_000; // This would be better but these doctests have to run in reasonable time // let rays = ((width * height).round() / 2.0) as usize; // Build a basic Material let m = Box::new(HQZLegacy::new(0.3, 0.3, 0.3)); // Build a basic Object let o = Object::Line { x0: Sample::Constant(0.0), y0: Sample::Constant(height0.75), dx: Sample::Constant(width), dy: Sample::Constant(0.0), material: m, }; // Build a basic Light let l = Light{ power: Sample::Constant(1.0), x: Sample::Constant(width/2.0), y: Sample::Constant(height/2.0), polarangle: Sample::Constant(0.0), polardistance: Sample::Constant(0.0), rayangle: Sample::Range(360.0, 0.0), wavelength: Sample::Blackbody(4500.0), }; // We also need a viewport let viewport = Rect::frompoints(&Point{x: 0.0,y: 0.0},&Point{x: width,y: height}); // Construct a renderer object and add the light and object to it. let r = Renderer::new(width as usize, height as usize, viewport).withobject(o)withlight(l); // Render Image println!("Tracing Rays"); let image = r.render(rays); // Output the Image as a Vec println!("Serializing!"); let data = image.to_rgb8(0.7, 1.2);

// Do Export to a PNG or whatever you want here.

} ```

Example Output:

example output

Versioning:

In alpha version numbers are 0.0.* every change will be breaking In beta version numbers will be 0.*.* every minor release will be breaking Post 1.0.0 semantic versioning will be used

Licence

This project and all artworks created by the examples are copyright Lauren Brown (SEGFAULT), and are licenced under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License

see the LICENCE.md file for full terms.