【Ray Tracing The Next Week 超详解】 光线追踪2-7 任意长方体 场景案例 (2)

于是乎,emmm,貌似还完成了上面提到的梦想,上表面”高光”以及底面的透光,不仅如此,而且镂空内表面还有透光,还映在了大地上,强无敌嘞~

 

上述场景代码

 

intersect* light() { texture * perlintex = new noise_texture(6.3); material* redlight = new areaLight(new constant_texture(rtvec(0.98, 0.1, 0.08))); material* bluelight = new areaLight(new constant_texture(rtvec(0.05, 0.05, 1.))); intersect**list = new intersect*[7]; list[0] = new sphere(rtvec(-2, 3, -3), 1.5, redlight); list[1] = new sphere(rtvec(-2.2, 3.2, 2.8), 1.5, bluelight); list[2] = new sphere(rtvec(0, 0, 2.2), 1, new metal(new constant_texture(rtvec(1, 1, 1)))); list[3] = new sphere(rtvec(), 1, new lambertian(new constant_texture(rtvec(1, 1, 1)))); list[4] = new sphere(rtvec(0, 0, -2), 1, new dielectric(1.5)); list[5] = new sphere(rtvec(0, 0, -2), -0.18, new dielectric(1.5)); list[6] = new sphere(rtvec(0, -1000, 0), 999, new dielectric(1.5)); return new intersections(list, 7); }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpjjxg.html