More than 20 thousand C ++ codes this month Code, My head is dizzy... the light tracing ends here. There is no special plan. Basically, it compares the effect of Chen zihan's boss space to implement something that is easy to understand. In my spare time, the process of implementation is the process of trying and piecing together. This is the Menger sans Ge with 36096 triangles, only diffuse reflection (including mirror light), the original resolution is 2000*1500, and it takes 1.512 seconds to fully open the I5 quad core:
It takes 2.235 seconds to add a shadow:
Add ambient occlusion. Each screen pixel sends 100 rays to find the occlusion relationship, which takes 99 seconds:
Last, there are not many triangles (only the teapot is a triangular mesh), but the effect is more complex than above, including reflection, refraction, shadow, Environmental occlusion, sky box, and concave and convex texture, still 2000*1500 resolution, rendering took 125.127 seconds :( I spent a lot of time placing these objects and editing materials, and the effect was good at last ...)