代表的英文译语怎么说-在线课堂
2023年3月31日发(作者:英语四级预测作文)
unity插件UMA2UnityMultipurposeAvatar手册翻译
UMA-UnityMultipurposeAvatar
(UMA2的手冊跟1是一樣的)
AvatarsgeneratedbyUMAframework
WhatisUMA?
UMA-UnityMultipurposeAvatar,isanopenavatarcreation
framework,itprovidesbothbasecodeandexamplecontentto
heUMApack,it′spossibletocustomizethe
codeandcontentforyourownprojects,andshareorsellyour
creationsthroughUnityAssetStore.
什麼是UMA?
UMA–UnityMultipurposeAvatar是一個開源的Avatar創建工
具,它提供關於創建Avatar的基礎代碼和示例。使用UMA工具包,
可以為你的工程定制代碼和內容,并可以通過UnityAssetStore分享
或賣你的作品。
Closeondetailedavatar
UMAworksbothonUnityPROandfreelicences,butbenefits
fromPROfeaturesforacceleratingUMAcreationsteps.
ThisprojecthasbeenupdatedforUnity4.3,asitwillrequire
accesstotheMecanimavatarAPIonfollowingreleases.
UMAcanbeintegratedandusedonmobile,standaloneand
webplayerbuildsandincludedshadersrequireShaderModel2
e
targetingolddevices,it′srecommendedtoreduce
textureresolutionandtakeotheroptimizationsmeasuresto
avoidmemoryissues.
UMAisdesignedtosupportmultiplayergames,soitprovides
codetopackallnecessaryUMAdatatosharethesameavatar
enecessarytoimplementa
customsolutiondependingonyourneedstooptimizeand
reduceserializeddata.
UMA在UnityPRO版和免費版都可以工作,但PRO版的特性可
以加速UMA的製作速度。
這些工程已經升級到Unity4.3,因為基於以下幾點,它將需要訪
問Mecanim的AvatarAPI。
UMA可以被整合并在移動設備使用,單機和Webplayer和包括
需要ShaderModel2的項目或者高級項目。它沒有在控制台項目測
試。如果你面對老設備,推薦降低貼圖分辨率并做其他優化避免內存
問題。
UMA被設計用來支持多角色遊戲,所以它提供代碼將所有必要的
UMA資料打包在服務器和客戶端分享相同的Avatar。如果有必要的話
它可以執行定制的服務,來優化額減少序列化資料。
Performanceandmemoryusage
UMAframeworkprovidesasetofhighresolutioncontent,
flexibleenoughforgeneratingacrowdwithtonsofrandom
texturesareprovidedforgeneratingfinalatlasresolutionofupto
ingontheamountofextracontentbeing
importedtotheproject,itmightbenecessarytohandlememory
managementorreducetextureresolution.
EveryUMAavatarcreatedhasit′sownuniquemeshand
Atlastexture,ndardatlas
resolutionof2048x2048isrecommendedforcreatinga
smallnumberofavatars,forgamescreatingonahugeamountof
avatars,usingloweratlasresolutionorsharingmeshandatlas
initiallyplannedtoprovide50
avatarsonscreen,butthelatestversioncaneasilyhandlea
hundredofuniqueavatars.
效率和內存使用
UMA框架提供一系列高分辨率內容,足夠為過場動畫創建一大群
帶有不同Avatar或高質量定制Avatar的人。源貼圖提供地圖質量的
分辨率達到4096x4096。基於被添加到場景的額外內容的數量,可能
有必要進行內存管理或者降低貼圖分辨率。
每個創建的UMAAvatar有他自己的唯一的mesh和貼圖,需要
額外的內存。標準的貼圖分辨率是2048x2048,但推薦使用較少的
Avatar數量,若果遊戲創建了大量的Avatar,那麼使用較低分辨率的
貼圖、共享mesh和貼圖是有必要的。UMA最初計劃在屏幕最多同屏
50個Avatar,但最近版本可以輕易上百個獨特的Avatar。
100Avatarsinrealtime
FreeandPROlicensedifferencesforUMA
UMAresultsonPROandFreelicensesaremeanttobeas
similaraspossible,howevercalculatingaUMAatlascanbe
it′spossibletocreatetheatlasusing
RenderTextures,elicense,
itrequiresprocessingeachpixelindividually,soit
′spossible
tosplitthiscalculationoverasmanyframesasnecessarytoavoid
drasticallyloweringframerate,buthigherresolutiontextureswill
gameObjectUMAGeneratorprovidesanoptionforusingPROor
Free,I′veleftthisasawayPROuserstestingperformance
ofcontentonindieprojects,elicenseusers
needtounchecktheusePROcheckboxonUMAGenerator.
免費版和PRO版Unity的區別
UMA在免費版和PRO版的運作結果是完全一致的,然而UMA
Avatar的計算方式有些不同。PRO版可以使用RenderTexture創建貼
圖,所以貼圖計算是很快的。但免費版需要單獨處理每個像素點,所
以它會花費多很多的時間并耗電。可以吧計算分散到多個幀來避免急
遽降低幀率,但更高分辨率的貼圖還是需要花費相當多的時間。
UMAGenerator提供一個使用PRO版或免費版的選項,我留下這個
是為了PRO用戶可以測試獨立開發項目的內容。免費版用戶請不要複
選usePRO複選框。
HowdoesUMAwork?
Creating3dcharactersisatimeconsumingprocessthat
y,each
characteriscreatedbasedonanuniquemeshandrigandis
individuallyskinnedandtextured.
Whendevelopinggamesthatmightrequireahugeamount
ofavatars,it′sexpectedtodevelopasolutiontohandleavatar
ytheystartfromasetofbase
meshesandfollowstandardstobeabletosharebodyparts
ojectendsupwithadifferentsolution,and
it′shardtosharecontentorcodebetweenthem.
UMA如何工作?
創建3D角色是一個花費大量時間的過程,需要了解很多不同的領
域的知識。通常,每個角色基於唯一的mesh、rig、蒙皮和貼圖。
開發遊戲時可能需要大量的Avatar,這需要開發一個更高效的創
建Avatar的解決方案。通常開始於一系列基礎mesh并按標準製作以
共享身體的構件和其他內容。每個工程都結束都會有不同的解決方案,
並且很難共享內容和代碼。
UMAismeanttoprovideanopenandflexiblesolution,which
makesitpossibletosharecontentandcodebetweendifferent
projects,resultinginapowerfultoolfortheentirecommunity.
UMAhastwomaingoals:Sharingcontentacrossavatarsthat
usessamebasemeshandoptimizingcreatedavatars,while
providingtheabilitytochangeavatarshapeinrealtime.
Toachievethat,I′vecreatedaspecialrigstructurethat
handlesbonedeformationinastrategicwaythatmakesit
possibletodeformUMAshapebasedonchangesonbones
position,scaleandrotation.
UMAexampleavatarsarebasedontwobasemeshes,amale
themcanshareclothingandaccessories,
andcanbeusedasabaseonthecreationofnewmeshesfor
differentraces.
BecauseclothesandaccessoriesareskinnedtoUMAbase
mehes,theyreceivethesameinflueceofUMAbodyshape,soany
meshdeformstoanyUMAbody.
UMA想要提供一個開放的靈活的解決方案,使不同工程間共享代
碼和內容成為可能,為整個社區提供一個強大的工具。
UMA有兩個主要目標:使用相同基礎mesh的Avatar間共享內
容,優化創建的Avatar,同時提供實時改變Avatar形狀的能力。
為了做到這些,我創建了特殊的rig結構,可以全局的控制骨骼變
形,這使得通過骨骼位移、縮放、旋轉改變UMA形狀成為可能。
UMA的示例Avatar基於兩個基礎mesh,男女各一個。每個可
以共享衣服和配飾,並且可以作為製作其他人種新mesh的基礎。
因為衣服和配飾被蒙皮到UMA基礎模型,他們都會受到UMA
body形狀的影響,所以任何mesh可以變形到任何UMAbody。
UMAavatarsgeneratedbasedonsamecontentanddifferent
shapes
Thisway,ifyouhaveanarmorordress,itcanbeshared
betweenallmaleorfemaleavatars,eveniftheyhavevery
differentbodyshapes.
manydifferenttextureswhengeneratingthefinalatlas.
Thoseextratexturescanbeusedtocreateevenmorevariationto
eachavatar,andcanbeusedforclothes,detailsandmanyother
possibilities.
UMAoptimizationoccursinmanysteps:EachUMAavatar
canhaveanuniquetextureatlasprovidingallnecessarytexture
data,thismakesitpossibletohaveeachUMAgeneratingasingle
drawcall,inthecaseofasinglematerialbeingused.
AllUMApartsarebakedtogetherintoonefinalmesh,which
ensen
fromUnityteamimplementedanadvancedskinned
meshcombinertoaccomplishthis.
OnUMAlatestversion,theoldCombineInstance()codeisstill
availableincasethere′snointentiononusingextrabonesthat
acycode
requireslessprocessingtime,butprovideslimitedresults.
如果你有盔甲或者裙子,它可以在男人女人Avatar間共享,即使
他們有很不同的身體形狀。
很多不同的貼圖用來創建最終的atlas。這些額外的貼圖甚至可以
被用來創建更多變化到每個Avatar上,並且可以被使用到衣服,細節
和很多其他的可能的地方。
UMA優化分很多步奏:每個UMAAvatar可以有獨立的貼圖Atlas
提供所有必要的貼圖資料,這可以在使用單個材質的情況下,讓每個
UMA只產生一個drawcall。
所有UMA組成部分都會被烘培整合到一個最終mesh,這可以降
低運行中的相關計算。Unityteam的JoenJoensen使用一個高端
skinnedmesh合成器實現這個功能。
在UMA最新版本,老的CombineInstance()代碼在不使用額听取蛙声一片 外
骨骼動態包含在Avatar內的情況下仍然可用。老的代碼需要更少的執
行時間,但會有很多限制。
Howcontentiscreated?
如何創建內容?
SetofHighpolymeshesbasedonUMAfinalclothes
CreatingcontentforUMAdoesn′trequiremuchextra
re
threemaintypeofcontent:Basemeshes,SlotsandOverlays.
為UMA創建內容不需要很多超越通常asset創建流水線的額外知
識。有三個主要的內容類型:基礎mesh,插槽和覆蓋。
BaseMeshes
UMAprovidestwostartingbasemeshes,amaleandafemale.
It′spossibletocreatecompletelydifferentanduniquebase
ontentusesbase
meshesasreference,ifyoucreateaminotaurbasemeshandare
abletokeepthesamedatafromtheoriginalmaletorsobase
mesh,allclothesbasedonthatmaletorsocanbesharedwiththe
newMinotaurmesh.
Foracompletelydifferentrace,suchashorses,youwillneed
uldthenbesharedwithothersimilarraces,
dfemaleBasemeshes
werecreatedconsideringtheaveragevolumethosebodieswould
beabletoreachusingtheadjustmentsintheUMArig.
基礎Mesh
UMA提供兩個入門基礎模型,一男一女。可以利用UMA創建完
全不同并獨立的基礎模型。由於所有內容使用基礎mesh作為參考,
如果你創建了一個牛頭人基礎模型,并保持資料與原始男性軀幹基礎
mesh相同,那麼所有的基於那個男性軀幹的衣服可以共享給這個新的
牛頭人mesh。
一個完全不同的物種,比如馬,你將需要單獨的內容。這肯今後
可以共享到其他類似的物種,像獨角獸甚至是龍。男人和女人基礎
Mesh是基於平均尺寸創建的,這些身體可以使用UMArig的調節器
做到。
UmaFemaleandMalebasemeshes
Slots
re
basicallycontainersholdingallnecessarydatatobecombined
withtherestofanUMAavatar.
Forexamplethebasemeshesprovidedarenormallysplitinto
severalpieces,andthen
implementedasslotswhichcanbecombinedinmany
differentways.
AnUMAavatarisinfact,thecombinationofmanydifferent
slots,someofthemcarryingbodyparts,othersproviding
UMAvariationcanbecreated
simplybycombiningdifferentslotsforeachavatar.
Slotsalsohaveamaterialsample,whichisusuallythen
eyelashesforexample,haveauniquetransparentmaterialthat
′snecessarytoseta
materialsampleforallslots,asthoseareusedtoconsiderhow
cases,thesamematerial
samplecanbeusedforallslots.
Slots
所有提供mesh的UMA內容都是slot。Slot是持有所有需要組
合到UMAavatar的必要資料基礎容器。
比如:基礎mesh通常被分成幾塊,如頭,軀幹,腿。。。然後
以slot執行,并被以多種方法組合。
UMAavatar事實上就是很多個不同slot的組合,一些帶著身體
部分,其他提供衣服或者飾物。很多UMA變體可以簡單通過為每個
Avatar組合不同的slot來創建。
Slot還有一個材質採樣,它通常與其他共享相同材質的slot組合。
女人睫毛舉例:有一個獨立的透明材質可以被與透明頭髮材質共享。
必要的時候可以為所有slot設置一個材質採用,因為這些被用來告知
mesh將被怎樣組合。在很多情況,相同的材質採用可以被使用到所有
slot。
UMAstandardavatarmaterialusesasimilarversionofUnity′s
BumpedSpecularShader,butUMAprojectprovidesmanyother
options.
Thebigdifferencebetweenbodypartsandothercontentis
thatbodypartsneedtobecombinedinawaythattheseams
wouldn′lethis,it′simportantthatthevertices
alongmeshseamssharethesamepositionandnormalvalues
toavoidlightningartifacts.
Tohandlethat,weprovideatoolforimportingmeshesthat
recalculatethenormalandtangentdatabasedonareference
erialBuilderwillbeexplainedinfollowingpages.
UMA標準Avatar材質使用類似Unity的BumpedSpecular
Shader的材質,但UMA工程提供很多其他選項。
身體部分和其他內容最大的不同是,身體部分需要以縫隙可見的
方式被組合。為了做到這,沿著縫隙共享相同的位置和法線的頂點值
避免閃電失真很重要。
為了控制這,我們提供導入mesh工具,基於相關mesh重新計
算法線和切線資料。UMAMaterialBuilder將會在後續章節介紹。
ExampleofMaleslots.
Overlays
Eachslotrequiresatleastoneoverlaysetbutusuallyreceives
yscarriesallthenecessarytexturesto
generatethefinalmaterial(s)andmighthaveextrainformation
stoverlayinthelistprovidesthe
basetextures,andallotheroverlaysincludedarecombined
withthefirstone,insequence,generatingthefinalatlas.
UMAstandardshaderrequirestwotexturesprovidedby
overlays,onetextureforDiffusecolor(RGB)+overlaymask(A)
andonetextureforNormalmap(GA),Specular(R)andGloss(B).
Thesenon-standardtexturesletuscompressalotofinformation
inonlytwotextures,reducingfinalmemoryusage.
Overlays
每個slot需要至少一個overlay但通常會有一個overlay列表。
Overlay帶有所有必須的用來創建最終材質的貼圖并可以有額外的映射
信息。列表中的第一個overlay為基礎貼圖,其它的都被組合到第一個
上,按隊列順序,創建最終atlas。
UMA標準shader需要overlay提供兩張材質,一張
Diffuse(RGB)+overlay遮罩(A),另一張Normal貼圖(GA),
Specular(R)和Gloss(B)。這些非標準貼圖讓我們壓縮大量信息在2張
材質裡,減少最終內存消耗。
Exampleofoverlaycomposition
Together,JoenJoensenandIhaveworkedon“UMAmaterial
builder”,atoolthatreceives3standardtexturesforDiffuse(RGB)
+mask(A),Normalmap(RGB)andspecular(RGB)+gloss(A),and
theprocess,thespecularcolorisreducedtoonechannelofdata,
theresultingaveragecolorofthe3channelsprovided.
FollowingPedroToledo’spost“BriefConsiderationsAbout
Materials”/?p=902,JoenandIworkedtogethertoreachtwo
shaderthathandlespecularcolorbasedondiffusecolor
referenceresultinginDielectricandconductormaterials.
I′vealreadymanagedtointegratesomeofthemostcommon
UnityshadersintoUMAandtheadjustsrequiredarequitesimple.
Evenmoreadvancedshaderscanbeintegratedandused,keepin
mindit′spossibletoprovideextratexturesoneach
overlay,thisway,it′spossibletoincludedisplacementmaps,
Subsurfacescatteringmasksoranynecessarydata.
我和JoenJoensen一起設計“UMAmaterialbuilder”,接受3
個標準貼圖,Diffuse(RGB)+mask(A),Normalmap(RGB)和
Specular(RGB)+gloss(A),并壓縮到上文所述的2張貼圖中。在這個
過程中,Specular顏色被精簡到單通道資料,只提供3個通道的平均
值。
基於PedroToledo的文章”BriefConsiderationsAbout
Materials“/?p=902,Joen和我一起製作了這兩個基於Diffuse顏
色影響來控制Specular顏色的shader,形成了絕緣體和導體材質。
我已經設法整合一些常用的Unityshader到UMA并調校也非常
簡單。甚至更多的高級shader也可以被整合和使用,緊記為每個
overlay提供額外貼圖的重要性,用這個方法,可以包含置換貼圖,
SSS材質或者任何可能的資料。
Assetcreationpipeline
UMAprojectprovidesanUMAcontentcreatorpack,it′sa
zippedfolderwithallnecessarybasemeshesandtexturesfor
ides:
-basediffuse,specularandnormalmaptextures
-UVlayoutreferenceimages
-
-eformat
-.ZTLfilesforZbrushusers
-ileforblenderusers
I′vespentalongtimerecordingandproducingvideo
tutorials()tocoverallthebasicprocessofcontentcreation,but
theknowledgeforactuallyworkingonany3dsoftware
isprerequisite.
TheoverallknowledgeforgeneratingUMAcontentis3d
modeling,rigging,′salsopossibleto
mple,ifyou
haveantshirtslot,withtherighttextureworkit′spossibleto
provideanchainmailoverlaywithoutextraknowledgeof
modeling,riggingorskinning.
Asset製作流程
UMA工程提供一個UMA內容製作工具包,壓縮文件夾包括所有
必須的基礎mesh、材質,用來創建你自己的內容。提供:
-基礎Diffuse,Specular和normalmap材質
-UV佈置參考圖片
-.OBJ格式男女基礎模型
-.FBX格式綁定并蒙皮的基礎模型
-為Zbrush用戶提供.ZTL格式資料
-為blender用戶提供.Blend格式資料
我用了大量時間錄製和提供視頻教程
()裡包含所有創建內容的基本步驟,但前提是具備實際的3D軟件
的工作經驗和知識。
大致上創建UMA內容需要的知識包括:3D建模,綁定,蒙皮和
貼圖。同樣也可以用現有的內容工作。比如:如果你有一個帶正確貼
圖的T恤slot,那就可以提供一件鎖子甲而不需要額外的建模、綁定、
蒙皮知識。
TexturingandUVmapping
BothUMAmaleandfemalebasetextureshaveaspecific
sthelistofthosebasetexturesizesinpixels:
-Head:2048x1024
-Body:2048x2048
-InnerMouth:512x512
-Eyes:512x512
材質和UV映射
UMA裡不管男人女人都有一個特定的基礎貼圖分辨率。以下是這
些基礎貼圖像素大小:
-頭:2048x1024
-身體:2048x2048
-口腔:512x512
-眼睛:512x512
MalebodyUVlayout
Thosevaluesarespecifictotheprovidedbasemeshesasa
lan
followingadifferentstandard,it′spossibletouseanydifferent
resolution.
WhencreatingnewcontentforUMA,ifyou′reawareitwillbe
coveringanareaofUMAbodytexture,it′spossibletousethatUV
areaforthenewcontenttexture,
examplecanbeseenonFemaletshirtandhair,bothofthem
saveatlasspace,havingthosetexturesasoverlaysforbodybase
textureinsteadofbeingbasetexturesthemselves.
Also,anyoverlaytextureandit′scoveredbasetexturesdon′t
mple,FemaleUnderwear01
overlaycoversonlythelefthalfofthebase,soit′spossibletohave
thatoverlaywithhalfthewidthofbodybasetexture.
TheRectprovidedtogetherwiththeoverlayelementsis
responsibleforkeepinginformationofthepositioningadjustof
thecroppedoverlay,relativetobasetexturecoordinates.
It′spossibletoprovideoverlaysthatwillreceivecoloradjusts
ecases,usuallythepredominantcoloris
whiteorgrayinthoseareas,tohaveaneutralinfluenceoverfinal
color.
這些值定義在提供的基礎mesh上作為任何人為他們創建內容的
一個標準。如果你龙打一成语 計劃遵循其它標準,可以使用任何其它分辨率。
當為UMA創建新內容,如果你意識到它將覆蓋UMAbody貼圖,
你可以使用這一UV區域建立新的內容貼圖,如果有足夠空間的話。可
以在女T恤和頭髮看到實例,它們都節約atlas空間,將這些貼圖做成
body基礎貼圖的overlay而不用修改基礎貼圖本身。
同時,任何overlay貼圖和它覆蓋的基礎模型不需要保持一樣的尺
寸。比如:FemaleUnderwear01overlay只覆蓋左半邊的基礎貼圖,
所以它可以使overlay只有body基礎貼圖一般寬度。
與overlay元素一起提供的Rect負責保持overlay裁剪後的相對
於基礎貼圖坐標的位置調整信息。
可以在atlas作品中提供接收顏色調整信息的overlay。在這種情
況下,通常在這些區域的主要的顏色是白色或灰色,對最終色彩做中
性影響。
Aboveimageillustratestheuseofacroppedoverlayin
junctionwithEyebasetexturetogenerateiriscolorvariation
上圖舉例說明裁剪的overlay與眼睛基礎貼圖合併來創建虹膜顏色
變體。
Inotherhand,UMA1.0.1.0Rdon′tsupportcombining
textureswithdifferentoriginalsize:Evencroppinganoverlay
removingtheunusedmaskedarea,theoriginaloverlay
uprovidea
croppedoverlayforeyebrows,itrequiresaRectdatarelativeto
inganoncropped
overlaywithsmallerorbiggerresolutionthanthebaseoverlay
mightgenerateerrormessages.
另一方面,UMA1.0.1.0版本不支持貼圖以不同原始尺寸組合:即
使裁剪overlay來刪除不適用的屏蔽區域,overlay的原始尺寸也必須
與基礎材質一致。所以如果你為睫毛提供裁剪overlay,他Rect必須
參照頭部貼圖的尺寸2048x1024。提供尺寸大於或小於基礎overlay
的未裁剪的overlay都會產生錯誤信息。
3dmodeling
It′spossibletointegrateany3dmeshintoanUMAavatar,it′s
importanttofollowthesameoptimizationguidelinesusually
usedfortraditionalcharactersandclothes,astopologyand
vertexcount.I′veincludedmesheswithbothuniformand
nonuniformpolygonplacement,it′simportanttokeepinmind
eway,I′veworkedbothon
meshesmostlyquadbased,andmeshesentirelybasedontris
tentcanbeintegrateddespite
thosedifferences,butstretchedpolygonsmightcausepoor
lightningresults,especiallyvisiblewhennotusingnormalmaps.
3D建模
可以整合任何3dmesh到UMAavatar裡,遵循與傳統的角色優
化相同的流程是很重要的,因為拓撲和頂點數量。我已經包含了一致
或不一致的多邊形佈局,記住什麼情況用哪個非常重要。相同的方式,
我同時工作在導出之前基於四邊形和基於三角面的mesh上。所有內
容可以被整合而不用理會這些不同,但拉伸多邊形可能導致不良的閃
電邊緣問題,不使用法線貼圖的時候特別明顯。
FemaleandMalejeanscompletelydifferenttopology
Riggingandskinning
pevariations
wecanachieveonUMAavatarsareaconsequenceofchanging
bonescales,orrectlyfollowing
thosechangesdependsonriggingandskinningentirelyand
anincorrectskinningprocessmightleadtoissuessuchasa
clothingpiecesnotfollowingthesameshapevariationasthe
body.
I′veprovidedbasemesheswithrigandskindatabecause
most3dsoftwarehasspecifictoolsthatallowuserstotransfer
boneweightdatabetweendifferentmeshesavoidingmostofthe
timeconsumingprocessinvolved.I′veshownthisbeingdonein
Blenderatsomevideotutorials(),butthesamecanbedonewith
XSIGatororotherspecificsolutions.
Fordressesorarmor,simplyprojectingthosevaluesmight
notbeenough,andskinningknowledgemaybenecessaryfor
importanttokeep
inmindifyou’recreatingyourownrigistokeepapairofparent
andchildrenbonesanywhereyouneedthatspecificareato
thecaseonmostofthe
UMArig,’reabletochangethearm
scalebothinuniformandnon-uniformways,buthavingannon-
uniformscaledeformsallchildbonestoo,sothosechangesneed
′salso
importanttokeepinmindit′salwaysthesechildbonesthatcarry
theskinningdata,asitwillalwayschangedirectly,andunderthe
influenceoftheparentbone.
綁定和蒙皮
這是UMA魔法發生的地方。所有我們能在UMAavatar獲得的變
形,都是骨骼縮放,位移,旋轉的結果。Mesh正確跟隨這些變形基於
綁定和蒙皮,錯誤的蒙皮過程可能導致產生問題,妳如衣服面片不跟
隨身體的形狀變化。
我提供綁定和蒙皮好的基礎mesh,是因為大多數3D軟件有不同
的工具讓用戶在不同的mesh變換骨骼權重資料,而為了節省用戶在
軟件上花費時間。我提供了使用Blender製作角色的視頻教程(),而這
同樣可以再XSIGator或者其他特殊工具完成。
裙子和盔甲,簡單映射這些值可能不夠,所以為了使跟隨身體變
形獲得最好的結果,蒙皮的知識可能是必須的。創建自己的綁定最重
要的是保持一對父子骨骼無論那個你要接收不均勻改變的特殊區域。
大部分UMA綁定,比如手臂。你可以均勻或者非均勻縮放手臂,但子
物體也需要非均勻縮放,所以這些改變需要應用到成對的子骨骼。緊
記,這些子骨骼帶有蒙皮資料,所以在父骨骼的影響下,它將總是直
接被改變。
ng
DatahasbeenprojectedwithBlenderTransferweightstool
男牛仔褲蒙皮和男基礎模型蒙皮。蒙皮資料用Blender權重轉換
工具進行映射。
3Dsoftware
BlenderisUMAstandardcontentcreationsoftware,because
it′
thestandardmeansI′llprovidemostofthe3dtutorialsonthis
specificapplicationbutkeepinmindmostoftheavailable
softwareshaveasetoftoolstohandlewhatI′mdoinginblender.
Initially,Iplannedincludingherethestandardimportand
exportsettingforeach3dsoftwareImanagetestingthe
integrationwithUMA,butasyou′regoingtonotice,importing
settingmostlydependswherethosefileswheregenerated,so
it′ortsetting,I′llexplainthe
specificsettingforexportingcontentforUMAbasemesh.
3D軟件
Blender是UMA創建內容的標準軟件,因為它開源所有的開發者
都能使用。按標準方式,我將提供所有特定平台的3D教程,但要知道
大部分可用的軟件都有一套像Blender一樣的工具需要操控。
最初,我計劃包括每個3D軟件的標準導入導出設置,通常都包括
文件在哪、創建在哪,所以這很難有一個標準。關於導出設置,我將
描述導出內容到UMA基礎mesh的特殊設置。
Blender
Importingfiles:Blenderhasahugelimitation:itcan′timport
fbxfiles(Update:OnBlenderlatestversion,fbximportisalready
beingintegrated),soitwillbehardersharingskinnedandrigged
ingobjfiles
isastraightforwardprocess,andblenderprovidessettingsfor
definningforwardaxisandupaxis,coveringdifferentcoordinate
′susuallyagoodideachecking“KeepVertOrder”,if
youneedtokeeptheindexofmeshvertices,thisisspecially
importantworkingwithzbrushandothersculptingtools.
Exportingfiles:Exportingfbxfilesofriggedandskinned
contenttounityrequireshaving“forwardaxis”as“Z
forward”and“UpAxis”as“YUp”.
It′sveryimportantwhenexportingcontentbeingsureboth
it′sposition,rotationandscalearenormalized,thismeansyou
nbemade
with“Ctrl+A”or“Object/Apply”.
Youusuallydon′tneedincludinganimationswhenexporting
clothesandacessories,butit′sreallyimportantthattherigis
ingtherig
mightraisethediskspacerequiredbythatfile,soit′susuallya
goodideatokeepabundleofmeshesonthesamefbxfile
wheneverpossible.
Blender
導入文件:Blender有一個巨大的限制:它不能導入fbx文件(在
Blender最新版本,fbx導入已經整合進來了),所以共享蒙皮和綁定
的模型將比其他軟件困難很多。導入obj文件過程很簡單,並且
Blender提供設置來定義坐標朝向和朝上坐標,用來處理不同的坐標
系統。通常選擇”KeepVertOrder”選項是個好主意,如果你需要保
持mesh頂點索引的順序,在Zbrush或者其他雕刻工具里面這特別重
要。
導出文件:導出包括綁定和蒙皮的fbx文件到unity需要設
置”forwardaxis“為”Zforward”,”UpAxis”為”YUp”。
導出前確認位置、旋轉、縮放都規格化很重要,這意味著你要烘
培所有這些到頂點位置。這可以用”Ctrl+A“或者”Object/Apply”
實現。
導出衣服和飾物的時候,你通常不需要包含動畫,但確保綁定信
息被和mesh一起導出這很重要。包括綁定信息,可能會增加磁盤空
間佔用,所以通常如果可能的話把大量mesh放置在一個fbx中是很
明智的。
3dsmax
Importingfiles:I′llfocusonimportingfilesfromthe
“Contentcreatorpack”,asthosewereexportedfromblender,
there′sasmallchangerequiredwhenimportingbasemeshfbx
filesto3dsmax,youneedtoset“units”to“Centimeters”to
havethecorrectsize.
Asyoucanseeonthefollowingimage,thefbxfile(upper
mesh)
Obj(lowermesh)filerequiresmanualrotationadjustsafter
importingprocess.
3dsmaxprovidesmodifier“skinwrap”asasolutionfor
copyingskinningdatabetweenUMAbasemeshandyourown
content.
Exportingfiles:ThesamewarningI′veprovidedforblender
usersapplyheretoo:It′sveryimportantwhenexportingcontent
beingsurebothit′sposition,rotationandscalearenormalized.
It′spossibletoadjustmeshpivotusing“AffectPivotOnly”
’saspecificadjustsrequiredwhencreatingyour
owncontent,theZrotationvalueofthemeshshouldbesetto
180degrees,thisisusuallydoneenteringAffectPivotOnlymode
androtatingthepivotitself.
Whenexportingthefbxfiles,youneedtohavebothyour
′susuallyagoodideanot
exporting,unitscanbekepton“automatic”and“UpAxis”
needtobesetto“Zup”.
3dsmax
導入文件:我將專注於從“Contentcreatorpack”導入文件,
因為這些從Blender導出的,如果要導入到3dsmax裡需要做個小改
變,你需要設置“units”為”Centimeters”獲得正確尺寸。
在下面的圖片你可以看到,fbx文件(在上的mesh)旋轉正確並且
是完全綁定和蒙皮的。Obj文件(在下的mesh)導入後需要手動旋轉。
3dsmax提供”skinwrap“修改器作為在UMA基礎mesh和你
自己的內容間複製蒙皮資料的解決方案。
導出文件:對於Blender用戶有相同的警告:非常重要,導出內
容時確保所有的位置、縮放、旋轉都已經規格化。可以使用”Affect
PivotOnly“按鈕修改meshpivot。
導出自己的內容,有些特殊的地方要調整,meshZ軸旋轉需要設
置為180度,這通常可以進入AffectPivotOnly模式然後旋轉pivot。
當導出fbx文件,你需要需要選擇你的內容mesh和綁定。
通常fbx文件包含攝像機和燈光是很明智的。單位可以保
持”automatic“,但”UpAxis“要設置為”Zup”。
Mecanim
Animation
UMAisintegratedwithanhumanoidmecanimavatar,
openingahugelistofanimationsthatcanberetargetedtoany
leandFemaleUMAprefabshadtheir
providesenough
bonesdohandlefacialanimation,thesametechniquesrequired
forfacialanimationonanymecanimavatarsapplytoUMA.
Slotsthatprovideextrabonesnotlinkedtohumanoid
mecanimavatarrequireextraadjuststoproperlyreceive
animation,asanimationdatawon′tberetargetedtothosebones.
Animation
UMA已經與humanoidmecanimavator整合到一起,大量打開
的的animation可以重定向到任何UMAavatar。男女UMAprefabs
有自己調整好的mecanimavatar設置。UMA綁定提供足夠的骨骼控
制面部動畫,與任何mecanimavatar一樣的面部動畫控制技術可以
應用到UMA。
Exampleofbonedrivenfacialanimation
MecanimavatarcreationAPI
Unity4.2providesanMecanimavatarcreationAPI,this滚字组词 is
necessarytorecreatemecanimavatarsbasedonchangesUMA
unity4.2,thiswasnotpossible
andIhadtouseLateUpdatetokeepbonechanges,consuming
extraprocessingtimeandpossiblybreakingMecanimIK
est
versionalreadyintegratesMecanimavatarcreationandprovides
fullsuporttoIKandRootmotionthankstoJoenJoensenand
Mecanimteamhelp.
Mecanimavatar創建API
Unity4.2提供一個Mecanimavatar創建API,重建mecanim
avatar在UMA接受到改變綁定的指令時是必須的。Unity4.2之前這
是不可能的,我只好使用LateUpdate來改變骨骼,消耗額外處理時
間並且可能會基於不同的骨骼改變方式破壞MecanimIK。UMA最新
版本已經整合了Mecanimavatar構造器,并完全支持IK和Root
motion。感謝JoenJoensen和Mecanim團隊的幫助。
UMAComponents
Overview
Joenprovidedadiagramforthebetagroupshowingthe
relationshipbetweenthevariouspartsoftheUMAframework.
I′veincludedanewversionheretohelpexplaininghowavatars
arecreated.
概述
Joen提供給beta測試組的圖解,展示UMA架構的各個部分的關
係。我製作了新版本,幫助描述avatar是如何創建的。
Libraries
Allavatarscreatedneedtohaveaccesstoasetofnecessary
data:Races,braryprovidesalistofeach
ofthosewithinandictionary,beingthekeyanstringwiththe
nameoftheelement,andthevaluetheelementdataitself.
Forprojectswithbigamountofcontentasmmogames,you
probablydon\'twanteverythingloadedinmemoryand
loading/unloadingassetsmightbecomenecessary,this
caserequiresimplementingcustomlibraries.
庫
所有創建的avatar需要訪問一系列必須的資料:物種,Slot和
Overlay。每個庫提供通過dictionary提供物件列表,元素名字符串作
為key,並且值就是資料本身。
如果工程有大量內容,比如mmo遊戲,你可能不希望所有都加
載到內存,因此加載/卸載asset很必要,這種情況需要實現自定義庫。
-racelibrary
EachRaceDataontheracelibraryprovidesaprefabwithall
sharedscripts,avatardataandetc,oneormoreDNAConvertes
andalistofthenameofbonesthatrequirebeingupdated.
Asyou′venoticed,I′veseparatedmaleandfemaleastwo
becauseeachraceprovidesanspecific
basemeshandrig/skinningdata,andusuallyrequirespecific
niquebasemeshesformaleandfemalegave
methepossibilityofreachingabettersilhouetteandtopologyfor
eachofthem.
DNAConvertersareresponsibletranslatingvalueslike
“height”and“armSize”tobonedeformationandshape
′spossibletohavetwodifferentraceswiththe
samevaluesto“height”and“armSize”,buteachofthem
convertingthosevaluesindifferentways.
-物種庫
在物種庫,每個物種資料提供一個prefab包含所有共享的腳本,
avatar資料等等,一個或多個DNAConverter和骨骼名列表需要更新。
你可能注意到,我吧男女分為兩個不同的物種資料。這是因為每
個物種提供一個特殊的基礎mesh和綁定、蒙皮資料,而通常需要特
殊的內容。給男女使唯一的基礎資料給我為他們兩個都做到更好體型
和拓撲結構的可能。
DNAConverter負責轉換類似”高度”和”手臂尺寸“的值到骨
骼變形和形體改變。尅有連個不同的物種帶有相同的”高度“和”手
臂尺寸“值,但每個都會轉換到不同的地方。
-Slotlibrary
EachslotprovidesaskinnedMeshRendererandamaterial
sample,′replanningoninludingextra
bonesonanySlot,itwillbenecessarytousejoen’s“UMA
materialbuilder”forgeneratingtheslotData,asitisresponsible
foridentifyingifthere′sanyextraboneandlistingall
theirtransforms.
ThefirstoverlayintheslotData′soverlayListprovidesthe
basetextures,andallotheroverlaysincludedarecombinedwith
thefirstone,insequence,generatingthefinalatlas.
-Slot庫
每個slot提供一個SkinnedMeshRenderer和一個材質採樣,如
前所述。如果你計劃在任何Slot包含額外的骨骼,必須使用Joen
的”UMA材質生成器“來創建slot資料,因為它負責定義是否有額外
骨骼并列表所有Transform。
slotData的第一個overlay為基礎材質,其它包含的overlay被
組合到第一個上,按順序創建最終atlas。
-Overlaylibrary
OverlaylibrarygivesaccesstoallavailableoverlayData,This
librarymightuseahugeamountofmemorydependingofthe
project,ultall
UMAtexturesareprovidedwithread/writetagchecked,butthis
isonlynecessaryifyou′reusingfreelicense.
Eachoverlayhaveancolorthatcanbeusedtotintit′sfirst
ythisvalueissetbycode,atthe
momenttheoverlayisbeingincludedontheslot.
TheColor32arrayschannelMaskandchannelAdditiveMask
colorherewillchangetheoverlaytexturefromoverlayListsharing
is,it′spossibletoadjusteach
texturechannelofeachoverlayofanatlas.
-Overlay庫
Overlay庫提供對所有可用overlayData的訪問,這個庫在工程
中可能需要極大的內存支持,因為它保持關聯到貼圖文件。默認的所
有UMA貼圖都選中了read/write標籤,但這在免費版是必須的。
每個overlay都有顏色可以用來對textureList中第一張貼圖著色。
通常當overlay被包含在slot的時候,在腳本中設置這個值。Color32
數組的channelMask和channelAdditiveMask提供對貼圖通道的特
殊控制。每個顏色都將改變overlayList里相同索引號的overlay貼圖。
這使得調整atlas中每個overlay中的每張貼圖通道成為可能。
Forexample,ifweconsiderreducingtheglossvalueofahair
texture,wecouldsetanchannelMasksecondcolor(index1,
relativetosecondtexture,wherenormalmap,specularandgloss
arekept)channel“b”toalowervalue.
FunctionspublicvoidSetColor(intoverlay,Color32color)and
publicvoidSetAdditive(intoverlay,Color32color)onoverlayData
dhave
or(1,new
Color32(255,255,50,255));toreduceglossvalueonabove
mentionedexample.
Therectvalueisspeciallyusefulifyou′reprovidinganoverlay
leandfemale
eyebrowscoveronlyasmallpartoftheheadbasetexture,andit
wouldbeawasteofmemoryhavingahugetexturewithmostof
it′sareacompletelymasked.
Thexvalueisthehorizontaloffsetofthecroppedoverlay,y
valueistheverticaloffset,andwidth/美人心计 heightarerelativeto
croppedoverlaysize.
I′vemanagedtoincludeonOverlaylibraryasetofbuttonsto
adjustalloverlaytexturesinasingleclick,thisisspeciallyusefull
toreducetheresolutionofalltexturesorsettheircompression.
如果我們想要降低頭髮材質的gloss值,我們可以設置一個
channelMask第2顏色(索引1,相對於第2材質,那裡保存著法線、
Specular、gloss貼圖)的”b“通道到較小的值。
overlayData裡的函數publicvoidSetColor(intoverlay,
Color32color)和
PublicvoidSetAdditive(intoverlay,Color32color)負責設置這
些值。可以用這做一些東西,比如hairOverlay。用SetColor(1,new
Color32(255,255,50,255);減少上例的gloss值。
當你想要一個overlay覆蓋基礎貼圖的一小部分區域,那麼Rect
非常有用。男女睫毛都只覆蓋頭部基礎貼圖的一小部分,並且如果它
有一張大部分區域被屏蔽的巨大貼圖的話將浪費大量的內存資源。
X值是裁剪overlay的水平偏移值,y值是垂直偏移值,並且
width/height是相對於裁剪overlay的大小。
我正在overlay庫設置一系列按鈕,實現一鍵修改所有overlay材
質的功能,這對於減少所有貼圖的分辨率或者壓縮非常有用。
croppedoverlaybeingcombinedtobasetexture
UMAshape
-UMADna
Beingabletoadjustavatarshapeinrealtime,evenifthe
possiblebecauseweusebonechangestodeformboththeavatar
bodymeshandit′ivethosebonechanges,we
needtoknowbothwhichbonesshouldbeadjustedandhowthis
shouldhappend.
UMADnaholdsthevaluesfromchangesanavatarcanreceive,
andweprovideanUMADnaHumanoidclassinheritingfrom
leandfemale
avatarsusesthisUMADnaHumanoidtodefinetheirshapevalues.
Ifyouconsiderthewingedhumanoidonthediagramimage,
itmightbepossibletohaveasingleUMADnaWingedbeingused
asswouldonlyneed
toprovidetheextravalueslike“size”,”spikesize”and“spike
length”.
UMA形體
-UMADna
可以實時修改avatar形體,即使avatar共享貼圖和mesh,這很
強大。這可行是因為我們使用骨骼改變來變形avatarbodymesh和衣
服。為了是骨骼改變,我們需要知道那個骨骼需要調整以及怎樣使他
發生。
UMADna掌控avatar獲得的骨骼改變值,並且我們提供一個
UMADnaHumanoid類繼承UMADna作為了解它如何工作的示例。
男女avatar都是用UMADnaHumanoid來定義形體值。
如果你想要在圖表上那個帶翅膀的人,可以讓男女的翅膀簡單使
用UMADnaWinged。這個類只需要提供額外的值類似”尺寸“,”
突刺大小“,”突刺長度“。
-DnaConverterBehaviour
TheDnaConverterBehaviourisresponsibleforconvertingthe
Dnavaluestobonechanges,Thisiswherethecodefordeforming
ideboth
anHumanFemaleDNAConverterBehaviourand
HumanMaleDNAConverterBehaviourinheritingfrom
DnaConverterBehaviourandasyoucansee,maleandfemale
avatarssharethesameshapevalues,butresultingbonechanges
arespecifictogender.
-DnaConverterBehaviour
DnaConverterBehaviour負責轉換Dna值到骨骼變化,這是使
骨骼變形的代碼所在地。我們提供
HumanFemaleDNAConverterBehaviour和
HumanMaleDNAConverterBehaviour繼承
DnaConverterBehaviour,男女avatar共享相同的形體值,但最終骨
骼變化結果分性別的。
CreatingUMAavatar
UMAGenerator
UMAGeneratorprovidesallnecessaryfunctionsandmethods
nganavatarisdonein3
steps:calculatingit′sfinalmeshandrig,processingit′stexture
atlasandupdatingit′sshape.
umaDirtyListkeepstrackofallUMAavatarsthatneedtobe
createdorupdated,indocumentationfollowingpagesitwillbe
clearhowandavatarisincludedonlist.
BothusePROandconvertRenderTexturevisibleas
avean
UnityPROlicenseandusePROenabled,it′spossibletocreatethe
atlasusingRenderTextures,
Freelicense,itrequiresprocessingeachpixelindividually,soit
′spossible
tosplitthiscalculationoverasmanyframes
asnecessarytoavoiddrasticallyloweringframerate,but
higherresolutiontextureswillrequireaconsiderableamountof
timetobeprocessed.
UMAGenerator
UMAGenerator提供所有必要的功能和方法來控制avatar的創建。
創建一個avatar由3個步奏組成:計算最終mesh和綁定、生成它的
貼圖atlas、更新形體。
umaDirtyList追蹤所有需要創建或自古英雄出少年下一句 者更新的UMAavatar,在文
檔後面章節詳細介紹avatar如何被包含在列表中的。
Unity編輯器裡的UsePRO和convertRenderTexture複選框非
常重要。如果你是UnityPRO版那麼請複選usePRO,它可以使用
RenderTexture創建atlas,所以貼圖計算很快。如果是免費版需要單
獨處理每個像素,所以他將花費大量時間和電力。可以把計算分散到
盡量多的幀裡來避免急遽降低幀率,但高分辨率貼圖將需要大量時間
處理。
convertRenderTextureisusefulincaseyou′reworkingwith
UnityPRO,butdon′twantthefinalatlasbeinga
ghtbethecaseif
you′mindthisprocess
′s
AlsoknownthatRenderTexturedatawon′tbekeptonWebplayer
afterwindowisresizedoronbuildswhenforexampleaccessing
taskmanager,inthosecasesatlaswouldhavetoberecalculated
orconvertedfromRenderTexturetoTexture2Dtoavoidthe
problem.
textureNameListprovidesasolutionifyou′replanningusing
extratexturesthatshouldbebakedonatlasesandappliedto
ywehave_MainTexand_BumpTex,
andifyoursamplematerialshaderrequirebothofthem,atlaswill
searchonoverlays′
youaddathirdtexturename,forexample_DetailTex,and
providesashaderrequestingthisdata,overlaysusingthisshader
areexpectedtoprovidetheextratextureoncorrespondingindex.
convertRenderTexture在你使用UnityPRO版是很有用,但別讓
最終atlas變成RenderTexture來代替Texture2D。這在你想要壓縮
atlas的時候可能會碰到。緊記,這個處理消耗很大并可能在用
2048x2048atlas的時候降低運行速度。你還要知道RenderTexture資
料,在窗口大小變化或者構建時,不能被保存到Webplayer,比如當
訪問任務管理器時,在這些情況下,必須計算并轉換RenderTexture
為Texture2D來避開這個問題。
如果你計劃使用額外的貼圖,而且它需要烘培到atlas應用到你的
採樣材質,這時textureNameList提供一個解決方案。通常我們有
_MainTex和_BumpTex屬性,並且如果你的採樣材質需要它們倆,
atlas會搜索overlay的textureList的索引0和1找他們。有時你添加
第3個貼圖名,比如_DetailTex,然後提供一個shader訪問這個資料,
overlay在相應的索引使用這個期待的shader提供這個額外的貼圖。
maxMeshUpdatesandmaxPixelsdefineshowmanymeshes
willbebakedandhowmanypixelscanbeprocessedonasingle
gmaxPixelsisonlynecessarywhennotusing
′retargetingmobileorolddevices,it′simportant
talso
beusefultoadaptthosevaluesdinamicallydependingonactual
performanceforthespecificdevicerunningtheproject.
atlasResolutionisveryimportant,itdefines
eedvery
detailedtextures,youmightwanttoincreasethisto4096,but
keepinmindthememoryusedforhighresolutiontexturesis
reallybig,′spossibletoadjust
overalloverlaysresolutiontofitsmalleratlases,thiswill
gatlasresolutiontosmall
valuesbutnotadjustingtexturesresolutionaccordinglywill
generateerrorsonproject,asnotalltextureswillfitatlas.
FitAtlasForcesfinalatlastofitAtlasresolutionincasethe
resultingatlassizewouldbelargerthanmaximumsize.
youneedtheresultingatlasbeingasquaretexture,thisis
notrecommended.
maxMeshUpdate和maxPixel定義了在一個更新步驟中有多少
mesh將被烘培,多少像素將被處理。設置maxPixel只有當不設置
usePRO時候可用。如果你的目標是移動設備或者老設備,那麼設置
這些值對性能非常重要。基於運行此程序的設備的實際性能動態修改
這些值也很有用。
atlasResolution也很重要,它定義atlas創建的最大分辨率。如
果需要非常高清的貼圖,那麼可能需要增加這個值到4096,但緊記,
高清圖極度吃內存,特別是未壓縮的。修改所有的overlay分辨率來適
應小atlas也非常重要,在後續章節會介紹。設置atlas分辨率為小值
但不修改貼圖分辨率將會引發錯誤,因為不是所有貼圖都能適應atlas。
在atlas尺寸大於最大尺寸的時候,設置FitAtlas強制最終atals
適應atlas分辨率。
AtlasCrop最終atlas未使用的貼圖空間將被裁剪。如果你想要
atlas保持正方形,這個選項最好別設置。
UMAGenerator
UMACrowd
UMACrowdisanexampleofhowUMAavatarscan
colorsandshapevaluesdon′thaveanyelaboratedcreation
gamesyouwillneedacolorpaletteandmore
controlovershapeandclothcombinations.
Firstofall,UMACrowdneedstokeeptrackofSlotLibrary,
OverlayLibrary,
considerUMACrowdasachefwithaccesstoallnecessary
Aavatar,
ormealifyouwish,iscreatedbasedonanspecificrecipethe
chefwritesbasedonavailableingredientsandhowtheyare
eratoristheavailabletoolthechefusesto
actuallycookthemeal,andbakeanUMAavatar.
UMACrowd是一個展示UMAavatar可以使用在庫裡的content
被隨機創建的程度。顏色和形體值都沒有複雜的創建方法。在大多數
遊戲你將需要調色盤和更多的控制器來控制形體和衣服組合。
第一,UMACrowd需要保持追蹤SlotLibrary,OverlayLibrary,
RaceLibrary和UMAGenerator。你可以把UMACrowd想象成主廚
存取所有必要的食材和工具來烹飪獨一無二的餐點。每個UMAavatar,
或者餐點如果你願意,基於特殊的由主廚的根據可用食材和它們的組
合方式寫就的食譜被創建。UMAGenerator是主廚用來實際烹飪餐點
的可用工具,并烘培一個UMAavatar。
atlasResolutionScaleThisvaluechangestheoveralltexture
sizeofalloverlaysanUMAavatarreceives,reducingfinalatlas
′replanningonhavingalotofUMAavatarswith
uniqueatlases,itmightbenecessaryconsideringalowervalue
ythevalueswesethereare1.0f,0.5f,0.25f,0.125fand
0.0625f,asthosearealsothevaluesforgettingthecorrect
ult,it′ssetto0.5f,withatlas
resolutionof2048.
generateUMA,visibleasacheckboxatUnityEditor,checking
itgeneratesonerandomUMAavatar.
generateLotsUMA,visibleasacheckboxatUnity
Editor,checkingitgeneratesagroupdofrandomUMAavatar,
basedonbelowVector2value.
umaCrowdSizedefinestheamountofUMAavatars
tvaluesare4x4,resultingin16
UMAavatars.
randomDNAvisibleasacheckboxatUnityEditor,checkingit
generatesrandomshapesforavatars,othersideallavatars
willhaveneutralshape.
useLegacyCombineOnUMAlatestversion,theold
CombineInstance()codeisstillavailableincasethere′sno
intentiononusingextrabonesthatwouldbedinamically
acycoderequireslessprocessingtime,
butprovideslimitedresults.
zeroPointDefinesthepositionwhereUMAavatars
′sempty,.
atlasResolutionScale這個值改變UMAavatar接收到的所有
overlay中的所有貼圖的尺寸,減少最終atlas尺寸。如果你計劃生產
許多個擁有不同altas的UMAavatar,有必要設置一個較小的值。
通常我們在這裡設置的值為1.0f,0.5f,0.25f,0.125f和0.0625f,因
為這些值可以在免費版獲得正確的mipmap采莲曲白居易翻译 。默認,設置為0.5f,也
就是altas分辨率為2048。
generateUMA,在編輯器顯示為複選框,複選他會創建一個隨機
的UMAavatar。
generateLotsUMA,在編輯器顯示為複選框,複選他創建一組隨
機UMAavatar,基於下面的Vector2值。
umaCrowdSize定義大量UMAavatar創建在行列里。默認是
4x4,也就是16個UMAavatar。
randomDNA在編輯器顯示為複選框,複選它會創建隨機體型的
avatar,另外所有avatar將是中性的。
useLegacyCombine在最新的UMA版本,老的
CombineInstance()函數在你不想要動態添加額外骨骼到avatar的情
況下仍然可用。老代碼執行時間更少,但有很多限制。
ZeroPoint定義UMAavatar創建的位置。如果它為空,那麼默認
值將是。
UMACrowd
UMACustomization
UMACustomizationexemplifychangingavatarshapeafter
it′ingthesameconcept,it′spossibletochange
UMAslotsandoverlays,triggeringthemtoupdatewiththenew
xamplescene,rightclickingonanyUMAavatar
updatesUMACustomizationsliderswithitsspecificshape,after
thatit′spossibletousesliderstochangeanyshapevalue.
UMACustomizationgeneratesaroughexampleofsliders
basedonGUITexturesasreferenceofhowtohandlechanging
UMAshapebasedonuserinput,butit′scleareachprojectwill
requireacustomapproachtohandlebothGUIanduserinput.
ExchangingUMAclothandacessoriesmeanschangingthe
arrayofslotsusedforcreatinganUMAavatarandincludingthat
avataronumaDirtyListatUMAGeneratortogetupdated.
UMACustomization
UMACustomization是展示avatar創建後再變形的示例。遵循相
同的概念,它尅改變UMAslot和overlay,觸發他們來更新新的
content。在示例場景,右擊任何帶特殊形體的UMAavatar更新
UMACunstomization滑塊,之後就可以使用滑塊概念形體值了。
UMACustomization只是一個粗糙的基於GUITexture的示例,
作為根據輸入控制改變UMA形體的參考,但其實每個工程都需要自定
義方法來控制GUI和其他輸入。
交換UMA衣服和配飾意味著改變創建UMAavatar用的slot數
組,包括在UMAGenerator裡的umaDirtyList的更新。
UMACustomization
UMAData
UMADataprovidesmanyfunctions,methodsandclasses
beingusedonavatarcreationasanstandardforsharing
information.
Eachavatarhasit′sownUMAData,that′swhymanually
duplicatingavatarsonUnityeditormightgenerateerrorswhen
tryingtoaccessanyavatardata,astheirUMADatahasnotbeen
properlyset.
It’simportanttoexplaintheconceptof“dirty”at
ShapeDirty,isMeshDirtyandisTextureDirtyare
responsibletokeeptrackofwhatneedstobeupdatedor
recalculatedonthisUMAavatar.
isusuallysetwhenanyDNAvaluereceivedchangesthatrequire
updatingUMAbones.
isMeshDirtyshouldbesettruewhenUMADatareceivedslot
alsoappliesifoverlayshavechangedasmostlikelyatlasesandin
consequencemeshuvwillrequiretoberecalculated.
UMAData
UMAData為avatar的創建提供了很多功能、方法和類,作為共
享信息的標準。
每個avatar都有它自己的UMAData,這是當你在編輯器手動複
製avatar,訪問任何宝剑锋从磨砺出 梅花香自苦寒来的意思 avatar資料時,可能產生錯誤的原因,因為它們
的UMAData沒有被正確設置。
介紹UMAData的dirty概念很重要。isShapeDirty,isMeshDirty
和isTextureDirty都否則追蹤這個UMAavatar的那個部分需要被更
新和重新計算。
isShapeDirty表示shape資料需要被重新計算。這通常在DNA
接收到改變而需要更新UMA骨骼是發送。
isMeshDirty需要被誰為true,當UMAData接收到slot改變而
avatarmesh需要重新烘培時。這也會發生在overlay改變因而mesh
uv需要被重計算。
UMAactualstage,theentireatlasesaregeneratedfromscratch,
butit′spossibletokeeptrackofchangesandimplementan
advancedsolutionforcingatlasrecalculationonspecificareas
only.
useLegacyCodeissetbyUMACrowdwhencreatingthe
avatar,butcanbesetdirectlyonUMAData.
animationControllercanbeanuniqueanimatorforeach
necessarybecausewhentheavatarshapechanges
andanewmecanimavatariscreated,theanimationcontroller
needtobesetback.
umaPackRecipewascreatedconsideringthatall
necessarydatatorecreateanUMAavatarmightneedtobesaved
aPackRecipeprovidesis
theminimumnecessarydataforserialization,usuallyanarray
withthenamesofslots,overlaysandDNAs,andtheextra
sdatacanthen
rocess,respective
librariesprovideselementsbasedonserializednamesandextra
changesareappliedtothose.
isTextureDirty表示atlas需要重計算。事實上UMA本身,整個
atlas是從一開始就創建的額,但可以追蹤改變,并實現高級解決方案
強制atlas只對特定區域重計算。
useLegacyCode在avatar創建的時候由UMACrowd設置,但
可以在UMAData直接設置。
AnimationController可以是每個avatar都有唯一的animator。
這是可行的,因為當avatar形體改變,一個新的mecanimavatar創
建是,animationController需要被設置。
umaPackRecipe是考慮到可能需要把UMAavatar保存起來或者
共享給其他遊戲使用。umaPackRecipe提供的是最小化序列化所必須
的資料,通常是slot名、overlay、DNA數組,並且額外的改變需要
應用到它們。所有這些資料可以被解包到umaRecipe。這個過程,各
個庫提供基於序列化名的原始并把額外的改變應用到它們。
更多推荐
meshes是什麼意思hes在線翻譯讀音例句
发布评论