真实感光照效果2.ppt
《真实感光照效果2.ppt》由会员分享,可在线阅读,更多相关《真实感光照效果2.ppt(85页珍藏版)》请在三一办公上搜索。
1、真实感图形建模与绘制,第二讲 真实感光照模型视相关绘制方法,2,Global Illumination,Extends the Local Illumination Model to include:Reflection(one object in another)Refraction(Snells Law)Transparency(better model)Shadows(at point,check each light source)Antialiasing(usually means supersampling),3,Wireframe view of a test scene.,Or
2、thographic view from above,4,Locally illuminated test scene.,Ambient term only,5,Locally illuminated test scene.,Phong shading.Ambient and Diffuse terms only,6,Locally illuminated test scene.,Phong shading.Ambient,diffuse andSpecular terms.,Notes:Highlight on wall from light is in the wrong place,7,
3、Comparison.,Flat,Gouraud,Phong,Coarser mesh,8,Use Local illumination.,No.In our test scene,we cant represent:MirrorChrome teapot.Shiny floorShadows with local illumination.,9,Test Scene.,High quality rendering of test scene.,Note:Mirror and chrome teapot.Shadows on floor.Shiny floor.,10,Global illum
4、ination.,Two methods:View dependent methods.Calculate the view from the camera with global illumination.Recursive ray-tracing.View independent methods.Solve lighting for the entire scene.Radiosity solution.,11,View dependent methods.,Loop round the pixels.Good for lighting effects which have a stron
5、g dependence on view location:Specular highlights.Reflections from curved surfaces.Only a small number of objects need to be considered at the same time.Poor when many objects need to be considered E.g diffuse interactions(eg.colour bleeding).,12,View independent methods.,Loop round the sceneGood wh
6、en many(all)objects need to be considered at same time.Diffuse inter-reflections.Poor when shading has strong dependence on view location.Specular reflection.,真实感图形建模与绘制,视相关绘制方法,14,Ray-Tracing:Why Use It?,Simulate rays of lightProduces natural lighting effects,Ray-tracing easier to implement,Fall 20
7、11,15,Ray-Tracing:Why Use It?,Simulate rays of lightProduces natural lighting effectsReflection,Fall 2011,16,Ray-Tracing:Why Use It?,Refraction,caustics,Fall 2011,17,Ray-Tracing:Why Use It?,Simulate rays of lightProduces natural lighting effectsSoft shadows,Fall 2011,18,Ray-Tracing:Why Use It?,Simul
8、ate rays of lightProduces natural lighting effectsdepth of field,motion blur,19,Whitted 模型,特点:整体光照模型的典型代表;与光线跟踪技术密不可分;考虑了光源在物体表面的直接照射产生的光亮度,同时还考虑了环境光在镜面反射方向和规则透射方向对被照射点产生的光能贡献;其他方向的环境光对照射点的影响仍用一常数泛光项来模拟。,20,Whitted 模型,计算方法:,Whitted模型采用递归跟踪的方法来求解Ir,It,Ir:来自环境光的反射光亮度;kr:入射点的镜面反射系数,It:来自环境光的透射光亮度;kt:入射
9、点的透射系数,21,Ray Tracing,标准Ray Tracing算法 假设:光线是一根没有大小的直线,即数学意义上的直线;物体表面是完全光滑的,光在表面的反射遵循镜面反射和规则透射的规律。这两个假设使得光线跟踪算法生成的图形中含有轮廓清楚的多重反射效果,22,Ray Tracing,由于从光源发出的光线有无穷条,直接从光源出发对光线进行跟踪非常困难;,23,Ray Tracing,实际上,从光源发出的光线只有少数经由场景中物体表面之间的反射和透射后到达观察者的眼中;标准光线跟踪算法采用逆向跟踪技术来完成整个绘制过程,24,Ray Tracing,算法思路:从视点出发,通过图像平面上每个像
10、素中心向场景中发出一条光线;判断:若光线与场景中物体无相交,则光线将射出画面,跟踪结束;否则,光线与物体相交;光线在离视点最近的景物表面交点出的走向有三种可能:当前交点所在的景物表面为理想漫反射面,跟踪结束;当前所在的景物表面为理想镜面,光线沿其镜面反射方向继续跟踪;当前交点所在的景物表面为规则透面,光线沿其规则透射方向继续跟踪。上述步骤是一个递归过程。,25,Ray Tracing,继续跟踪以下三条光线:Towards Light Source(s):shadow rays.L(shadow feelers)In the reflection direction:reflection ray
11、s,RIn a direction dictated by Snells Law:transmitted rays,T,Fall 2011,26,The Ray Tree,R2,R1,R3,L2,L1,L3,N1,N2,N3,T1,T3,Ni surface normalRi reflected rayLi shadow rayTi transmitted(refracted)ray,Eye,L1,T3,R3,L3,L2,T1,R1,R2,Eye,Complexity?,27,Recursive ray tree.,Reflection and Transmission Rays spawn
12、other rays.The complete set of rays is called a Ray Tree.,Viewpoint,Light Source ray determines colour of current object.,28,Test Scene.,Ray tree depth 1.Note only ambient shade on mirror and teapot,29,Test Scene.,Ray tree depth 2.Note only ambient shade on reflection of mirror and teapot.,30,Test S
13、cene.,Ray tree depth 3.Note only ambient shade on reflection of mirror in teapot.,31,Test Scene.,Ray tree depth 4.Note ambient shade on reflection of teapot in reflection of mirror in teapot.,32,Test Scene.,Ray tree depth 5.,33,Test Scene.,Ray tree depth 6.,34,Test Scene.,Ray tree depth 7.,35,When t
14、o stop?,Need to know when to stop the recursion.Can define a fixed depth.Hall introduced adaptive tree depth control.Calculate maximum contribution of a ray to a pixels final value.Multiply contribution of rays ancestors down the tree.Stop when below some threshold,perhaps stack overflow.,36,Adaptiv
15、e tree depth control.,Viewpoint,0.3,0.2,37,Adaptive tree depth control.,Viewpoint,0.3*0.2,0.2*0.2,0.3,0.2,38,标准光线跟踪算法,TraceRay(VECTOR Start,VECTOR Direction,int Depth,COLOR Color)VECTOR IntersectionPoint,ReflectedDirection,TransmittedDirection;COLOR LocalColor,ReflectedColor,TransmittedColor;If(Dept
16、hMAXDEPTH)Color=black;Else 取Start为起点,方向为Direction的光线S为跟踪光线,用它与场景中的景物进行求交测试;if(无交)Color=BackgroundColor;else计算离起始点Start最近的交点IntersectionPoint;Shade(IntersectionObject,IntersectionPoint,LocalColor);确定IntersectionPoint所在表面镜面反射系数ks,透射系数kt;if(IntersectionPoint所在的表面为镜面)计算跟踪光线S在IntersectionPoint处的反射光线方向Ref
17、lectedDirection;TraceRay(ntersectionPoint,ReflectedDirection,Depth+1,ReflectedColor);,39,标准光线跟踪算法,if(IntersectionPoint所在的表面为透明面)计算跟踪光线S在IntersectionPoint处的规则透射光线方向TransmittedDirection;TraceRay(IntersectionPoint,TransmittedDirection,Depth+1,TransmittedColor);Color=LoaclColor+ks*ReflectedColor+kt*Tran
18、smittedColor;,40,标准光线跟踪算法,用局部光照模型计算交点IntersectionPoint处的局部光亮度LocalColorShade(OBJECT IntersectionObject,VECTOR IntersecctionPoint,COLOR LocalColor)确定IntersectionObject在IntersectionPoint处的单位法向量N,漫反射系数kd,镜面反射系数ks,环境反射系数ka;LocalColor=ka*Ia;For(每一个点光源PointLight)计算入射光线单位向量L和虚拟镜面单位法向量H;由Phong模型计算光源PointLig
19、ht在IntersectionPoint处的漫反射和镜面反射光亮度;LocalColor+=(Ipointlight*(kd*(N.L)+ks*(N.H)n);,41,光线跟踪几何,1.反射光线方向与折射光线方向的确定2.光线与景物表面的求交方法光线与球面的交光线与多边形的交光线与长方体的交光线与三角形的交光线与二次曲面的交光线与一般柱面的交光线与旋转面的交光线与代数曲面的交光线与metaball曲面的交光线与参数曲面的交,42,Local illumination vs.Global,In both an object hit by a ray,if lit by a light sourc
20、e,is illuminated by a local illumination model,i.e with specular,diffuse&ambient terms.Global:a reflected ray,and a transmission ray(if appropriate)are also cast into the scene.,43,光线跟踪算法的几种演化,1.光束跟踪算法针对标准光线跟踪算法的计算开销大的问题而提出的。2.Monte-carlo ray tracing&圆锥跟踪算法针对标准光线跟踪算法的边界、阴影尖锐的问题而提出的。3.分布式光线跟踪算法针对圆锥跟踪
21、算法求交计算复杂的问题而出的。,44,光束跟踪算法,性质:在光线跟踪过程中,相邻光线在光能传播过程中往往具有大致相同的路径。这一性质启示我们,相邻光线之间具有空间连贯性(Coherence)。Heckbert和hanrahan通过光束跟踪利用光线之间的连贯性,有效提高光线跟踪算法的效率。假设:考虑到经曲面反射或折射后,相邻光线会向四周散射或聚结,从而改变相邻光线在空间传播的连贯性,Heckbert等将场景限制为多边形场景。关键点:如何定义光束(包括确定反射光束和折射光束),使得计算光束和景物的交简单方便。,45,光束跟踪算法,光束的定义:从视点出发的初始光束投向整个屏幕,形成一个视域四棱锥;采
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 真实感 光照 效果
链接地址:https://www.31ppt.com/p-6035486.html