![計(jì)算機(jī)畢設(shè)外文翻譯_第1頁](http://file4.renrendoc.com/view11/M00/2E/30/wKhkGWX6d1iAFLFUAAIdyqYu4A0196.jpg)
![計(jì)算機(jī)畢設(shè)外文翻譯_第2頁](http://file4.renrendoc.com/view11/M00/2E/30/wKhkGWX6d1iAFLFUAAIdyqYu4A01962.jpg)
![計(jì)算機(jī)畢設(shè)外文翻譯_第3頁](http://file4.renrendoc.com/view11/M00/2E/30/wKhkGWX6d1iAFLFUAAIdyqYu4A01963.jpg)
![計(jì)算機(jī)畢設(shè)外文翻譯_第4頁](http://file4.renrendoc.com/view11/M00/2E/30/wKhkGWX6d1iAFLFUAAIdyqYu4A01964.jpg)
![計(jì)算機(jī)畢設(shè)外文翻譯_第5頁](http://file4.renrendoc.com/view11/M00/2E/30/wKhkGWX6d1iAFLFUAAIdyqYu4A01965.jpg)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
25-GeneratingRandomFractalTerrainPartI:GeneratingRandomFractalTerrainIntroductionTenyearsago,Istumbledacrossthe1986SIGGRAPHProceedingsandwasawestruckbyonepaperinparticular,entitledTheDefinitionandRenderingofTerrainMapsbyGavinS.P.Miller1.Itdescribedahandfulofalgorithmsforgeneratingfractalterrain,andtheauthorsalsointroduceanewmethodwhichtheyconsideredtobeanimprovement.InitiallyIwasimpressedthatthesealgorithms(eventhealgorithmsconsidered"flawed"bytheauthors)couldcreatesuchincrediblelandscapeimages!Then,uponreadingthepaper,Iwasflooredbythesimplicityofthesealgorithms.I'vebeenafractalterrainaddicteversince.Themathbehindthealgorithmcangetquitecomplex.However,completelyunderstandingthemathisnotaprerequisiteforgraspingthealgorithm.Andthat'sgood.BecauseifIhadtoexplainallthemathtoyoubeforeexplainingthealgorithm,we'dnevergettothealgorithm.Besides,thereisliterallytonsofmaterialoutthereonthemathematicalconceptsinvolvedinfractals.Seethereferencesattheendofthisarticleforagoodstart.ForthesamereasonsthatIwon'tgointothemathdetails,Ican'tincludeabroadoverviewoffractalsandeverythingtheycanbeusedfor.Instead,I'mgoingdescribetheconceptsbehindfractalterraingeneration,andgiveafocusedanddetaileddescriptionofmypersonalfavoritealgorithm:the"diamond-square"algorithm.I'lldemonstratehowtousethisalgorithmtostaticallytessellateanarrayofheightdatathatcanbeusedforgeometricterraindata,terraintexturemaps,andcloudtexturemaps.
Whatcanyoudowithafractalterrain?Iassumeyoualreadyknowthat;that'swhyyou'rereadingthis.Randomterrainmapsaregreatforflightsimulatorsormakingtexturemapstouseasabackground(showingadistantmountainrange,forexample).Thesamealgorithmthatmakesterraincanalsobeusedtogeneratetexturemapsforpartlycloudyskies.BeforeIgofurther,adisclaimer:Iamnotagameprogrammer.Ifyouarereadingthisbecauseyouwantalgorithmsforrenderingterrainquickly,you'vecometothewrongplace.I'llonlydescribetheprocessofgeneratingtheterrainmodel.Howyourenderitisuptoyou.Self-SimilarityThekeyconceptbehindanyfractalisself-similarity.Anobjectissaidtobeself-similarwhenmagnifiedsubsetsoftheobjectlooklike(oridenticalto)thewholeandtoeachother.2Considerthehumancirculatorysystem.Thisisafineexampleofself-similarityinnature.Thesamebranchingpatternisexhibitedfromthelargestarteriesandveinsallthewaydowntothesmallestcapillaries.Ifyoudidn'tknowyouwereusingamicroscope,youwouldn'tbeabletotellthedifferencebetweencapillariesandarteries.Nowconsiderasimplesphere.Isitself-similar?No.Atsignificantlylargemagnification,itstopslookinglikeaspherealtogetherandstartslookinglikeaflatplane.Ifyoudon'tbelieveme,justtakealookoutside.Unlessyouhappentobeinorbitwhilereadingthis,you'llseenoindicationthattheEarthisasphere.Asphereisnotself-similar.ItisbestdescribedusingtraditionalEuclideangeometry,ratherthanafractalalgorithm.Terrainfallsintothe"self-similar"category.Thejaggededgeofabrokenrockinthepalmofyourhandhasthesameirregularitiesasaridgelineonadistanthorizon.Thisallowsustousefractalstogenerateterrainwhichstilllooksliketerrain,regardlessofthescaleinwhichitisdisplayed.Asidenoteonself-similarity:Initsstrictestsense,itmeansself-identical,thatis,exactminiaturecopiesofitselfarevisibleatincreasinglysmallorlargescales.Iactuallydon'tknowofanyself-identicalfractalsthatexistinnature.ButtheMandelbrotsetisself-identical.Itakeupmuchlessspacethantheimageitself.ChaosandFractals,NewFrontiersofScience3hasachapterandanappendixdevotedtothistopicandisagreatreadforanyfractalnutingeneral.Backtoreality.Withoutmucheffort,youcanreadtheoutputofthisfunctionintoapaintprogramandcomeupwithsomethinglikethis:Thiscouldbeusedassceneryoutsideawindow,forexample.Thenicethingaboutitisthatitwraps,soyoucankeeparoundonerelativelysmallimageandcompletelywrapascenewithit.Thatis,ifyoudon'tmindseeingthesamemountainineverydirection.OK,beforewegointo2Dfractalsurfaces,youneedtoknowabouttheroughnessconstant.Thisisthevaluewhichwilldeterminehowmuchtherandomnumberrangeisreducedeachtimethroughtheloopand,therefore,willdeterminetheroughnessoftheresultingfractal.Thesamplecodeusesafloating-pointnumberintherange0.0to1.0andcallsitH.2(-H)isthereforeanumberintherange1.0(forsmallH)to0.5(forlargeH).Therandomnumberrangecanbemultipliedbythisamounteachtimethroughtheloop.WithHsetto1.0,therandomnumberrangewillbehalvedeachtimethroughtheloop,resultinginaverysmoothfractal.WithHsetto0.0,therangewillnotbereducedatall,resultinginsomethingquitejagged.Herearethreeridgelines,eachrenderedwithvaryingHvaluesHeightMapsThemidpointdisplacementalgorithmdescribedabovecanbeimplementedusingaone-dimensionalarrayofheightvalueswhichindicatetheverticallocationofeachlinesegmentvertex.Thisarrayisaone-dimensionalheightmap.Itmapsitsindices(Xvalues)toheightvalues(Yvalues).Tosimulaterandomterrain,wewanttoextrapolatethisalgorithminto3Dspace,andtodosoweneedatwo-dimensionalarrayofheightvalueswhichwillmapindices(XandZvalues)intoheightvalues(Yvalues).Notethatalthoughourendgoalhereistogeneratethree-dimensionalcoordinates,thearrayonlyneedstostoretheheight(Y)values;thehorizontal(XandZ)valuescanbegeneratedontheflyasweparsethroughthearray.Byassigningacolortoeachheightvalue,youcoulddisplayaheightmapasanimage.Here,highpointsintheterrain(largevalues)arerepresentedbywhite,andlowpoints(smallvalues)arerepresentedbyblack:Renderingaheightmapthiswayisusefulforgeneratingcloudtexturemaps,whichI'lldiscusslater.Sucharepresentationcouldalsobeusedtoseedaheightmap.中文譯文:隨機(jī)分形地形的生成第一部分:生成隨機(jī)分形地形介紹十年前,我參加1986年SIGGRAPH活動(dòng),GavinS.P.Miller那篇題為DefinitionandRenderingofTerrainMaps的論文讓我充滿敬畏。該文描述了少數(shù)生成分形地形的算法,作者還介紹了一個(gè)他們認(rèn)為更先進(jìn)的新方法。開始我被這些算法能夠生成難以置信的風(fēng)景圖所震驚!(盡管這些算法被作者認(rèn)為“漏洞百出”)后來,讀過論文,這些算法之簡單將我完全打敗了。我從此成為一個(gè)分形地形迷。算法背后的數(shù)學(xué)可能相當(dāng)復(fù)雜。然而,完全理解這些數(shù)學(xué)并不是掌握這些算法的必要條件。很好,否則我得在解釋算法之前講解所有的數(shù),也許永遠(yuǎn)也講不到算法。此外,關(guān)于分形數(shù)學(xué)的文字材料數(shù)以噸計(jì),參見本文本的參考部分會(huì)有所幫助。同樣的原因,我不會(huì)深入到數(shù)學(xué)細(xì)節(jié),也不包括對分形的廣泛總覽及它們可被用來做的每樣?xùn)|西。相反,我將描述分形地形生成背后的概念,并集中仔細(xì)講解我個(gè)人最喜歡的”diamond-square”算法。我將演示如何使用這個(gè)算法靜態(tài)拼嵌高度數(shù)據(jù)數(shù)組,這些數(shù)據(jù)可用于幾何地形數(shù)據(jù)、地形紋理數(shù)據(jù)及云紋理映射。分形有什么用呢?假定你已經(jīng)知道,那正是你讀本文的原因。隨機(jī)地形圖對飛行模擬或制作背景紋理圖(如顯示一帶遠(yuǎn)山)十分有用。生成地形的算法也可用于生成部分云天的紋理圖。在繼續(xù)之前,申明一下:我不是游戲程序員。如果你為找到一個(gè)快速繪制地形的算法而讀此文,那你來錯(cuò)了地方。我只描述生成地形模型的過程。著色繪制是你自己的事。自相似任何分形最關(guān)鍵的概念是自相似。當(dāng)一個(gè)物體的一部分放大后看起來仍與整個(gè)物體一樣,那這個(gè)物體就是自相似??紤]一下人體的循環(huán)系統(tǒng)。這是自然界中自相似的好例子。從最大的動(dòng)脈和靜脈分支直到最小的微血管,整個(gè)過程都顯現(xiàn)相同的分支模式。如果你不知道正在使用顯微鏡,將無法分辨微血管和大動(dòng)脈?,F(xiàn)在再考慮一個(gè)簡單的球。它是自相似的嗎?不!大幅度放大后,它看起來不再象一個(gè)球,而象塊平板。如果你不相信,看看戶外。除非恰好你在太空軌道上看本文,否則將完全沒法看出地球是個(gè)球體。球體不是自相似的。它適用傳統(tǒng)的歐幾里德幾何描述而不是分形。地形屬于自相似范疇。手掌上的碎巖鋸齒狀邊緣與遠(yuǎn)處地平線邊的山脊有相同的不規(guī)則形狀。這使我們可以用分形來生成地形,不管顯示時(shí)怎么放大,它看起來仍然象地面。有關(guān)自相似請注意:嚴(yán)格意義下,它意味著自分辨(self-identical),即,自身精確的縮略拷貝在逐漸放大縮小時(shí)可見。我并不知道自然界存在任何自分辨分形。但mandelbrot集是自分辨的。我不會(huì)進(jìn)一步討論Mandelbrot集。到參考里找進(jìn)一步的信息。一維中點(diǎn)變換后邊要講的diamond-square算法,在兩維上使用一種中點(diǎn)變換算法。為幫助你了解個(gè)大概,我們先看一維情況。當(dāng)山脈出現(xiàn)在遠(yuǎn)處地平線處時(shí),一維中點(diǎn)變換是繪制山脊的好算法。看看它是怎么工作的:以一條水平地平線段開始重復(fù)足夠多次{對場景中的每條線段做{找到線段的中點(diǎn)在Y方向上隨機(jī)移動(dòng)中點(diǎn)一段距離減小隨機(jī)數(shù)取值范圍}}將隨機(jī)數(shù)值域減速小多少呢?那取決于你想要分形的陡峭程度。每次循環(huán)減少的越多,所得山脊線就越平滑。但如果減得太多,則會(huì)有明顯的鋸齒感。可以粗糙度存在一個(gè)常量里。后面會(huì)解釋如何做。來看個(gè)例子。我們以一條x從-1.0到1.0,y均為0的線段開始。開始,我們將隨機(jī)值范圍設(shè)為-1.0到1.0(可任意?。?。這樣我們在此范圍里生成一個(gè)數(shù)字,并將中點(diǎn)移動(dòng)這么多。這之后,我們就得到了:現(xiàn)在第二次經(jīng)過外圈循環(huán),我們有兩段,長度均原來的一半。我們的隨機(jī)值也減半,即-0.5到0.5。我們?yōu)閮蓚€(gè)中點(diǎn)都生成一個(gè)這個(gè)范圍內(nèi)的隨機(jī)點(diǎn),結(jié)果為:再次縮減范圍,現(xiàn)在是-0.25到0.25。再以該范圍內(nèi)的數(shù)變換四個(gè)中點(diǎn)后,我們得到了:有兩件事你可能已經(jīng)注意到了。首先,它是遞歸的。實(shí)際上,它可以用一個(gè)迭代過程相當(dāng)自然的實(shí)現(xiàn)。對于這種情況,遞歸或迭代都成。對于表面生成代碼,使用迭代實(shí)現(xiàn)比遞歸會(huì)有一些好處。所以為保持一致,線和面相應(yīng)的代碼都
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 夫妻離婚協(xié)議格式
- 農(nóng)業(yè)生產(chǎn)風(fēng)險(xiǎn)防范與管理手冊
- 股權(quán)質(zhì)押轉(zhuǎn)讓協(xié)議書
- 公司食品采購合同
- 政府采購合同示本
- 信息與通信網(wǎng)絡(luò)安全管理作業(yè)指導(dǎo)書
- 2025年婁底道路貨運(yùn)駕駛員從業(yè)資格考試題庫
- 2025年三門峽駕駛資格證模擬考試
- 2025年昆明貨運(yùn)從業(yè)資格證考試模擬題庫及答案大全
- 電力行業(yè)標(biāo)準(zhǔn)合同(2篇)
- 勞動(dòng)合同(模版)4篇
- 某水毀公路維修工程施工方案
- 家庭病房工作制度和人員職責(zé)
- 道德與法律的關(guān)系課件
- 建設(shè)工程監(jiān)理合同示范文本GF-2018-0202
- 2022質(zhì)檢年終工作總結(jié)5篇
- 國際商務(wù)談判雙語版課件(完整版)
- 物業(yè)管理應(yīng)急預(yù)案工作流程圖
- (高清正版)T_CAGHP 003—2018抗滑樁治理工程設(shè)計(jì)規(guī)范 (試行)
- 畢業(yè)論文論財(cái)務(wù)管理是企業(yè)管理的核心
- 清潔化施工無土化安裝施工方案
評(píng)論
0/150
提交評(píng)論