




下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 冷藏合同范本
- 加工车间转租合同范本
- 不见面签订租赁合同范本
- 2025年合肥货运车从业考试题
- 个人施工承揽合同范本
- app开发合同范本模板
- 加工订单合同范本模板
- 农村供热服务合同范本
- 个人股权质押合同范本
- 光租船合同范本
- 安徽省合肥市包河区 2024-2025学年九年级上学期期末道德与法治试卷(含答案)
- 2025年一次性死亡赔偿协议模板(2篇)
- 广州电视塔钢结构施工方案
- 2024年湖南铁路科技职业技术学院高职单招数学历年参考题库含答案解析
- 《梅大高速茶阳路段“5·1”塌方灾害调查评估报告》专题警示学习
- 2024年06月江苏昆山鹿城村镇银行校园招考笔试历年参考题库附带答案详解
- 小学二年级100以内进退位加减法800道题
- 3ds Max动画制作实战训练(第3版)教学教案
- 艾滋病丙肝梅毒
- CNAS-CL01-G001:2024检测和校准实验室能力认可准则的应用要求
- 春季安全行车培训资料
评论
0/150
提交评论