Unreal教程Creating DecoLayers建立植被层.docx
《Unreal教程Creating DecoLayers建立植被层.docx》由会员分享,可在线阅读,更多相关《Unreal教程Creating DecoLayers建立植被层.docx(11页珍藏版)》请在冰豆网上搜索。
![Unreal教程Creating DecoLayers建立植被层.docx](https://file1.bdocx.com/fileroot1/2023-2/4/f0bb686a-3474-4fe7-90f4-024ef2cedd66/f0bb686a-3474-4fe7-90f4-024ef2cedd661.gif)
Unreal教程CreatingDecoLayers建立植被层
CreatingDecoLayers
DocumentSummary:
AnintroductorydocumentonsettingupDecoLayers.
DocumentChangelog:
LastupdatedbyMichielHendriks,v3323update.PreviouslyupdatedbyJasonLentz(DemiurgeStudios?
)toseparateintosmallerdocsforthe2110build.OriginalauthorwasLodeVandevenne(UdnStaff?
).
∙CreatingDecoLayers
oIntroduction
oCreatingaDecoLayer
oAdditionalDecoLayerProperties
▪AlignToTerrain
▪ColorMap
▪DensityMap
▪DensityMultiplier
▪DetailMode
▪DisregardTerrainLighting
▪DrawOrder
▪FadeOutRadius
▪LitDirectional
▪MaxPerQuad
▪RandomYaw
▪ScaleMap
▪ScaleMultiplier
▪Seed
▪ShowOnInvisibleTerrain
▪ShowOnTerrain
▪StaticMesh
oOtherSections
Introduction
HereyouwillseehowtocreateyourownDecoLayersandthevariouswaysyoucanmanipulatethemtoyourliking.ThisdocumentassumesthatyouknowhowtobuildandshapeaterrainandthatyouarefamiliarwiththeUnrealEdInterface,theStaticMeshBrowser,andtheTextureBrowser.
CreatingaDecoLayer
DecoLayersgenerateStaticMesheseverywhereontheterrain.Youcanonlyseetheonesthatareinsidearadiusyoucanset,tosaveresources.Also,theStaticMeshesfromaDecoLayerareabledonotimpedeplayers,sousingthemfortreesisn'trealistic,butDecoLayersarebetterusedforgrass,flowersandferns.
TocreateanewDecoLayeronaTerraingototheTerrainEditorandclickontheDecorationstabandpress
.YoucanalsoaddmorethanoneDecoLayerifyoulike.BeforetheDecoLayerworks,youhavetosetalotofsettings.FirstgiveitaStaticMeshbyrightclickingonthenewlycreatedDecoLayer.ThistellstheDecoLayerwhatitwillberendering.
ThenyoumustcreateanewTerrainLayer.Getatexturethatisverydifferentfromyourterrain(forinstanceancheckedtexture-althoughmakesureit'sanRGBA8texturewithanalphachanneloraP8texture).CreateanewTerrainLayerbyclickingonthe"Layer"taboftheTerrainEditor,thenclickthe
button.Besuretoenterthetexture'scorrectdimensionsintheAlphaHeightandAlphaWidthfields.Alsoyoushouldcreatethislayeratthebottomofthelayerstack.Ifyoudidnot,youcanmoveittothebottombyselectingthelayerandusingthe
buttons.
Next,selecttheLayerTexturethatwascreatedintheTexturePackage"MyLevel"intheTextureBrowser(Decoalpha1inthisexample).GobacktotheDecorationsTabandthenright-clickontheDecoLayerandchoosethe"SetDensityTexturefromCurrent."ThistellstheDecoLayerwheretolaythedecorationsusinganalphachannel.Thewhitepartsofthealphachannel,orthehighestplacesinthepaletteoftheP8texture,willbecometheplaceswherethemostStaticMesheswillbegenerated.
YoucanalsocreateyourowntexturesmapstouseasaDensityTexture.Ifyoujustwantthewholeterraintobegrassy,youcanuseforexampleawhiteDensityTexture,butifyouwantthegrasstobeonlyintheNWcorneroftheterrain,maketheDensityMapblackeverywhere,exceptinonecorner.Forexample,youcancreateacropcirclewithit.ThepictureontheleftshowsthealphachanneloftheDensityTexturethatwasused:
ThenextoptionstosetareinthePropertieswindowoftheTerrainInfo.Toopenthis,justdoubleclickontheTerrainInfonameintheTerrainstaboftheTerrainEditor.GototheTerrainInforolloutwithinthePropertieswindowandthenexpandtheDecoLayerssection.
ThenexpandtheDecoLayerenumeratedas"[0]",andundertheFadeoutRadiusenteralargevaluefortheMax,andasmallervalueoffortheMin.BetweeneachMinandMaxFadeOutRadius,theStaticMesheswillbecomemoreandmoretransparent,untiltheybecomeinvisible.ForexampleinthescreenshottheMinFadeOutRadiusis500andtheMaxis1200.Bothradiiaremarkedwithayellowcircleonthescreenshot.Everythinginsidethesmallestcircleisopaque,everythingbetweenbothcirclesistranslucent,andoutsidethecircleseverythingbecomesinvisible.
ThelastinaddingtheDecoLayerMeshestoyourmapistopaintthemontoyourmap.Todothis,gobacktotheLayerstaboftheTerrainEditorandselectthelayeryoucreated(Decoalpha1forthisexample).IfthecheckeredtextureyouselectedastheDensityTextureisshowingupwhenyoupaintontheDecoLayerMeshessimplygototheLayertabintheTerrainEditorandmovetheLayeronebelowtherestoftheLayersinthestack.Thiscausestheterraintonolongerrenderthetexture;howeveryoucanstillselectthatlayerandpaintwithit.
NOTE:
DoNOTpaintwhileyouhavetheDecoLayerselectedundertheDecorationstab.ThiscancreateholesintheDensitymapwhichpreventyoufrompaintingonStaticMeshesanywhereonthoseholes.
AdditionalDecoLayerProperties
ThereareotheroptionsforadjustingtheDecoLayerswithintheTerrainInforollout.Belowaredescriptionsofwhateachoffieldcontrols.
AlignToTerrain
Ifthisissetto[1],thissettingwillcausetheDecoLayertorotatetheStaticMeshestoalignwiththenormalofthequadthatthemeshissittingon.Ifleftat[0]theStaticMesheswillallbevertical.
Aligningtotheterraincanbeusefulforsuchthingsasrocksanddebris,butwhenusedontreesandgrassitcanlookoutofplace.
ColorMap
Thismapchangesthecolorofthedecorationsondifferentlocations.IthastobeaRGBA8texture;otherwisealldecorationswillbecomeblack.ThiseffectisbestvisibleonwhiteorverybrightStaticMeshes.Forexample,whiteStaticMeshesbecomelikethisifyouuseacolorfulColorMap:
YoucanalsopaintacolorontheDecoLayermanually:
gototheTerrainEditingWindow,selectthetool"Color",pickacolorwiththeColorbutton,andthengototheDecorationstabandselecttheDecoLayeryouwanttopainton.Thenyoushouldbeabletopaintontheterraininthe3DView.
DensityMap
ThisistheTextureMapyouassignedbyrightclickingontheLayerintheTerrainEditor.FromhereyoucanreassignittoadifferenttexturebyfirstselectingatextureintheTextureBrowserthenclickingthe"Use"buttoninthisfieldwhenitisselected.
DensityMultiplier
ThesefieldsvarythenumberofStaticMeshesthatareplacedinthepaintedDecoLayerareaontheterrain.I'mnotsurehowexactlytheMaxandMinvaluesseparatelydeterminethenumberofStaticMeshesplaced,buttheydoeachdodifferentthings.ExperimentwitheachtofindtheappropriatedensityofDecoLayerStaticMeshes.
DetailMode
Thisdefinestheminimaldetailthathastobesetbeforethisdecolayerisshown.TheminimalvalueisDM_Low,inthiscaseitwillalwaysbeshown,unlessdecolayersarecompletelyturnedoff(DecoLayersin[WinDrv.WindowsClient]).WithDM_Highit'sonlyshowninhighdetailmode(HighDetailActorsintherenderdevicesettings),andDM_SuperHighisjustforeyecandy(SuperHighDetailActorsintherenderdevice).
DisregardTerrainLighting
Settingthisvalueto1willforcethedecomeshestoignorethelightingvalueofthequadtheyreston,andmakethemappearfullbright.
DrawOrder
TheDrawOrderallowsyoutosetinwhatorderthedecorationsshouldbedrawn.SORT_BackToFrontdrawstheonesfarawayfirstandthentheonesclosetothecamera,andSORT_FrontToBackdoestheopposite.SORT_NoSortusesnospecificorder.YoucanusethissettingtopreventproblemswithAlphaTextures:
iftheneartreesaredrawnfirst,andafterthatthedistanttrees,theenginemayforgettodrawthesebehindsemi-transparentpartsoftheAlphaTextureifAlphaTestison.Thisisshownonthefirstscreenshot.IfyounowsetDrawOrdertoSORT_BackToFront,thedistanttreesaredrawnfirst,andtheAlphaTexturefromtheneartreesisblendedcorrectlyoverthem.
Sincethereareonlythreedifferentsettings,itisprettyeasytoexperimentwitheachofthesettingstoseewhichworksbestforyoursituationifyou'renotsurewhichonetouse.
FadeOutRadius
ThesearetheradiithattheStaticMeshesbegintofadeout.TheMinsettingdeterminesthedistancefromthecameraatwhichtheystarttobecometranslucent,andtheMaxsettingdeterminesthedistancefromthecameraatwhichtheybecomeentirelytransparent.
LitDirectional
Ifthisvalueissetto[1],itforcestheStaticMeshestousesunlight.Itcanlookverybadinsomecases,asitwillcauseshadowsonthingslikegrassandsuch.
MaxPerQuad
ThisvaluesetsthemaximumnumberofStaticMeshesplacedperquad.
RandomYaw
Ifthisissetto1,theStaticMesheswillberandomlyrotatedalongtheZaxiswhichhelpsbreakup`tiling'appearance.BeawarethatthismaycauseAlignToTerraintoworkincorrectly.
ScaleMap
YoucanaddaScaleMapontheDecoLayer,thisisaRGBA8texturethatdetermineswhatsizethedecorationshaveondifferentlocationsontheterrain.ThisisdoneforX,YandZindependently:
theredandgreenchanneldeterminethewidthandlength,andthebluechanneltheheight.ForexampleifyouusethetexturefromtheleftpictureasScaleMap,andtheDecoLayerisaforest,theforestwilllooklikethescreenshotontheright:
ScaleMultiplier
YoualsohavetoenteraScaleMultiplier,therearesixvaluesforaMinandMaxX,YandZscale.IfyougiveadifferentMinandMax,eachdecorationwillgetarandomsizebetweenbothvalues.SometimestheStaticMeshissosmallorsobigthatyoucan'tseeitanymore,sometimesyoureallyhavetotrydifferentvaluesbeforeyoucanseethedecorations.
Seed
ThesedeterminedifferentrandomlygeneratedlayoutsfortheplacementoftheStaticMeshes.IffeelthatyouhavetheproperdensityandnumberofStaticMeshesbuttheStaticMeshesaren'tquiteintherightplace,tryenteringafewdifferentnumbersinh