当前位置: 首页 > wzjs >正文

做图片推广的网站软文通

做图片推广的网站,软文通,福永小学网站建设,新开网店自己如何推广目录 作业介绍代码实现 GitHub主页:https://github.com/sdpyy games101项目作业代码:https://github.com/sdpyy1/CppLearn/tree/main/games101 作业介绍 本次作业只需要实现渲染方程,首先需要理解渲染公式 其次需要知道利用蒙特卡洛公式求积…

目录

  • 作业介绍
  • 代码实现

GitHub主页:https://github.com/sdpyy
games101项目作业代码:https://github.com/sdpyy1/CppLearn/tree/main/games101

作业介绍

在这里插入图片描述
本次作业只需要实现渲染方程,首先需要理解渲染公式
请添加图片描述
其次需要知道利用蒙特卡洛公式求积分的方法
在这里插入图片描述
求渲染公式的积分部分需要在半球面采样,为了提高准确度,换元为在光源面积上采样
在这里插入图片描述

在作业中也给出了伪代码
在这里插入图片描述

代码实现

代码参考https://zhuanlan.zhihu.com/p/606074595

注释写的很清楚了

Vector3f Scene::castRay(const Ray& ray, int depth) const
{Vector3f hitColor = this->backgroundColor;// 获取光线ray与场景中物体的交点Intersection shade_point_inter = Scene::intersect(ray);// 如果有交点if (shade_point_inter.happened){// 交点坐标Vector3f p = shade_point_inter.coords;// 从摄像机到点P的方向Vector3f wo = ray.direction;// p点的法线Vector3f N = shade_point_inter.normal;Vector3f L_dir(0), L_indir(0);//光照的采样 获取位置和概率密度函数Intersection light_point_inter;float pdf_light;sampleLight(light_point_inter, pdf_light);//Get x,ws,NN,emit from inter// 光照采样点的坐标Vector3f x = light_point_inter.coords;// 从点P到光照采样点的方向Vector3f ws = normalize(x-p);// 光照采样点的法线Vector3f NN = light_point_inter.normal;// ?Vector3f emit = light_point_inter.emit;// 点p到光照采样点的距离float distance_pTox = (x - p).norm();//创建从p->采样点的光照Vector3f p_deviation = (dotProduct(ray.direction, N) < 0) ?p + N * EPSILON :p - N * EPSILON ;Ray ray_pTox(p_deviation, ws);//判断是否中间有别的物体挡住了Intersection blocked_point_inter = Scene::intersect(ray_pTox);// 如果没有被挡住就算一次Lif (abs(distance_pTox - blocked_point_inter.distance < 0.01 )){L_dir = emit * shade_point_inter.m->eval(wo, ws, N) * dotProduct(ws, N) * dotProduct(-ws, NN) / (distance_pTox * distance_pTox * pdf_light);}// 俄罗斯轮盘赌来停止递归float ksi = get_random_float();if (ksi < RussianRoulette){// 采样获得wi方向来进一步递归Vector3f wi = normalize(shade_point_inter.m->sample(wo, N));// 创建对应的光线Ray ray_pTowi(p_deviation, wi);//光线碰到了不发光的物体,需要递归处理Intersection bounce_point_inter = Scene::intersect(ray_pTowi);// 如果光线碰到了物体就需要递归处理了if (bounce_point_inter.happened && !bounce_point_inter.m->hasEmission()){float pdf = shade_point_inter.m->pdf(wo, wi, N);if(pdf> EPSILON)L_indir = castRay(ray_pTowi, depth + 1) * shade_point_inter.m->eval(wo, wi, N) * dotProduct(wi, N) / (pdf *RussianRoulette);}}// 结合直接光照和间接光照获得该点的颜色值hitColor = shade_point_inter.m->getEmission() + L_dir + L_indir;}return hitColor;
}
http://www.dtcms.com/wzjs/145641.html

相关文章:

  • ps网站子页怎么做的360优化大师安卓手机版下载安装
  • 有手机网站了还要微网站吗企业培训内容
  • 百度上怎么做网站镇江网站seo
  • 企业网站建设方案详细方案磁力宝
  • 装修免费设计软件网络seo公司
  • 网站后台怎么换图片百度推广系统营销平台
  • 做网站卖资料口碑营销推广
  • 十堰响应式网站建设如何学会推广和营销
  • 同一个ip的网站做链接有用网络营销的成功案例
  • python做网站毕业设计网站如何优化推广
  • 湛江专业网站建设公司今天的最新新闻内容
  • 廊坊哪家公司做网站最新网站推广方法
  • 长沙商业网站建设长沙百度公司
  • 免费ppt模板网站大全seo顾问服务福建
  • 如何提高网站的功能性建设平台搭建
  • 我做的网站手机上不了seo搜索工具栏
  • wordpress日主题下载失败兰州网络推广优化怎样
  • 自己公司产品网站的好处新闻今天最新消息
  • 石家庄做网站竞价托管公司联系方式
  • 百度做网站刷排名甘肃seo技术
  • 河南汉狮做网站的公司什么是网站推广策略
  • 欧美浅蓝色新闻网站css模板网络营销服务外包
  • 模型评测网站怎么做创量广告投放平台
  • 什么网址都能打开的浏览器网站推广优化业务
  • 新手学做网站书刷排名的软件是什么
  • 工业设计在线网站郑州搜索引擎优化
  • 提高网站建设水平意见方案如何做营销活动
  • 儿童学做彩泥的网站百度搜索优化怎么做
  • 自助做app的网站网站设计制作
  • 上海做网站设计公司seo的工作内容主要包括