unity 插件 UMA 2 Unity Multipurpose Avatar 手册翻译

来源:互联网 发布:特征选择算法 男女鞋码 编辑:程序博客网 时间:2024/05/16 05:38

 UMA  - UnityMultipurpose Avatar

(UMA2的手冊跟1是一樣的)


 Avatarsgenerated by UMA framework

 

What is UMA?

UMA - UnityMultipurpose Avatar, is an open avatar creation framework, it provides bothbase code and example content to create avatars. Using the UMA pack, it´spossible to customize the code and content for your own projects, and share orsell your creations through Unity Asset Store.

什麼是UMA?

UMA– Unity Multipurpose Avatar是一個開源的Avatar創建工具,它提供關於創建Avatar的基礎代碼和示例。使用UMA工具包,可以為你的工程定制代碼和內容,并可以通過Unity Asset Store 分享或賣你的作品。


 Close on detailed avatar

UMA works both onUnity PRO and free licences, but benefits from PRO features foraccelerating UMA creation steps.

This project hasbeen updated for Unity 4.3, as it will require access to the Mecanim avatar APIon following releases.

UMA can beintegrated and used on mobile, standalone and web player builds and includedshaders require Shader Model 2 or superior. It has not been tested on consolebuilds. If you re targeting old devices, it ´s recommended to reduce textureresolution and take other optimizations measures to avoid memory issues.

UMA is designed tosupport multiplayer games, so it provides code to pack all necessary UMA datato share the same avatar between clients and server. It may be necessary toimplement a custom solution depending on your needs to optimize and reduceserialized data.

UMAUnity PRO版和免費版都可以工作,但PRO版的特性可以加速UMA的製作速度。

這些工程已經升級到Unity 4.3,因為基於以下幾點,它將需要訪問MecanimAvatar API

UMA可以被整合并在移動設備使用,單機和Web player和包括需要Shader Model 2的項目或者高級項目。它沒有在控制台項目測試。如果你面對老設備,推薦降低貼圖分辨率并做其他優化避免內存問題。

UMA被設計用來支持多角色遊戲,所以它提供代碼將所有必要的UMA資料打包在服務器和客戶端分享相同的Avatar。如果有必要的話它可以執行定制的服務,來優化額減少序列化資料。

Performance andmemory usage

UMA frameworkprovides a set of high resolution content, flexible enough for generating acrowd with tons of random avatars or high quality customized avatars forcutscenes. Source textures are provided for generating final atlas resolutionof up to 4096x4096. Depending on the amount of extra content being imported tothe project, it might be necessary to handle memory management or reducetexture resolution.

Every UMA avatarcreated has it ´s own unique mesh and Atlas texture, requiring extra memory.The standard atlas resolution of 2048x2048 is recommended for creating a smallnumber of avatars, for games creating on a huge amount of avatars, using loweratlas resolution or sharing mesh and atlas data will be necessary. UMA wasinitially planned to provide 50 avatars on screen, but the latest version caneasily handle a hundred of unique avatars.

效率和內存使用

UMA 框架提供一系列高分辨率內容,足夠為過場動畫創建一大群帶有不同Avatar或高質量定制Avatar的人。源貼圖提供地圖質量的分辨率達到4096x4096。基於被添加到場景的額外內容的數量,可能有必要進行內存管理或者降低貼圖分辨率。

每個創建的UMAAvatar有他自己的唯一的mesh和貼圖,需要額外的內存。標準的貼圖分辨率是2048x2048,但推薦使用較少的Avatar數量,若果遊戲創建了大量的Avatar,那麼使用較低分辨率的貼圖、共享mesh和貼圖是有必要的。UMA最初計劃在屏幕最多同屏50Avatar,但最近版本可以輕易上百個獨特的Avatar


100 Avatars in real time

Free and PROlicense differences for UMA

UMA results on PROand Free licenses are meant to be as similar as possible, however calculating aUMA atlas can be handled differently. For PRO it ´s possible to create theatlas using RenderTextures, so texture calculation is very fast. For Freelicense, it requires processing each pixel individually, so it takesconsiderably more time and processing power. It ´s possible to split thiscalculation over as many frames as necessary to avoid drastically loweringframe rate, but higher resolution textures will require a considerable amountof time to be processed. The gameObject UMAGenerator provides an option forusing PRO or Free, I´ve left this as a way PRO users testing performance ofcontent on indie projects, for example. The Free license users need to unchecktheusePROcheckbox on UMAGenerator.

免費版和PROUnity的區別

UMA在免費版和PRO版的運作結果是完全一致的,然而UMA Avatar的計算方式有些不同。PRO版可以使用RenderTexture創建貼圖,所以貼圖計算是很快的。但免費版需要單獨處理每個像素點,所以它會花費多很多的時間并耗電。可以吧計算分散到多個幀來避免急遽降低幀率,但更高分辨率的貼圖還是需要花費相當多的時間。UMAGenerator提供一個使用PRO版或免費版的選項,我留下這個是為了PRO用戶可以測試獨立開發項目的內容。免費版用戶請不要複選usePRO複選框。

How does UMAwork?

Creating 3dcharacters is a time consuming process that requires a number of different knowledgeareas. Usually, each character is created based on an unique mesh and rig andis individually skinned and textured.

When developinggames that might require a huge amount of avatars, it ´s expected to develop asolution to handle avatar creation in an efficient way. Usually they start froma set of base meshes and follow standards to be able to share body parts andcontent. Each project ends up with a different solution, and it ´s hard toshare content or code between them.

UMA如何工作?

創建3D角色是一個花費大量時間的過程,需要了解很多不同的領域的知識。通常,每個角色基於唯一的meshrig、蒙皮和貼圖。

開發遊戲時可能需要大量的Avatar,這需要開發一個更高效的創建Avatar的解決方案。通常開始於一系列基礎mesh并按標準製作以共享身體的構件和其他內容。每個工程都結束都會有不同的解決方案,並且很難共享內容和代碼。

UMA is meant toprovide an open and flexible solution, which makes it possible to share contentand code between different projects, resulting in a powerful tool for theentire community.

UMA has two maingoals: Sharing content across avatars that uses same base mesh and optimizingcreated avatars, while providing the ability to change avatar shape inrealtime.

To achieve that,I´ve created a special rig structure that handles bone deformation in astrategic way that makes it possible to deform UMA shape based on changes onbones position, scale and rotation.

UMA example avatarsare based on two base meshes, a male and a female. Each of them can shareclothing and accessories, and can be used as a base on the creation of newmeshes for different races.

Because clothes andaccessories are skinned to UMA base mehes, they receive the same influece ofUMA body shape, so any mesh deforms to any UMA body.

UMA想要提供一個開放的靈活的解決方案,使不同工程間共享代碼和內容成為可能,為整個社區提供一個強大的工具。

