Skip to content

Latest commit

 

History

History
45 lines (23 loc) · 2.55 KB

File metadata and controls

45 lines (23 loc) · 2.55 KB

Ray Tracing: The Next Week With Rust

本项目为一个简单的光线追踪渲染器,参考Ray Tracing: The Next Week,用Rust实现。该书为Ray Tracing in One Weekend 的下一章。实现了动态模糊、图片用作纹理、体积渲染、Perlin Noise、四边形、光源、实例。你也可以访问上一章节:Mario-Hero/Ray-Tracing-in-One-Weekend-with-Rust

This project is a simple ray tracing renderer, reference Ray Tracing: The Next Week, implement using Rust. The book is the next chapter of Ray Tracing in One Weekend. Implemented motion blur, images for texture, volume rendering, Perlin Noise, quadrilaterals, lighting, and instances. Also, you are welcomed to visit the previous chapter: Mario-Hero/Ray-Tracing-in-One-Weekend-with-Rust

final_scene cornell_box_scene

依赖 Dependency

  1. Rayon: 用于多线程加速渲染 Used for multi-threaded accelerated rendering.

  2. nalgebra: 提供Vec3支持 Provide Vec3 support.

  3. tokio、indicatif: 实现进度条 Used to implement a progress bar.

  4. image:用于导入图像用作纹理 Used for importing images as textures.

用法 Usage

cargo run --release 运行并等待完成。 Run and wait for completion.

然后打开目录下的pic.ppm图片文件即可。Then open the pic. ppm image file in the directory.

该图片即为上文的左图,如果需渲染其他项目,可以把main.rs第51行

The output picture is the image on the left from the previous context. If you want to render other projects, you can change the line 51 of main. rs,

let (world, cam) = final_scene(IMAGE_WIDTH, IMAGE_HEIGHT, CAMERA_SAMPLE, RAY_DEPTH);  

中的final_scene替换为scene.rs文件里的其他scene函数,比如perlin_scenecornell_box_scene

and make final_scene another function in scene.rs. Such as perlin_scenecornell_box_scene

License

The project is released under MIT License.