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