UMA有兩個主要目標:使用相同基礎meshAvatar間共享內容,優化創建的Avatar,同時提供實時改變Avatar形狀的能力。

為了做到這些,我創建了特殊的rig結構,可以全局的控制骨骼變形,這使得通過骨骼位移、縮放、旋轉改變UMA形狀成為可能。

UMA的示例Avatar基於兩個基礎mesh,男女各一個。每個可以共享衣服和配飾,並且可以作為製作其他人種新mesh的基礎。

因為衣服和配飾被蒙皮到UMA基礎模型,他們都會受到UMA body形狀的影響,所以任何mesh可以變形到任何UMA body


UMA avatars generated based on same content anddifferent shapes

This way, if you have an armor or dress, it can beshared between all male or female avatars, even if they have very differentbody shapes.

many differenttextures when generating the final atlas. Those extra textures can be used tocreate even more variation to each avatar, and can be used for clothes, detailsand many other possibilities.

UMA optimizationoccurs in many steps: Each UMA avatar can have an unique texture atlasproviding all necessary texture data, this makes it possible to have each UMAgenerating a single drawcall, in the case of a single material being used.

All UMA parts arebaked together into one final mesh, which reduces the calculations involved inprocessing. Joen Joensen from Unity team implemented an advanced skinned meshcombiner to accomplish this.

On UMA latestversion, the old CombineInstance() code is still available in casethere´s no intention on using extra bones that would be dinamically included onavatar. The legacy code requires less processing time, but provides limitedresults.

如果你有盔甲或者裙子,它可以在男人女人Avatar間共享,即使他們有很不同的身體形狀。

很多不同的貼圖用來創建最終的atlas。這些額外的貼圖甚至可以被用來創建更多變化到每個Avatar上,並且可以被使用到衣服,細節和很多其他的可能的地方。

UMA優化分很多步奏:每個UMAAvatar可以有獨立的貼圖Atlas提供所有必要的貼圖資料,這可以在使用單個材質的情況下,讓每個UMA只產生一個drawcall

所有UMA組成部分都會被烘培整合到一個最終mesh,這可以降低運行中的相關計算。Unity teamJoen Joensen使用一個高端skinned mesh合成器實現這個功能。

UMA最新版本,老的CombineInstance()代碼在不使用額外骨骼動態包含在Avatar內的情況下仍然可用。老的代碼需要更少的執行時間,但會有很多限制。

 

How content is created?

如何創建內容?


Set of High poly meshes based on UMA final clothes

Creating content forUMA doesn´t require much extra knowledge beyond the usual asset creationpipeline. There are three main type of content: Base meshes, Slots andOverlays.

UMA創建內容不需要很多超越通常asset創建流水線的額外知識。有三個主要的內容類型:基礎mesh,插槽和覆蓋。

Base Meshes

UMA provides twostarting base meshes, a male and a female. It ´s possible to create completelydifferent and unique base meshes and still take advantage of UMA. As allcontent uses base meshes as reference, if you create a minotaur base mesh andare able to keep the same data from the original male torso base mesh, allclothes based on that male torso can be shared with the new Minotaur mesh.

For a completelydifferent race, such as horses, you will need unique content. This could thenbe shared with other similar races, like unicorns and even dragons. Male andfemale Base meshes were created considering the average volume those bodieswould be able to reach using the adjustments in the UMA rig.

基礎Mesh

UMA提供兩個入門基礎模型,一男一女。可以利用UMA創建完全不同并獨立的基礎模型。由於所有內容使用基礎mesh作為參考,如果你創建了一個牛頭人基礎模型,并保持資料與原始男性軀幹基礎mesh相同,那麼所有的基於那個男性軀幹的衣服可以共享給這個新的牛頭人mesh

一個完全不同的物種,比如馬,你將需要單獨的內容。這肯今後可以共享到其他類似的物種,像獨角獸甚至是龍。男人和女人基礎Mesh是基於平均尺寸創建的,這些身體可以使用UMA rig的調節器做到。


Uma Female and Male base meshes

Slots

All UMA content thatprovides a mesh is a slot. Slots are basically containers holding all necessarydata to be combined with the rest of an UMA avatar.

For example the basemeshes provided are normally split into several pieces, such as head, torso andlegs... and then implemented as slots which can be combined in many differentways.

An UMA avatar is infact, the combination of many different slots, some of them carrying bodyparts, others providing clothing or accessories. Lots of UMA variation can becreated simply by combining different slots for each avatar.

Slots also have amaterial sample, which is usually then combined with all other slots that sharesame material. Female eyelashes for example, have a unique transparent materialthat can be shared with transparent hair. It´s necessary to set a materialsample for all slots, as those are used to consider how meshes will becombined. In many cases, the same material sample can be used for all slots.

Slots

所有提供meshUMA內容都是slotSlot是持有所有需要組合到UMA avatar的必要資料基礎容器。

比如:基礎mesh通常被分成幾塊,如頭,軀幹,腿。。。然後以slot執行,并被以多種方法組合。

UMA avatar事實上就是很多個不同slot的組合,一些帶著身體部分,其他提供衣服或者飾物。很多UMA變體可以簡單通過為每個Avatar組合不同的slot來創建。

Slot還有一個材質採樣,它通常與其他共享相同材質的slot組合。女人睫毛舉例:有一個獨立的透明材質可以被與透明頭髮材質共享。必要的時候可以為所有slot設置一個材質採用,因為這些被用來告知mesh將被怎樣組合。在很多情況,相同的材質採用可以被使用到所有slot

UMA standard avatarmaterial uses a similar version of Unity´s Bumped Specular Shader, but UMAproject provides many other options.

The big differencebetween body parts and other content is that body parts need to be combined ina way that the seams wouldn´t be visible. To handle this, it´s important thatthe vertices along mesh seams share the same position and normal values toavoid lightning artifacts.

To handle that, weprovide a tool for importing meshes that recalculate the normal and tangentdata based on a reference mesh. UMA MaterialBuilder will be explained infollowing pages.

UMA標準Avatar材質使用類似UnityBumped Specular Shader的材質,但UMA工程提供很多其他選項。

身體部分和其他內容最大的不同是,身體部分需要以縫隙可見的方式被組合。為了做到這,沿著縫隙共享相同的位置和法線的頂點值避免閃電失真很重要。

為了控制這,我們提供導入mesh工具,基於相關mesh重新計算法線和切線資料。UMA MaterialBuilder將會在後續章節介紹。


Example of Male slots.

Overlays

Each slot requiresat least one overlay set but usually receives a list of them. Overlays carriesall the necessary textures to generate the final material(s) and might haveextra information on how they are mapped. The first overlay in the listprovides the base textures, and all other overlays included are combined withthe first one, in sequence, generating the final atlas.

