欢迎光临散文网 会员登陆 & 注册

A Simple Ray-Tracer

2023-03-22 13:09 作者:RanMeraklis  | 我要投稿

Many thanks to my partner Ningyu Zhu for finishing the BVH acceleration structure (which saves the day when rendering the Stanford Dragon) and successfully debugging the showing for Cornell Box!

Helios Hunter: Ray-Tracer

1. Structure

  • RayThruPixel(cam%2C%20x%2C%20y) generates a ray originated from the camera position, through the center of the (x%2C%20y) pixel into the world

  • Intersect(ray%2C%20scene) searches over all all geometries in the scene and returns the closest hit

  • FindColor(hit) shades the light color seen by the in-coming ray

    • Ambient + Lambertian-diffuse + Blinn–Phong formula

    • Add the contribution of light only when the ray connecting the hit and the light source does not have any intersection with the scene (Numerical inaccuracy may cause intersection to be below surface, causing surface to incorrectly shadow itself. To avoid self-shadowing, the secondary ray is shot off slightly above the hitting point.)

    • Do recursive ray tracing

1.1 RayThruPixel


1.2 Ray-Scene Intersection

2. Classes

     

3. Results

The rendering results and timings are shown in the following images.

3.1 Scene 4 Table with Spheres

3.1.1 Ambient

3.1.2 Diffuse

3.1.3 Emission

3.1.4 Specular

3.2 Scene 5 Thousand Spheres

3.3 Scene 6 Cornell Box

3.4 Scene 7 Stanford Dragon

Specific explanation and implementation details may be covered in future blogs :D

(since currently I'm still struggling with the finals o(╥﹏╥)o


A Simple Ray-Tracer的评论 (共 条)

分享到微博请遵守国家法律