本项目为一个简单的光线追踪渲染器,参考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 |
-
Rayon: 用于多线程加速渲染 Used for multi-threaded accelerated rendering.
-
nalgebra: 提供Vec3支持 Provide Vec3 support.
-
tokio、indicatif: 实现进度条 Used to implement a progress bar.
-
image:用于导入图像用作纹理 Used for importing images as textures.
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_scene
、cornell_box_scene
and make final_scene
another function in scene.rs
. Such as perlin_scene
、cornell_box_scene
The project is released under MIT License.