UMA standard shaderrequires two textures provided by overlays, one texture for Diffuse color (RGB)+ overlay mask (A) and one texture for Normal map(GA), Specular (R) and Gloss(B). These non-standard textures let us compress a lot of information in onlytwo textures, reducing final memory usage.

Overlays

每個slot需要至少一個overlay但通常會有一個overlay列表。Overlay帶有所有必須的用來創建最終材質的貼圖并可以有額外的映射信息。列表中的第一個overlay為基礎貼圖,其它的都被組合到第一個上,按隊列順序,創建最終atlas

UMA標準shader需要overlay提供兩張材質,一張Diffuse(RGB)+overlay遮罩(A),另一張Normal貼圖(GA)Specular(R)Gloss(B)這些非標準貼圖讓我們壓縮大量信息在2張材質裡,減少最終內存消耗。


Example of overlay composition

Together, Joen Joensenand I have worked on “UMA material builder ”, a tool that receives 3 standardtextures for Diffuse(RGB) + mask(A), Normal map(RGB) and specular(RGB) +gloss(A), and compacts the data into the two textures described above. In theprocess, the specular color is reduced to one channel of data, the resulting averagecolor of the 3 channels provided.

Following PedroToledo’s post “Brief Considerations About Materials” http://www.manufato.com/?p=902,Joen and I worked together to reach two shader that handle specular color basedon diffuse color reference resulting in Dielectric and conductor materials.

I´ve already managedto integrate some of the most common Unity shaders into UMA and the adjustsrequired are quite simple. Even more advanced shaders can be integrated andused, keep in mind it´s possible to provide extra textures on each

overlay, this way,it´s possible to include displacement maps, Sub surface scattering masks or anynecessary data.

我和Joen Joensen一起設計“UMA material builder”,接受3個標準貼圖,Diffuse(RGB)+mask(A), Normalmap(RGB) Specular(RGB)+gloss(A),并壓縮到上文所述的2張貼圖中。在這個過程中,Specular顏色被精簡到單通道資料,只提供3個通道的平均值。

基於 Pedro Toledo的文章”Brief Considerations About Materials“  http://www.manufato.com/?p=902Joen和我一起製作了這兩個基於Diffuse顏色影響來控制Specular顏色的shader,形成了絕緣體和導體材質。

我已經設法整合一些常用的Unity shaderUMA并調校也非常簡單。甚至更多的高級shader也可以被整合和使用,緊記為每個overlay提供額外貼圖的重要性,用這個方法,可以包含置換貼圖,SSS材質或者任何可能的資料。

 

Asset creation pipeline

UMA project providesan UMA content creator pack, it´s a zipped folder with all necessary basemeshes and textures for creating your own content. It provides:

- base diffuse,specular and normal map textures

- UV layoutreference images

- Male and femalebase meshes in .OBJ

- Rigged and Skinnedbase meshes in .FBX file format

- .ZTL files forZbrush users

- An open .Blendfile for blender users

