Skip to content

本项目为一个简单的光线追踪渲染器,参考Ray Tracing: The Next Week,用Rust实现。实现了动态模糊、图片用作纹理、体积渲染、Perlin Noise、四边形、光源、实例。 This project is a simple ray tracing renderer, reference Ray Tracing: The Next Week. Implemented motion blur, images for texture, volume rendering, Perlin Noise, quadrilaterals, lighting, and instances.

License

Notifications You must be signed in to change notification settings

Mario-Hero/Ray-Tracing-The-Next-Week-With-Rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

本项目为一个简单的光线追踪渲染器,参考Ray Tracing: The Next Week,用Rust实现。实现了动态模糊、图片用作纹理、体积渲染、Perlin Noise、四边形、光源、实例。 This project is a simple ray tracing renderer, reference Ray Tracing: The Next Week. Implemented motion blur, images for texture, volume rendering, Perlin Noise, quadrilaterals, lighting, and instances.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages