下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、基本的光照计算公式TheBasicLightingModelOpenGLandDirect3Dprovidealmostidenticalfixed-functionlightingmodels.Inourexample,wewilluseasimplifiedversionthatwewillrefertoastheBasicmodel.TheBasicmodel,liketheOpenGLandDirect3Dmodels,modifiesandextendstheclassicPhongmodel.IntheBasicmodel,anobjectssurfacecoloristhesum
2、ofemissive,ambient,diffuse,andspecularlightingcontributions.Eachcontributiondependsonthecombinationofthesurfacesmaterialproperties(suchasshininessandmaterialcolor)andthelightsourcesproperties(suchaslightcolorandposition).Werepresenteachcontributionasafloat3vectorthatcontainsthered,green,andbluecolor
3、components.Thishigh-levelequationdescribestheBasicmodelmathematically:surfaceColor=emissive+ambient+diffuse+specularTheEmissiveTermTheemissivetermrepresentslightemittedorgivenoffbyasurface.Thiscontributionisindependentofalllightsources.TheemissivetermisanRGBvaluethatindicatesthecoloroftheemittedligh
4、t.Ifyouweretoviewanemissivematerialinacompletelydarkroom,itwouldappeartobethiscolor.Theemissivetermcansimulateglowing.Figure5-2illustratestheemissivetermconceptually,andFigure5-3showsarenderingofapurelyemissiveobject.Therenderingisunderstandablyboring,becausetheemissivecoloristhesameallovertheobject
5、.Unlikeintherealworld,anobjectsemissiveglowdoesnotactuallyilluminateothernearbyobjectsinthescene.Anemissiveobjectisnotitselfalightsourceitdoesnotilluminateotherobjectsorcastshadows.Anotherwaytothinkoftheemissivetermisthatitisacoloraddedaftercomputingalltheotherlightingterms.Moreadvaneedglobalillumin
6、ationmodelswouldsimulatehowtheemittedlightaffectstherestofthescene,butthesemodelsarebeyondthescopeofthisbook.ObjectSurfaceFigure5-2TheEmissiveTermFigure5-3RenderingtheEmissiveTermHereisthemathematicalformulationweusefortheemissiveterm:emissive=Kwhere:kisthemateria1semissivecolor.eTheAmbientTermTheam
7、bienttermaccountsforlightthathasbouncedaroundsomuchinthescenethatitseemstocomefromeverywhere.Ambientlightdoesnotappeartocomefromanyparticulardirection;rather,itappearstocomefromalldirections.Becauseofthis,theambientlightingtermdoesnotdependonthelightsourceposition.Figure5-4illustratesthisconcept,and
8、Figure5-5showsarenderingofanobjectthatreceivesonlyambientlight.Theambienttermdependsonamaterialsambientreflectanee,aswellasthecoloroftheambientlightthatisincidentonthematerial.Liketheemissiveterm,theambienttermonitsownisjustaconstantcolor.Unliketheemissivecolor,however,theambienttermisaffectedbytheg
9、lobalambientlighting.IncomingAmbientLightReflectedAmbientLightObjectSurfaceObjectSurfaceFigure5-4TheAmbientTermFigure5-5RenderingtheAmbientTermHereisthemathematicalformulationweusefortheambientterm:ambient=KgxglobalAmbientwhere:kisthematerialsambientreflectaneeandaglobalAmbientisthecoloroftheincomin
10、gambientlight.TheDiffuseTermThediffusetermaccountsfordirectedlightreflectedoffasurfaceequallyinalldirections.Ingeneral,diffusesurfacesareroughonamicroscopicscale,withsmallnooksandcranniesthatreflectlightinmanydirections.Whenincomingraysoflighthitthesenooksandcrannies,thelightbouncesoffinalldirection
11、s,asshowninFigure5-6.DiffuseObjectIVTagniedFigure5-6DiffuseLightScatteringTheamountoflightreflectedisproportionaltotheangleofincideneeofthelightstrikingthesurface.Surfaceswithadullfinish,suchasadustychalkboard,aresaidtobediffuse.Thediffusecontributionatanyparticularpointonasurfaceisthesame,regardles
12、sofwheretheviewpointis.Figure5-7illustratesthediffuseterm,andFigure5-8showsarenderingofadiffuseobject.IncomingLightReflectedDiffuseLihtObjectSurfaceFigure5-8RenderingtheDiffuseTermObjectSurfaceHereisthemathematicalformulationweuseforthediffuseterm(illustratedinFigure5-9):diffuse=KdxlightColorxmax(NL
13、,0)where:Kdisthematerialsdiffusecolor,lightColoristhecoloroftheincomingdiffuselight,Nisthenormalizedsurfacenormal,Listhenormalizedvectortowardthelightsource,andPisthepointbeingshaded.Figure5-9CalculatingDiffuseLightingThevectordotproduct(orinnerproduct)ofthenormalizedvectorSVandLisameasureoftheangle
14、betweenthetwovectors.Thesmallertheanglebetweenthevectors,thegreaterthedot-productvaluewillbe,andthemoreincidentlightthesurfacewillreceive.Surfacesthatfaceawayfromthelightwillproducenegativedot-productvalues,sothemax(NL,0)intheequationensuresthatthesesurfacesshownodiffuselighting.TheSpecularTermThesp
15、eculartermrepresentslightscatteredfromasurfacepredominantlyaroundthemirrordirection.Thespeculartermismostprominentonverysmoothandshinysurfaces,suchaspolishedmetals.Figure5-10illustratestheconceptofspecularreflection,andFigure5-11showsarenderingofacompletelyspecularobject.ReflectedSpecuEarLightObject
16、SurfaceObjectSurfaceFigure5-10TheSpecularTermFigure5-11RenderingtheSpecularTermUnliketheemissive,ambient,anddiffuselightingterms,thespecularcontributiondependsonthelocationoftheviewer.Iftheviewerisnotatalocationthatreceivesthereflectedrays,theviewerwillnotseeaspecularhighlightonthesurface.Thespecula
17、rtermisaffectednotonlybythespecularcolorpropertiesofthelightsourceandmaterial,butalsobyhowshinythesurfaceis.Shiniermaterialshavesmaller,tighterhighlights,whereaslessshinymaterialshavehighlightsthataremorespreadout.Figure5-12showssomeexamplesofshininess,withtheshininessexponentincreasingfromlefttorig
18、ht.Shinins=5Shlninas,s=20SliiniriM=50Shinira-100Figure5-12ExamplesofDifferentShininessExponentsHereisthemathematicalformulationweuseforthespecularterm(illustratedinFigure5-13):specular=K$xlightColorxfacingx(max(NH,0)shininesswhere:Ksisthematerialsspecularcolor,lightColoristhecoloroftheincomingspecularlight,Nisthenormalizedsurfacenormal,Visthenormalizedvectortowardtheview
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 智能化系统建筑施工合同
- 建筑工程消防管道施工合同
- 家电行业销售专员聘用合同
- 演播室场地租赁合同
- 上海市城市供电系统扩建施工合同
- 景观设计草坪绿化合同
- 旅游景点墙面施工合同
- 教育机构临时教员招聘合同
- 产权交易合同招标管理办法
- 教育设施建设合同协议书
- 国开(甘肃)2024年春《地域文化(专)》形考任务1-4终考答案
- 档案整理及数字化服务方案(技术标 )
- GHTF—质量管理体系--过程验证指南中文版
- 铝及铝合金焊接作业指导书
- 水利工程质量与安全监督工作实务PPT课件
- 放射性口腔粘膜炎的发病机制及危险因素
- 加油站特殊作业安全管理制度(完整版)
- 质量风险抵押金管理办法
- 村纪检监督小组工作职责
- 《宏观经济学乘数论》PPT课件.ppt
- 警务监督员表态发言(共4篇)
评论
0/150
提交评论