I´ve spent a longtime recording and producing video tutorials (http://www.youtube.com/user/fernandoribeirogames) to cover all the basic process of contentcreation, but the knowledge for actually working on any 3d software isprerequisite.

The overallknowledge for generating UMA content is 3d modeling, rigging, skinning andtexturing. It´s also possible to work on existing content already available.For example, if you have an tshirt slot, with the right texture work it´spossible to provide an chain mail overlay without extra knowledge of modeling,rigging or skinning.

Asset製作流程

UMA工程提供一個UMA內容製作工具包,壓縮文件夾包括所有必須的基礎mesh、材質,用來創建你自己的內容。提供:

-基礎Diffuse, Specularnormal map材質

-UV佈置參考圖片

-.OBJ格式男女基礎模型

- .FBX格式綁定并蒙皮的基礎模型

- Zbrush用戶提供.ZTL格式資料

- blender用戶提供.Blend格式資料

我用了大量時間錄製和提供視頻教程

(http://www.youtube.com/user/fernandoribeirogames)裡包含所有創建內容的基本步驟,但前提是具備實際的3D軟件的工作經驗和知識。

大致上創建UMA內容需要的知識包括:3D建模,綁定,蒙皮和貼圖。同樣也可以用現有的內容工作。比如:如果你有一個帶正確貼圖的Tslot,那就可以提供一件鎖子甲而不需要額外的建模、綁定、蒙皮知識。

Texturing and UVmapping

Both UMA male andfemale base textures have a specific resolution. Below is the list of thosebase texture sizes in pixels:

- Head : 2048x1024

- Body : 2048x2048

- InnerMouth :512x512

- Eyes : 512x512

材質和UV映射

UMA裡不管男人女人都有一個特定的基礎貼圖分辨率。以下是這些基礎貼圖像素大小:

-         頭:2048x1024

-         身體:2048x2048

-         口腔:512x512

-         眼睛:512x512


Male body UV layout

Those values arespecific to the provided base meshes as a standard for anyone creating contentfor them. If you plan following a different standard, it´s possible to use anydifferent resolution.

When creating new contentfor UMA, if you´re aware it will be covering an area of UMA body texture, it´spossible to use that UV area for the new content texture, if it offers enoughspace. This example can be seen on Female tshirt and hair, both of them saveatlas space, having those textures as overlays for body base texture instead ofbeing base textures themselves.

Also, any overlaytexture and it´s covered base textures don´t need to keep the same size. Forexample, FemaleUnderwear01 overlay covers only the left half of the base, soit´s possible to have that overlay with half the width of body base texture.

The Rect providedtogether with the overlay elements is responsible for keepinginformation of the positioning adjust of the cropped overlay, relative to basetexture coordinates.

It´s possible toprovide overlays that will receive color adjusts at atlas creation. In thosecases, usually the predominant color is white or gray in those areas, to have aneutral influence over final color.

這些值定義在提供的基礎mesh上作為任何人為他們創建內容的一個標準。如果你計劃遵循其它標準,可以使用任何其它分辨率。

當為UMA創建新內容,如果你意識到它將覆蓋UMA body貼圖,你可以使用這一UV區域建立新的內容貼圖,如果有足夠空間的話。可以在女T恤和頭髮看到實例,它們都節約atlas空間,將這些貼圖做成body基礎貼圖的overlay而不用修改基礎貼圖本身。

同時,任何overlay貼圖和它覆蓋的基礎模型不需要保持一樣的尺寸。比如:FemaleUnderwear01overlay只覆蓋左半邊的基礎貼圖,所以它可以使overlay只有body基礎貼圖一般寬度。

overlay元素一起提供的Rect負責保持overlay裁剪後的相對於基礎貼圖坐標的位置調整信息。

可以在atlas作品中提供接收顏色調整信息的overlay。在這種情況下,通常在這些區域的主要的顏色是白色或灰色,對最終色彩做中性影響。

  

Above imageillustrates the use of a cropped overlay in junction with Eye base texture togenerate iris color variation

上圖舉例說明裁剪的overlay與眼睛基礎貼圖合併來創建虹膜顏色變體。

In other hand, UMA1.0.1.0R don´t support combining textures with different original size: Evencropping an overlay removing the unused masked area, the original overlay sizeshould be the same of the base texture. So if you provide a cropped overlay foreyebrows, it requires a Rect data relative to the 2048x1024 head referencetexture. Providing a non cropped overlay with smaller or bigger resolution thanthe base overlay might generate error messages.

另一方面,UMA1.0.1.0版本不支持貼圖以不同原始尺寸組合:即使裁剪overlay來刪除不適用的屏蔽區域,overlay的原始尺寸也必須與基礎材質一致。所以如果你為睫毛提供裁剪overlay,他Rect必須參照頭部貼圖的尺寸2048x1024。提供尺寸大於或小於基礎overlay的未裁剪的overlay都會產生錯誤信息。

3d modeling

It´s possible tointegrate any 3d mesh into an UMA avatar, it´s important to follow the sameoptimization guidelines usually used for traditional characters and clothes, astopology and vertex count. I´ve included meshes with both uniform and nonuniform polygon placement, it´s important to keep in mind when each case can beused. The same way, I´ve worked both on meshes mostly quad based, and meshesentirely based on tris before exporting process. All content can be integrateddespite those differences, but stretched polygons might cause poor lightningresults, especially visible when not using normal maps.

3D建模

可以整合任何3d meshUMAavatar裡,遵循與傳統的角色優化相同的流程是很重要的,因為拓撲和頂點數量。我已經包含了一致或不一致的多邊形佈局,記住什麼情況用哪個非常重要。相同的方式,我同時工作在導出之前基於四邊形和基於三角面的mesh上。所有內容可以被整合而不用理會這些不同,但拉伸多邊形可能導致不良的閃電邊緣問題,不使用法線貼圖的時候特別明顯。


Female and Male jeans completely different topology

Rigging andskinning

This is where allthe UMA magic happens. All shape variations we can achieve on UMA avatars are aconsequence of changing bone scales, positions and rotations. A mesh correctlyfollowing those changes depends on rigging and skinning entirely and anincorrect skinning process might lead to issues such as a clothing pieces notfollowing the same shape variation as the body.

I´ve provided basemeshes with rig and skin data because most 3d software has specific tools thatallow users to transfer bone weight data between different meshes avoiding mostof the time consuming process involved. I´ve shown this being done in Blenderat some video tutorials (http://www.youtube.com/watch?v=ImD6APS0xek), but the same can be done with XSI Gatoror other specific solutions.

For dresses orarmor, simply projecting those values might not be enough, and skinningknowledge may be necessary for best results following body variations. What isimportant to keep in mind if you’re creating your own rig is to keep a pair ofparent and children bones anywhere you need that specific area to receive non-uniformchanges. This is the case on most of the UMA rig, for example the arms. You’reable to change the arm scale both in uniform and non-uniform ways, but havingan non-uniform scale deforms all child bones too, so those changes need to beapplied to the child bones working in pair. It´s also important to keep in mindit ´s always these child bones that carry the skinning data, as it will alwayschange directly, and under the influence of the parent bone.

綁定和蒙皮

這是UMA魔法發生的地方。所有我們能在UMAavatar獲得的變形,都是骨骼縮放,位移,旋轉的結果。Mesh正確跟隨這些變形基於綁定和蒙皮,錯誤的蒙皮過程可能導致產生問題,妳如衣服面片不跟隨身體的形狀變化。

我提供綁定和蒙皮好的基礎mesh,是因為大多數3D軟件有不同的工具讓用戶在不同的mesh變換骨骼權重資料,而為了節省用戶在軟件上花費時間。我提供了使用Blender製作角色的視頻教程(http://www.youtube.com/watch?v=ImD6APS0xek),而這同樣可以再XSI Gator或者其他特殊工具完成。

裙子和盔甲,簡單映射這些值可能不夠,所以為了使跟隨身體變形獲得最好的結果,蒙皮的知識可能是必須的。創建自己的綁定最重要的是保持一對父子骨骼無論那個你要接收不均勻改變的特殊區域。大部分UMA綁定,比如手臂。你可以均勻或者非均勻縮放手臂,但子物體也需要非均勻縮放,所以這些改變需要應用到成對的子骨骼。緊記,這些子骨骼帶有蒙皮資料,所以在父骨骼的影響下,它將總是直接被改變。


Male jeans skinningand male base mesh skinning. Skinning Data has been projected with BlenderTransfer weights tool

男牛仔褲蒙皮和男基礎模型蒙皮。蒙皮資料用Blender權重轉換工具進行映射。

 

3D software

Blender is UMAstandard content creation software, because it´s open source and accessible forall developers. Being thestandard means I´ll provide most ofthe 3d tutorials on this specific application but keep in mind most of theavailable softwares have a set of tools to handle what I´m doing in blender.

Initially, I plannedincluding here the standard import and export setting for each 3d software Imanage testing the integration with UMA, but as you´re going to notice,importing setting mostly depends where those files where generated, so it´shard having an standard. For export setting, I´ll explain the specific settingfor exporting content for UMA base mesh.

3D軟件

BlenderUMA創建內容的標準軟件,因為它開源所有的開發者都能使用。按標準方式,我將提供所有特定平台的3D教程,但要知道大部分可用的軟件都有一套像Blender一樣的工具需要操控。

最初,我計劃包括每個3D軟件的標準導入導出設置,通常都包括文件在哪、創建在哪,所以這很難有一個標準。關於導出設置,我將描述導出內容到UMA基礎mesh的特殊設置。


Blender

Importing files:Blender has a huge limitation: it can´t import fbx files (Update: On Blenderlatest version, fbx import is already being integrated), so it will beharder sharing skinned and rigged models from other 3d application to Blender.Importing obj files is a straightforward process, and blender provides settingsfor definning forward axis and up axis, covering different coordinate systems.It´s usually a good idea checking “Keep Vert Order”, if you need to keepthe index of mesh vertices, this is specially important working with zbrush andother sculpting tools.

Exporting files:Exporting fbx files of rigged and skinned content to unity requires having “forwardaxis” as “Z forward”and “Up Axis”as “Y Up”.

It´s very importantwhen exporting content being sure both it´s position, rotation and scale arenormalized, this means you need to bake all those into vertices position. This canbe made with “Ctrl+A”or “Object/Apply” .

You usually don´tneed including animations when exporting clothes and acessories, but it´sreally important that the rig is exported along with the mesh for your content.Including the rig might raise the disk space required by that file, so it´susually a good idea to keep a bundle of meshes on the same fbx file wheneverpossible.

Blender

導入文件:Blender有一個巨大的限制:它不能導入fbx文件(在Blender最新版本,fbx導入已經整合進來了),所以共享蒙皮和綁定的模型將比其他軟件困難很多。導入obj文件過程很簡單,並且Blender提供設置來定義坐標朝向和朝上坐標,用來處理不同的坐標系統。通常選擇”KeepVert Order”選項是個好主意,如果你需要保持mesh頂點索引的順序,在Zbrush或者其他雕刻工具里面這特別重要。

導出文件:導出包括綁定和蒙皮的fbx文件unity需要設置”forward axis“”Z forward””Up Axis””Y Up”

導出前確認位置、旋轉、縮放都規格化很重要,這意味著你要烘培所有這些到頂點位置。這可以用”Ctrl+A“或者”Object/Apply”實現。

導出衣服和飾物的時候,你通常不需要包含動畫,但確保綁定信息被和mesh一起導出這很重要。包括綁定信息,可能會增加磁盤空間佔用,所以通常如果可能的話把大量mesh放置在一個fbx中是很明智的。


3ds max

Importing files:I´ll focus on importing files from the “Content creator pack”, as thosewere exported from blender, there´s a small change required when importing basemesh fbx files to 3ds max, you need to set “units” to “Centimeters”to have the correct size.

As you can see onthe following image, the fbx file (upper mesh) has the correct rotation and isfully rigged and skinned. The Obj (lower mesh) file requires manual rotationadjusts after importing process.

3ds max providesmodifier “skin wrap” as a solution for copying skinning data between UMAbase mesh and your own content.

Exporting files: Thesame warning I´ve provided for blender users apply here too: It´s veryimportant when exporting content being sure both it´s position, rotation andscale are normalized. It´s possible to adjust mesh pivot using “Affect PivotOnly” button. There’s a specific adjusts required when creating your owncontent, the Z rotation value of the mesh should be set to 180 degrees, this isusually done enteringAffect Pivot Onlymode and rotating the pivotitself.

When exporting thefbx files, you need to have both your content mesh and rig selected. It´susually a good idea not including the cameras and lights on the fbx files. For exporting,units can be kept on “automatic” and “Up Axis” need to be set to“Z up”.

3ds max

導入文件:我將專注於從“Content creator pack”導入文件,因為這些從Blender導出的,如果要導入到3dsmax裡需要做個小改變,你需要設置“units””Centimeters”獲得正確尺寸。

在下面的圖片你可以看到,fbx文件(在上的mesh)旋轉正確並且是完全綁定和蒙皮的。Obj文件(在下的mesh)導入後需要手動旋轉。

3dsmax提供”skin wrap“修改器作為在UMA基礎mesh和你自己的內容間複製蒙皮資料的解決方案。

導出文件:對於Blender用戶有相同的警告:非常重要,導出內容時確保所有的位置、縮放、旋轉都已經規格化。可以使用”Affect Pivot Only“按鈕修改mesh pivot

導出自己的內容,有些特殊的地方要調整,mesh Z軸旋轉需要設置為180度,這通常可以進入Affect Pivot Only 模式然後旋轉pivot

當導出fbx文件,你需要需要選擇你的內容mesh和綁定。

通常fbx文件包含攝像機和燈光是很明智的。單位可以保持”automatic“,但”Up Axis“要設置為”Z up”

 

Mecanim

Animation

UMA is integratedwith an humanoid mecanim avatar, opening a huge list of animations that can beretargeted to any UMA avatar. Both Male and Female UMA prefabs had their mecanimavatar settings adjusted. UMA rig provides enough bones do handle facialanimation, the same techniques required for facial animation on any mecanimavatars apply to UMA.

Slots that provideextra bones not linked to humanoid mecanim avatar require extra adjusts toproperly receive animation, as animation data won´t be retargeted to thosebones.

Animation

UMA已經與humanoid mecanimavator整合到一起,大量打開的的animation可以重定向到任何UMA avatar。男女UMA prefabs有自己調整好的mecanim avatar設置。UMA綁定提供足夠的骨骼控制面部動畫,與任何mecanim avatar一樣的面部動畫控制技術可以應用到UMA。


Example of bonedriven facial animation

Mecanim avatarcreation API

Unity 4.2 providesan Mecanim avatar creation API, this is necessary to recreate mecanim avatarsbased on changes UMA rig might have received. Before unity 4.2, this was notpossible and I had to use LateUpdate to keep bone changes, consuming extraprocessing time and possibly breaking Mecanim IK depending on the kind ofchanges bones received. UMA latest version already integrates Mecanim avatarcreation and provides full suport to IK and Root motion thanks to Joen Joensenand Mecanim team help.

Mecanim avatar創建API

Unity4.2提供一個Mecanim avatar創建API,重建mecanim avatarUMA接受到改變綁定的指令時是必須的。Unity 4.2之前這是不可能的,我只好使用LateUpdate來改變骨骼,消耗額外處理時間並且可能會基於不同的骨骼改變方式破壞Mecanim IKUMA最新版本已經整合了Mecanim avatar構造器,并完全支持IKRoot motion。感謝Joen JoensenMecanim團隊的幫助。

 

UMA Components

Overview

Joen provided adiagram for the beta group showing the relationship between the various partsof the UMA framework. I´ve included a new version here to help explaining howavatars are created.

概述

Joen提供給beta測試組的圖解,展示UMA架構的各個部分的關係。我製作了新版本,幫助描述avatar是如何創建的。

 

 

Libraries

All avatars createdneed to have access to a set of necessary data: Races, Slots and Overlays. Eachlibrary provides a list of each of those within an dictionary, being the key anstring with the name of the element, and the value the element data itself.

For projects withbig amount of content as mmo games, you probably don't want everything loadedin memory and loading/unloading assets might become necessary, this caserequires implementing custom libraries.

所有創建的avatar需要訪問一系列必須的資料:物種,SlotOverlay。每個庫提供通過dictionary提供物件列表,元素名字符串作為key,並且值就是資料本身。

如果工程有大量內容,比如mmo遊戲,你可能不希望所有都加載到內存,因此加載/卸載asset很必要,這種情況需要實現自定義庫。

- race library

Each RaceData onthe race library provides a prefab with all shared scripts, avatar data andetc, one or more DNAConvertes and a list of the name of bones that requirebeing updated.

As you´ve noticed,I´ve separated male and female as two different race datas. This is becauseeach race provides an specific base mesh and rig/skinning data, and usuallyrequire specific content. Using unique base meshes for male and female gave methe possibility of reaching a better silhouette and topology for each of them.

DNAConverters areresponsible translating values like “height”and “armSize” to bone deformationand shape changes. It´s possible to have two different races with the samevalues to “height” and “armSize”, but each of them converting those values indifferent ways.

-物種庫

在物種庫,每個物種資料提供一個prefab包含所有共享的腳本,avatar資料等等,一個或多個DNAConverter和骨骼名列表需要更新。

你可能注意到,我吧男女分為兩個不同的物種資料。這是因為每個物種提供一個特殊的基礎mesh和綁定、蒙皮資料,而通常需要特殊的內容。給男女使唯一的基礎資料給我為他們兩個都做到更好體型和拓撲結構的可能。

DNAConverter負責轉換類似高度手臂尺寸的值到骨骼變形和形體改變。尅有連個不同的物種帶有相同的高度手臂尺寸值,但每個都會轉換到不同的地方。

- Slot library

Each slot provides askinnedMeshRenderer and a material sample, as explained earlier. If you´replanning on inluding extra bones on any Slot, it will be necessary to usejoen’s “UMA material builder ” for generating theslotData, as it isresponsible for identifying if there´s any extra bone and listing all theirtransforms.

The first overlay inthe slotData´s overlayList provides the base textures, and allother overlays included are combined with the first one, in sequence,generating the final atlas.

-Slot

每個slot提供一個SkinnedMeshRenderer和一個材質採樣,如前所述。如果你計劃在任何Slot包含額外的骨骼,必須使用Joen”UMA材質生成器來創建slot資料,因為它負責定義是否有額外骨骼并列表所有Transform

slotData的第一個overlay為基礎材質,其它包含的overlay被組合到第一個上,按順序創建最終atlas

- Overlay library

Overlay librarygives access to all available overlayData , This library might use ahuge amount of memory depending of the project, as it keeps direct reference totexture files. By default all UMA textures are provided with read/write tagchecked, but this is only necessary if you´re using free license.

Each overlay have ancolor that can be used to tint it´s first texture ontextureList.Usually this value is set by code, at the moment the overlay is being includedon the slot.

The Color32 arrayschannelMask and channelAdditiveMask gives exceptional control over adjustingtexture channels. Each color here will change the overlay texture fromoverlayListsharing the same index. With this, it´s possible to adjust each texturechannel of each overlay of an atlas.

-Overlay

Overlay庫提供對所有可用overlayData的訪問,這個庫在工程中可能需要極大的內存支持,因為它保持關聯到貼圖文件。默認的所有UMA貼圖都選中了read/write標籤,但這在免費版是必須的。

每個overlay都有顏色可以用來對textureList中第一張貼圖著色。通常當overlay被包含在slot的時候,在腳本中設置這個值。Color32數組的channelMaskchannelAdditiveMask提供對貼圖通道的特殊控制。每個顏色都將改變overlayList里相同索引號的overlay貼圖。這使得調整atlas中每個overlay中的每張貼圖通道成為可能。

For example, if weconsider reducing the gloss value of a hair texture, we could set anchannelMask second color (index 1, relative to second texture, where normalmap, specular and gloss are kept ) channel “b ”to a lower value.

Functions publicvoid SetColor(int overlay, Color32 color) and public void SetAdditive(intoverlay, Color32 color) on overlayData are responsible for setting thosevalues. We could have something like hairOverlay. SetColor(1 , new Color32(255,255,50,255));to reduce gloss value on above mentioned example.

The rect value isspecially useful if you´re providing an overlay that covers a small area of thebase texture. Both male and female eyebrows cover only a small part of the headbase texture, and it would be a waste of memory having a huge texture with mostof it´s area completely masked.

The x value is thehorizontal offset of the cropped overlay, y value is the vertical offset, andwidth/height are relative to cropped overlay size.

I´ve managed toinclude on Overlay library a set of buttons to adjust all overlay textures in asingle click, this is specially usefull to reduce the resolution of alltextures or set their compression.

如果我們想要降低頭髮材質的gloss值,我們可以設置一個channelMask2顏色(索引1,相對於第2材質,那裡保存著法線、Speculargloss貼圖)的”b“通道到較小的值。

overlayData裡的函數 public void SetColor(int overlay, Color32 color)

Publicvoid SetAdditive(int overlay, Color32 color)負責設置這些值。可以用這做一些東西,比如hairOverlay。用SetColor(1, new Color32(255, 255, 50, 255);減少上例的gloss值。

當你想要一個overlay覆蓋基礎貼圖的一小部分區域,那麼Rect非常有用。男女睫毛都只覆蓋頭部基礎貼圖的一小部分,並且如果它有一張大部分區域被屏蔽的巨大貼圖的話將浪費大量的內存資源。

X是裁剪overlay的水平偏移值,y值是垂直偏移值,並且width/height是相對於裁剪overlay的大小。

我正在overlay庫設置一系列按鈕,實現一鍵修改所有overlay材質的功能,這對於減少所有貼圖的分辨率或者壓縮非常有用。


cropped overlaybeing combined to base texture

 

UMA shape

- UMADna

Being able to adjustavatar shape in real time, even if the avatar share both texture atlas and meshis very powerful. This is possible because we use bone changes to deform boththe avatar body mesh and it´s clothes. To archive those bone changes, we need to know bothwhich bones should be adjusted and how this should happend.

UMADna holds the values from changes an avatar canreceive, and we provide anUMADnaHumanoidclass inheriting from UMADnaas example of how this works. Both male and female avatars uses thisUMADnaHumanoidto define their shape values.

If you consider thewinged humanoid on the diagram image, it might be possible to have a singleUMADnaWingedbeing used by both male and female wings. This class would only need toprovide the extra values like “size”,”spike size”and “spike length”.

UMA形體

-UMADna

可以實時修改avatar形體,即使avatar共享貼圖和mesh,這很強大。這可行是因為我們使用骨骼改變來變形avatar bodymesh 和衣服。為了是骨骼改變,我們需要知道那個骨骼需要調整以及怎樣使他發生。

UMADna掌控avatar獲得的骨骼改變值,並且我們提供一個UMADnaHumanoid類繼承UMADna作為了解它如何工作的示例。男女avatar都是用UMADnaHumanoid來定義形體值。

如果你想要在圖表上那個帶翅膀的人,可以讓男女的翅膀簡單使用UMADnaWinged。這個類只需要提供額外的值類似尺寸突刺大小突刺長度

-DnaConverterBehaviour

The DnaConverterBehaviouris responsible for converting the Dna values to bone changes, This is wherethe code for deforming bones is kept. We provide both anHumanFemaleDNAConverterBehaviourandHumanMaleDNAConverterBehaviour inheriting from DnaConverterBehaviourand as you can see, male and female avatars share the same shape values,but resulting bone changes are specific to gender.

-DnaConverterBehaviour

DnaConverterBehaviour負責轉換Dna值到骨骼變化,這是使骨骼變形的代碼所在地。我們提供HumanFemaleDNAConverterBehaviour HumanMaleDNAConverterBehaviour繼承DnaConverterBehaviour,男女avatar共享相同的形體值,但最終骨骼變化結果分性別的。

 

Creating UMA avatar

UMAGenerator

UMAGenerator provides all necessary functions andmethods to handle avatar creation. Creating an avatar is done in 3 steps:calculating it´s final mesh and rig, processing it´s texture atlas and updatingit´s shape.

umaDirtyList keeps track of all UMA avatars that need tobe created or updated, in documentation following pages it will be clear howand avatar is included on list.

Both usePRO andconvertRenderTexture visible as checkboxes on unity editor are veryimportant. If you have an Unity PRO license and usePRO enabled, it ´s possibleto create the atlas using RenderTextures, so texture calculation is very fast.For Free license, it requires processing each pixel individually, so it takesconsiderably more time and processing power. It ´s possible to split thiscalculation over as many frames

as necessary toavoid drastically lowering frame rate, but higher resolution textures willrequire a considerable amount of time to be processed.

UMAGenerator

UMAGenerator提供所有必要的功能和方法來控制avatar的創建。創建一個avatar3個步奏組成:計算最終mesh和綁定、生成它的貼圖atlas、更新形體。

umaDirtyList追蹤所有需要創建或者更新的UMA avatar,在文檔後面章節詳細介紹avatar如何被包含在列表中的。

Unity編輯器裡的UsePROconvertRenderTexture複選框非常重要。如果你是Unity PRO版那麼請複選usePRO,它可以使用RenderTexture創建atlas,所以貼圖計算很快。如果是免費版需要單獨處理每個像素,所以他將花費大量時間和電力。可以把計算分散到盡量多的幀裡來避免急遽降低幀率,但高分辨率貼圖將需要大量時間處理。

convertRenderTextureis useful in case you´reworking with Unity PRO, but don´t want the final atlas being a RenderTextureinstead of Texture2D. This might be the case if you´re planning compressing theatlas. Keep in mind this process is heavy and might bring slowdowns on2048x2048 atlases. it´s Also known that RenderTexture data won´t be kept onWebplayer after window is resized or on builds when for example accessing taskmanager, in those cases atlas would have to be recalculated or converted fromRenderTexture to Texture2D to avoid the problem.

textureNameList provides a solution if you´re planningusing extra textures that should be baked on atlases and applied to your samplematerials. Usually we have _MainTex and _BumpTex, and if your sample materialshader require both of them, atlas will search on overlays´ textureList index0 and 1 for those two. In case you add a third texture name, for example_DetailTex, and provides a shader requesting this data, overlays using thisshader are expected to provide the extra texture on corresponding index.

convertRenderTexture在你使用UnityPRO版是很有用,但別讓最終atlas變成RenderTexture來代替Texture2D這在你想要壓縮atlas的時候可能會碰到。緊記,這個處理消耗很大并可能在用2048x2048atlas的時候降低運行速度。你還要知道RenderTexture資料,在窗口大小變化或者構建時,不能被保存到Webplayer,比如當訪問任務管理器時,在這些情況下,必須計算并轉換RenderTextureTexture2D來避開這個問題。

如果你計劃使用額外的貼圖,而且它需要烘培到atlas應用到你的採樣材質,這時textureNameList提供一個解決方案。通常我們有_MainTex_BumpTex屬性,並且如果你的採樣材質需要它們倆,atlas會搜索overlaytextureList的索引01找他們。有時你添加第3個貼圖名,比如_DetailTex,然後提供一個shader訪問這個資料,overlay在相應的索引使用這個期待的shader提供這個額外的貼圖。

maxMeshUpdates and maxPixels defines how manymeshes will be baked and how many pixels can be processed on a single updatestep. SettingmaxPixelsis only necessary when not using usePRO.If you´re targeting mobile or old devices, it´s important to profile theperformance and adjust those values. It might also be useful to adapt thosevalues dinamically depending on actual performance for the specific devicerunning the project.

atlasResolution is very important, it defines maximumresolution of the atlases generated. If you need very detailed textures, youmight want to increase this to 4096, but keep in mind the memory used for highresolution textures is really big, specially if not compressed. It´s possibleto adjust overall overlays resolution to fit smaller atlases, this will becovered on following pages. Setting atlas resolution to small values but notadjusting textures resolution accordingly will generate errors on project, asnot all textures will fit atlas.

FitAtlas Forces final atlas to fit Atlas resolutionin case the resulting atlas size would be larger than maximum size.

AtlasCrop Final atlas unused texture space will becropped. If you need the resulting atlas being a square texture, this is notrecommended.

maxMeshUpdate maxPixel定義了在一個更新步驟中有多少mesh將被烘培,多少像素將被處理。設置maxPixel只有當不設置usePRO時候可用。如果你的目標是移動設備或者老設備,那麼設置這些值對性能非常重要。基於運行此程序的設備的實際性能動態修改這些值也很有用。

atlasResolution也很重要,它定義atlas創建的最大分辨率。如果需要非常高清的貼圖,那麼可能需要增加這個值到4096,但緊記,高清圖極度吃內存,特別是未壓縮的。修改所有的overlay分辨率來適應小atlas也非常重要,在後續章節會介紹。設置atlas分辨率為小值但不修改貼圖分辨率將會引發錯誤,因為不是所有貼圖都能適應atlas

atlas尺寸大於最大尺寸的時候,設置FitAtlas強制最終atals適應atlas分辨率

AtlasCrop 最終atlas未使用的貼圖空間將被裁剪。如果你想要atlas保持正方形,這個選項最好別設置。


UMAGenerator

UMACrowd

UMACrowd is an example of how UMA avatars can berandomly created based on content we have on libraries. Both colors and shapevalues don´t have any elaborated creation method. In most games you will need acolor palette and more control over shape and cloth combinations.

First of all, UMACrowdneeds to keep track of SlotLibrary, OverlayLibrary, RaceLibraryand UMAGenerator. You can considerUMACrowdas a chef withaccess to all necessary ingredients and tools to cook an unique meal. Each UMAavatar, or meal if you wish, is created based on an specific recipe the chefwrites based on available ingredients and how they are combined. UMAGeneratoris the available tool the chef uses to actually cook the meal, and bake an UMAavatar.

UMACrowd是一個展示UMA avatar可以使用在庫裡的content被隨機創建的程度。顏色和形體值都沒有複雜的創建方法。在大多數遊戲你將需要調色盤和更多的控制器來控制形體和衣服組合。

第一,UMACrowd需要保持追蹤SlotLibrary, OverlayLibrary, RaceLibraryUMAGenerator你可以把UMACrowd想象成主廚存取所有必要的食材和工具來烹飪獨一無二的餐點。每個UMAavatar,或者餐點如果你願意,基於特殊的由主廚的根據可用食材和它們的組合方式寫就的食譜被創建。UMAGenerator是主廚用來實際烹飪餐點的可用工具,并烘培一個UMAavatar

atlasResolutionScaleThis value changes theoverall texture size of all overlays an UMA avatar receives, reducing finalatlas size. If you´re planning on having a lot of UMA avatars with uniqueatlases, it might be necessary considering a lower value here. Usually thevalues we set here are 1.0f, 0.5f, 0.25f, 0.125f and 0.0625f, as those are alsothe values for getting the correct mipmap on Free license. As default, it´s setto 0.5f, with atlas resolution of 2048.

generateUMA , visible as a checkbox at Unity Editor,checking it generates one random UMA avatar.

generateLotsUMA, visible as a checkbox at Unity Editor,checking it generates a groupd of random UMA avatar, based on belowVector2value.

umaCrowdSize defines the amount of UMA avatars createdon column and row. Default values are 4x4, resulting in 16 UMA avatars.

randomDNA visible as a checkbox at Unity Editor,checking it generates random shapes for avatars, otherside all avatars willhave neutral shape.

useLegacyCombine On UMA latest version, the old CombineInstance()code is still available in case there´s no intention on using extra bonesthat would be dinamically included on avatar. The legacy code requires lessprocessing time, but provides limited results.

zeroPoint Defines the position where UMA avatars arecreated. If it´s empty, defaulf value isVector3.Zero.

atlasResolutionScale這個值改變UMA avatar接收到的所有overlay中的所有貼圖的尺寸,減少最終atlas尺寸。如果你計劃生產許多個擁有不同altasUMAavatar,有必要設置一個較小的值。

通常我們在這裡設置的值為1.0f,0.5f, 0.25f, 0.125f0.0625f,因為這些值可以在免費版獲得正確的mipmap。默認,設置為0.5f,也就是altas分辨率為2048

generateUMA,在編輯器顯示為複選框,複選他會創建一個隨機的UMA avatar

generateLotsUMA,在編輯器顯示為複選框,複選他創建一組隨機UMA avatar,基於下面的Vector2值。

umaCrowdSize定義大量UMA avatar創建在行列里。默認是4x4,也就是16UMA avatar

randomDNA在編輯器顯示為複選框,複選它會創建隨機體型的avatar,另外所有avatar將是中性的。

useLegacyCombine在最新的UMA版本,老的CombineInstance()函數在你不想要動態添加額外骨骼到avatar的情況下仍然可用。老代碼執行時間更少,但有很多限制。

ZeroPoint定義UMA avatar創建的位置。如果它為空,那麼默認值將是Vector3.Zero


UMACrowd

UMACustomization

UMACustomization exemplify changing avatar shape after it´screation. Following the same concept, it´s possible to change UMA slots andoverlays, triggering them to update with the new content. At the example scene,right clicking on any UMA avatar updates UMACustomization sliders withits specific shape, after that it´s possible to use sliders to change any shapevalue.

UMACustomization generates a rough example of sliders basedon GUITextures as reference of how to handle changing UMA shape based on userinput, but it´s clear each project will require a custom approach to handleboth GUI and user input.

Exchanging UMA clothand acessories means changing the array of slots used for creating an UMAavatar and including that avatar onumaDirtyList at UMAGeneratorto getupdated.

UMACustomization

UMACustomization是展示avatar創建後再變形的示例。遵循相同的概念,它尅改變UMA slotoverlay,觸發他們來更新新的content。在示例場景,右擊任何帶特殊形體的UMA avatar 更新UMACunstomization滑塊,之後就可以使用滑塊概念形體值了。

UMACustomization只是一個粗糙的基於GUITexture的示例,作為根據輸入控制改變UMA形體的參考,但其實每個工程都需要自定義方法來控制GUI和其他輸入。

交換UMA衣服和配飾意味著改變創建UMA avatar用的slot數組,包括在UMAGenerator裡的umaDirtyList的更新。


UMACustomization

UMAData

UMAData provides many functions, methods andclasses being used on avatar creation as an standard for sharing information.

Each avatar has it´sown UMAData, that´s why manually duplicating avatars on Unity editormight generate errors when trying to access any avatar data, as theirUMADatahas not been properly set.

It’s important toexplain the concept of “dirty ” at UMAData. Both isShapeDirty, isMeshDirtyand isTextureDirty are responsible to keep track of what needs to beupdated or recalculated on this UMA avatar.

isShapeDirty means shape data needs to be recalculated.This is usually set when any DNA value received changes that require updatingUMA bones.

isMeshDirty should be set true when UMADatareceived slot changes and avatar mesh requires being baked again. This alsoapplies if overlays have changed as most likely atlases and in consequencemesh uv will require to be recalculated.

UMAData

UMADataavatar的創建提供了很多功能、方法和類,作為共享信息的標準。

每個avatar都有它自己的UMAData,這是當你在編輯器手動複製avatar,訪問任何avatar資料時,可能產生錯誤的原因,因為它們的UMAData沒有被正確設置。

介紹UMADatadirty概念很重要。isShapeDirty, isMeshDirtyisTextureDirty都否則追蹤這個UMA avatar的那個部分需要被更新和重新計算。

isShapeDirty表示shape資料需要被重新計算。這通常在DNA接收到改變而需要更新UMA骨骼是發送。

isMeshDirty需要被誰為true,當UMAData接收到slot改變而avatar mesh需要重新烘培時。這也會發生在overlay改變因而mesh uv需要被重計算。

isTextureDirty means atlases require being recalculated.On UMA actual stage, the entire atlases are generated from scratch, but it´spossible to keep track of changes and implement an advanced solution forcingatlas recalculation on specific areas only.

useLegacyCode is set by UMACrowd when creating the avatar,but can be set directly on UMAData.

animationControllercan be an unique animatorfor each avatar. This is necessary because when the avatar shape changes and anew mecanim avatar is created, the animation controller need to be set back.

umaPackRecipe was created considering that all necessarydata to recreate an UMA avatar might need to be saved or shared on multiplayergames. WhatumaPackRecipeprovides is the minimum necessary data forserialization, usually an array with the names of slots, overlays and DNAs, andthe extra changes that had been applied to those. All this data can then beunpacked into anumaRecipe. In the process, respective librariesprovides elements based on serialized names and extra changes are applied tothose.

isTextureDirty表示atlas需要重計算。事實上UMA本身,整個atlas是從一開始就創建的額,但可以追蹤改變,并實現高級解決方案強制atlas只對特定區域重計算。

useLegacyCodeavatar創建的時候由UMACrowd設置,但可以在UMAData直接設置。

AnimationController可以是每個avatar都有唯一的animator。這是可行的,因為當avatar形體改變,一個新的mecanim avatar創建是,animationController需要被設置。

umaPackRecipe是考慮到可能需要把UMA avatar保存起來或者共享給其他遊戲使用。umaPackRecipe提供的是最小化序列化所必須的資料,通常是slot名、overlayDNA數組,並且額外的改變需要應用到它們。所有這些資料可以被解包到umaRecipe這個過程,各個庫提供基於序列化名的原始并把額外的改變應用到它們。

1 0
原创粉丝点击