Search Unity

procedural character generation

Discussion in 'Works In Progress - Archive' started by FernandoRibeiro, Oct 5, 2012.

Thread Status:
Not open for further replies.
  1. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Thanks for the reminder, I'll have to look at the code videos, C# Lists still aren't my strong point.

    Otherwise I'm liking the code, it's very clean and organized. I've unchecked all the check boxes in UMACrowd to generate a character(s) and created 2 onGUI buttons for a Male and a Female: in those if statements I'd like to generate and place a male character or a female character when the button is pressed and if the button is pressed multiple times then that many characters are generated. Shouldn't be too hard I hope.

    ...virror I saw where you are going to release your code in a few days anyway so I may as well post the few changes I made to UMACustomization to make the demo scene a bit less crowded with sliders and more flexibly add characters.

    I tried moving the sliders into an onGUI Unity GUI window but it absolutely crawled (3 FPS) so this was my alternate easy solution.

    One just needs to customize the dressing room art work to suite your game.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class UMACustomization:MonoBehaviour
    6.     {
    7.     public Transform sliderPrefab;
    8.    
    9.     public  UMAData umaData;
    10.     public  CameraTrack cameraTrack;
    11.     private UMADnaHumanoid umaDna;
    12.    
    13.     public SliderControl[] sliderControlList;
    14.     static int sliderInit = 0;
    15.    
    16.     public SlotLibrary mySlotLibrary;
    17.     public OverlayLibrary myOverlayLibrary;
    18.    
    19.     private Rect customWindow;
    20.    
    21.     private int iUMAMenu = 0;
    22.     private int uUMAMenu = 0;
    23.  
    24.    
    25.     public struct genderArray
    26.         {
    27.         public string itemName;
    28.        
    29.         public genderArray(string itemName)
    30.             {
    31.            
    32.             this.itemName = itemName;
    33.            
    34.             return;
    35.             }// genderArray
    36.         }// genderArray
    37.    
    38.     private genderArray[] sexArray = new genderArray[2];
    39.    
    40.     public struct jobsArray
    41.         {
    42.         public string itemName;
    43.        
    44.         public jobsArray(string itemName)
    45.             {
    46.            
    47.             this.itemName = itemName;
    48.            
    49.             return;
    50.             }// jobsArray
    51.         }// jobsArray
    52.    
    53.     private jobsArray[] jobArray = new jobsArray[27];
    54.    
    55.     public struct bodyPartArray
    56.         {
    57.         public string itemName;
    58.        
    59.         public bodyPartArray(string itemName)
    60.             {
    61.            
    62.             this.itemName = itemName;
    63.            
    64.             return;
    65.             }// bodyPartArray
    66.         }// bodyPartArray
    67.    
    68.     private bodyPartArray[] bodyArray = new bodyPartArray[16];
    69.  
    70.     void OnGUI()
    71.         {
    72.        
    73.         customWindow = GUI.Window(0, customWindow, UMAWindow, "Po' Folk", GUI.skin.GetStyle("window"));
    74.        
    75.         return;
    76.         }// onGUI
    77.  
    78.     public void ChangeMenuActivity(bool state)
    79.         {
    80.    
    81.         ToggleVisibility(gameObject.transform, state);
    82.        
    83.         return;
    84.         }// ChangeMenuActivity
    85.  
    86.     void ToggleVisibility(Transform obj, bool state)
    87.         {
    88.    
    89.         for (int i = 0; i < obj.childCount; i++)
    90.             {
    91.            
    92.             if (obj.GetChild(i).guiTexture != null)
    93.                 obj.GetChild(i).guiTexture.enabled = state;
    94.        
    95.             if (obj.GetChild(i).guiText != null)
    96.                 obj.GetChild(i).guiText.enabled = state;
    97.  
    98.             if (obj.GetChild(i).childCount > 0)
    99.                 {
    100.            
    101.                 ToggleVisibility(obj.GetChild(i), state);
    102.                 }// if
    103.             }// for
    104.        
    105.         return;
    106.         }// ToggleVisibility
    107.  
    108.     void Start()
    109.         {
    110.        
    111.         sexArray[0].itemName   = "Male";
    112.         sexArray[1].itemName   = "Female";
    113.        
    114.         bodyArray[0].itemName  = "Head";
    115.         bodyArray[1].itemName  = "Eyes";
    116.         bodyArray[2].itemName  = "Nose";
    117.         bodyArray[3].itemName  = "Ears";
    118.         bodyArray[4].itemName  = "Cheeks";
    119.         bodyArray[5].itemName  = "Mouth";
    120.         bodyArray[6].itemName  = "Jaw";
    121.         bodyArray[7].itemName  = "Chin";
    122.         bodyArray[8].itemName  = "Neck";
    123.         bodyArray[9].itemName  = "Arms";
    124.         bodyArray[10].itemName = "Torso";
    125.         bodyArray[11].itemName = "Hips";
    126.         bodyArray[12].itemName = "Legs";
    127.         bodyArray[13].itemName = "Height";
    128.         bodyArray[14].itemName = "Muscle";
    129.         bodyArray[15].itemName = "Fat";
    130.        
    131.         sliderControlList = new SliderControl[46]; 
    132.        
    133.         if (sliderInit++ == 0)
    134.             {
    135.            
    136.             sliderControlList[1]  = InstantiateSlider("headSize" , 0, 0);
    137.             sliderControlList[43] = InstantiateSlider("headWidth", 0, 1);
    138.             sliderControlList[32] = InstantiateSlider("forehead size", 0, 2);
    139.             sliderControlList[33] = InstantiateSlider("forehead position", 0, 3);
    140.             sliderControlList[44] = InstantiateSlider("eye Size", 0, 0);
    141.             sliderControlList[45] = InstantiateSlider("eye Rotation", 0, 1);
    142.             sliderControlList[15] = InstantiateSlider("nose size", 0, 0);
    143.             sliderControlList[16] = InstantiateSlider("nose curve", 0, 1);
    144.             sliderControlList[17] = InstantiateSlider("nose width", 0, 2);
    145.             sliderControlList[18] = InstantiateSlider("nose inclination", 0, 3);
    146.             sliderControlList[19] = InstantiateSlider("nose position", 0, 4);
    147.             sliderControlList[20] = InstantiateSlider("nose pronounced", 0, 5);
    148.             sliderControlList[21] = InstantiateSlider("nose flatten", 0, 6);
    149.             sliderControlList[12] = InstantiateSlider("ears size", 0, 0);
    150.             sliderControlList[13] = InstantiateSlider("ears position", 0, 1);
    151.             sliderControlList[14] = InstantiateSlider("ears rotation", 0, 2);
    152.             sliderControlList[28] = InstantiateSlider("cheek size", 0, 0);
    153.             sliderControlList[29] = InstantiateSlider("cheek position", 0, 1);
    154.             sliderControlList[30] = InstantiateSlider("lowCheek pronounced", 0, 2);
    155.             sliderControlList[31] = InstantiateSlider("lowCheek position", 0, 3);
    156.             sliderControlList[34] = InstantiateSlider("lips size", 0, 0);
    157.             sliderControlList[35] = InstantiateSlider("mouth size", 0, 1);
    158.             sliderControlList[25] = InstantiateSlider("mandible size", 0, 2);
    159.             sliderControlList[26] = InstantiateSlider("jaw Size", 0, 0);
    160.             sliderControlList[27] = InstantiateSlider("jaw Position", 0, 1);
    161.             sliderControlList[22] = InstantiateSlider("chinSize", 0, 0);
    162.             sliderControlList[23] = InstantiateSlider("chinPronounced", 0, 1);
    163.             sliderControlList[24] = InstantiateSlider("chinPosition", 0, 2);
    164.             sliderControlList[2]  = InstantiateSlider("neck", 0, 0);
    165.             sliderControlList[3]  = InstantiateSlider("arm Length", 0, 0);
    166.             sliderControlList[38] = InstantiateSlider("arm Width", 0, 1);
    167.             sliderControlList[39] = InstantiateSlider("forearm Length", 0, 2);
    168.             sliderControlList[40] = InstantiateSlider("forearm Width", 0, 3);
    169.             sliderControlList[4]  = InstantiateSlider("hands Size", 0, 4);
    170.             sliderControlList[36] = InstantiateSlider("breastSize", 0, 0);
    171.             sliderControlList[41] = InstantiateSlider("belly", 0, 1);
    172.             sliderControlList[42] = InstantiateSlider("waist", 0, 0);
    173.             sliderControlList[37] = InstantiateSlider("Gluteus Size", 0, 1);
    174.             sliderControlList[5]  = InstantiateSlider("foot Size", 0, 2);
    175.             sliderControlList[6]  = InstantiateSlider("leg Separation", 0, 1);
    176.             sliderControlList[11] = InstantiateSlider("legSize", 0, 0);
    177.             sliderControlList[0]  = InstantiateSlider("height", 0, 0);
    178.             sliderControlList[7]  = InstantiateSlider("upper muscle", 0, 0);
    179.             sliderControlList[8]  = InstantiateSlider("lower muscle", 0, 1);
    180.             sliderControlList[9]  = InstantiateSlider("upper weight", 0, 0);
    181.             sliderControlList[10] = InstantiateSlider("lower weight", 0, 1);
    182.             }// if
    183.        
    184.         for (int i = 0; i < 46; i++)
    185.             {
    186.            
    187.             ToggleVisibility(sliderControlList[i].transform, false);
    188.             }// for
    189.        
    190.         customWindow = new Rect(750, 400, 160, 125);
    191.        
    192.         return;
    193.         }// Start
    194.    
    195.  
    196.     void Update()
    197.         {
    198.         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    199.         RaycastHit hit;
    200.        
    201.         if (Input.GetMouseButtonDown(1))
    202.             {
    203.            
    204.             if (Physics.Raycast(ray, out hit, 100))
    205.                 {
    206.                 UMAData tempUMA = hit.collider.GetComponent("UMAData") as UMAData;
    207.                
    208.                 if (tempUMA)
    209.                     {
    210.                    
    211.                     if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
    212.                         {
    213.                        
    214.                         if (umaData)
    215.                             {
    216.                        
    217.                             tempUMA.SaveToMemoryStream();
    218.                             umaData.streamedUMA = tempUMA.streamedUMA;
    219.                             umaData.LoadFromMemoryStream();
    220.                             umaData.Dirty(true, true, true);
    221.                             }// if
    222.                        
    223.                         return;
    224.                         }// if
    225.  
    226.                     //Clear saved data of old UMA
    227.                     if (umaData)
    228.                         {
    229.                        
    230.                         umaData.streamedUMA = null;
    231.                         }// if
    232.                    
    233.                     umaData = tempUMA;
    234.                    
    235.                     if (cameraTrack)
    236.                         {
    237.                        
    238.                         cameraTrack.target = umaData.transform;
    239.                         }// if
    240.                    
    241.                     umaDna = umaData.umaRecipe.umaDna[typeof(UMADnaHumanoid)] as UMADnaHumanoid;
    242.                     ReceiveValues();
    243.                    
    244.                     //Save functionality
    245.                     umaData.SaveToMemoryStream();
    246.                     }// if
    247.                 }// if
    248.             }// if
    249.        
    250.         if (umaData)
    251.             {
    252.            
    253.             TransferValues();
    254.    
    255.             for (int i = 0; i < sliderControlList.Length; i++)
    256.                 {
    257.                
    258.                 if (sliderControlList[i].pressed == true)
    259.                     {
    260.                    
    261.                     UpdateUMAShape();
    262.                     umaData.UpdateCollider();
    263.                     }// if
    264.                 }// for
    265.             }// if
    266.        
    267.         //Load functionality
    268.         if (Input.GetKeyDown(KeyCode.Z))
    269.             {
    270.            
    271.             if (umaData)
    272.                 {  
    273.                
    274.                 umaData.LoadFromMemoryStream();
    275.                 umaData.isShapeDirty = true;
    276.                 umaData.Dirty();
    277.                
    278.                 umaDna = umaData.umaRecipe.umaDna[typeof(UMADnaHumanoid)] as UMADnaHumanoid;
    279.                 ReceiveValues();
    280.                
    281.                 umaData.SaveToMemoryStream();
    282.                 }// if
    283.             }// if
    284.        
    285.         return;
    286.         }// Update
    287.    
    288.     public SliderControl InstantiateSlider(string name, int X, int Y)
    289.         {
    290.         Transform TempSlider;
    291.        
    292.         TempSlider = Instantiate(sliderPrefab,Vector3.zero, Quaternion.identity) as Transform;
    293.         TempSlider.parent = transform;
    294.         TempSlider.gameObject.name = name;
    295.         SliderControl tempSlider = TempSlider.GetComponent("SliderControl") as SliderControl;
    296.         tempSlider.actualValue = 0.5f;
    297.         tempSlider.descriptionText.text = name;
    298.         tempSlider.sliderOffset.x = 20 + X*100;
    299.         tempSlider.sliderOffset.y = -20 - Y*60;
    300.        
    301.         return(tempSlider);
    302.         }// SliderControl
    303.    
    304.     public SliderControl InstantiateStepSlider(string name, int X, int Y)
    305.         {
    306.         SliderControl tempSlider = InstantiateSlider(name,X,Y);
    307.        
    308.         tempSlider.stepSlider = true;
    309.        
    310.         return(tempSlider);
    311.         }// SliderControl
    312.    
    313.     public void UpdateUMAAtlas()
    314.         {
    315.        
    316.         umaData.isTextureDirty = true;
    317.         umaData.Dirty();   
    318.        
    319.         return;
    320.         }// UpdateUMAAtlas
    321.    
    322.     public void UpdateUMAShape()
    323.         {
    324.        
    325.         umaData.isShapeDirty = true;
    326.         umaData.Dirty();
    327.        
    328.         return;
    329.         }// UpdateUMAShape
    330.    
    331.     public void ReceiveValues()
    332.         {
    333.        
    334.         if (umaDna != null)
    335.             {
    336.            
    337.             sliderControlList[0].actualValue  = umaDna.height;
    338.             sliderControlList[1].actualValue  = umaDna.headSize ;
    339.             sliderControlList[43].actualValue = umaDna.headWidth ;
    340.        
    341.             sliderControlList[2].actualValue  = umaDna.neckThickness;
    342.            
    343.             sliderControlList[3].actualValue  = umaDna.armLength;
    344.             sliderControlList[4].actualValue  = umaDna.handsSize;
    345.             sliderControlList[5].actualValue  = umaDna.feetSize;
    346.             sliderControlList[6].actualValue  = umaDna.legSeparation;
    347.            
    348.            
    349.             sliderControlList[7].actualValue  = umaDna.upperMuscle;
    350.             sliderControlList[8].actualValue  = umaDna.lowerMuscle;
    351.             sliderControlList[9].actualValue  = umaDna.upperWeight;
    352.             sliderControlList[10].actualValue = umaDna.lowerWeight;
    353.        
    354.             sliderControlList[11].actualValue = umaDna.legsSize;
    355.            
    356.             sliderControlList[12].actualValue = umaDna.earsSize;
    357.             sliderControlList[13].actualValue = umaDna.earsPosition;
    358.             sliderControlList[14].actualValue = umaDna.earsRotation;
    359.            
    360.             sliderControlList[15].actualValue = umaDna.noseSize;
    361.            
    362.             sliderControlList[16].actualValue = umaDna.noseCurve;
    363.             sliderControlList[17].actualValue = umaDna.noseWidth;
    364.             sliderControlList[18].actualValue = umaDna.noseInclination;
    365.             sliderControlList[19].actualValue = umaDna.nosePosition;
    366.             sliderControlList[20].actualValue = umaDna.nosePronounced;
    367.             sliderControlList[21].actualValue = umaDna.noseFlatten;
    368.            
    369.             sliderControlList[22].actualValue = umaDna.chinSize;
    370.             sliderControlList[23].actualValue = umaDna.chinPronounced;
    371.             sliderControlList[24].actualValue = umaDna.chinPosition;
    372.            
    373.             sliderControlList[25].actualValue = umaDna.mandibleSize;
    374.             sliderControlList[26].actualValue = umaDna.jawsSize;
    375.             sliderControlList[27].actualValue = umaDna.jawsPosition;
    376.            
    377.             sliderControlList[28].actualValue = umaDna.cheekSize;
    378.             sliderControlList[29].actualValue = umaDna.cheekPosition;
    379.             sliderControlList[30].actualValue = umaDna.lowCheekPronounced;
    380.             sliderControlList[31].actualValue = umaDna.lowCheekPosition;
    381.            
    382.             sliderControlList[32].actualValue = umaDna.foreheadSize;
    383.             sliderControlList[33].actualValue = umaDna.foreheadPosition;
    384.            
    385.             sliderControlList[44].actualValue = umaDna.eyeSize;
    386.             sliderControlList[45].actualValue = umaDna.eyeRotation;
    387.             sliderControlList[34].actualValue = umaDna.lipsSize;
    388.             sliderControlList[35].actualValue = umaDna.mouthSize;
    389.             sliderControlList[36].actualValue = umaDna.breastSize; 
    390.             sliderControlList[37].actualValue = umaDna.gluteusSize;
    391.            
    392.             sliderControlList[38].actualValue = umaDna.armWidth;
    393.             sliderControlList[39].actualValue = umaDna.forearmLength;
    394.             sliderControlList[40].actualValue = umaDna.forearmWidth;
    395.            
    396.             sliderControlList[41].actualValue = umaDna.belly;
    397.             sliderControlList[42].actualValue = umaDna.waist;
    398.         }// if
    399.        
    400.     return;
    401.     }// ReceiveValues
    402.    
    403.     public void TransferValues()
    404.         {
    405.        
    406.         if (umaDna != null)
    407.             {
    408.            
    409.             umaDna.height = sliderControlList[0].actualValue;
    410.             umaDna.headSize = sliderControlList[1].actualValue;
    411.             umaDna.headWidth = sliderControlList[43].actualValue;
    412.            
    413.             umaDna.neckThickness = sliderControlList[2].actualValue;
    414.            
    415.             umaDna.armLength = sliderControlList[3].actualValue;
    416.             umaDna.handsSize = sliderControlList[4].actualValue;
    417.             umaDna.feetSize = sliderControlList[5].actualValue;
    418.             umaDna.legSeparation = sliderControlList[6].actualValue;
    419.            
    420.            
    421.             umaDna.upperMuscle = sliderControlList[7].actualValue;
    422.             umaDna.lowerMuscle = sliderControlList[8].actualValue;
    423.             umaDna.upperWeight = sliderControlList[9].actualValue;
    424.             umaDna.lowerWeight = sliderControlList[10].actualValue;
    425.        
    426.             umaDna.legsSize = sliderControlList[11].actualValue;
    427.            
    428.             umaDna.earsSize = sliderControlList[12].actualValue;
    429.             umaDna.earsPosition = sliderControlList[13].actualValue;
    430.             umaDna.earsRotation = sliderControlList[14].actualValue;
    431.            
    432.             umaDna.noseSize = sliderControlList[15].actualValue;
    433.            
    434.             umaDna.noseCurve = sliderControlList[16].actualValue;
    435.             umaDna.noseWidth = sliderControlList[17].actualValue;
    436.             umaDna.noseInclination = sliderControlList[18].actualValue;
    437.             umaDna.nosePosition = sliderControlList[19].actualValue;
    438.             umaDna.nosePronounced = sliderControlList[20].actualValue;
    439.             umaDna.noseFlatten = sliderControlList[21].actualValue;
    440.            
    441.             umaDna.chinSize = sliderControlList[22].actualValue;
    442.             umaDna.chinPronounced = sliderControlList[23].actualValue;
    443.             umaDna.chinPosition = sliderControlList[24].actualValue;
    444.            
    445.             umaDna.mandibleSize = sliderControlList[25].actualValue;
    446.             umaDna.jawsSize = sliderControlList[26].actualValue;
    447.             umaDna.jawsPosition = sliderControlList[27].actualValue;
    448.            
    449.             umaDna.cheekSize = sliderControlList[28].actualValue;
    450.             umaDna.cheekPosition = sliderControlList[29].actualValue;
    451.             umaDna.lowCheekPronounced = sliderControlList[30].actualValue;
    452.             umaDna.lowCheekPosition = sliderControlList[31].actualValue;
    453.            
    454.             umaDna.foreheadSize = sliderControlList[32].actualValue;
    455.             umaDna.foreheadPosition = sliderControlList[33].actualValue;
    456.            
    457.             umaDna.eyeSize = sliderControlList[44].actualValue;
    458.             umaDna.eyeRotation = sliderControlList[45].actualValue;
    459.             umaDna.lipsSize = sliderControlList[34].actualValue;
    460.             umaDna.mouthSize = sliderControlList[35].actualValue;
    461.             umaDna.breastSize = sliderControlList[36].actualValue; 
    462.             umaDna.gluteusSize = sliderControlList[37].actualValue;
    463.            
    464.             umaDna.armWidth = sliderControlList[38].actualValue;
    465.             umaDna.forearmLength = sliderControlList[39].actualValue;
    466.             umaDna.forearmWidth = sliderControlList[40].actualValue;
    467.            
    468.             umaDna.belly = sliderControlList[41].actualValue;
    469.             umaDna.waist = sliderControlList[42].actualValue;
    470.             }// if
    471.    
    472.         return;
    473.         }// TransferValues
    474.    
    475.     void umaHideSlider(string itemName)
    476.         {
    477.        
    478.         switch (itemName)
    479.             {
    480.             case ("Head"):
    481.                         ToggleVisibility(sliderControlList[1].transform, false);
    482.                         ToggleVisibility(sliderControlList[43].transform, false);
    483.                         ToggleVisibility(sliderControlList[32].transform, false);
    484.                         ToggleVisibility(sliderControlList[33].transform, false);
    485.                         break;
    486.             case ("Eyes"): 
    487.                         ToggleVisibility(sliderControlList[44].transform, false);
    488.                         ToggleVisibility(sliderControlList[45].transform, false);
    489.                         break;
    490.             case ("Nose"):
    491.                         ToggleVisibility(sliderControlList[15].transform, false);
    492.                         ToggleVisibility(sliderControlList[16].transform, false);
    493.                         ToggleVisibility(sliderControlList[17].transform, false);
    494.                         ToggleVisibility(sliderControlList[18].transform, false);
    495.                         ToggleVisibility(sliderControlList[19].transform, false);
    496.                         ToggleVisibility(sliderControlList[20].transform, false);
    497.                         ToggleVisibility(sliderControlList[21].transform, false);
    498.                         break;
    499.             case ("Ears"):
    500.                         ToggleVisibility(sliderControlList[12].transform, false);
    501.                         ToggleVisibility(sliderControlList[13].transform, false);
    502.                         ToggleVisibility(sliderControlList[14].transform, false);
    503.                         break;
    504.             case ("Cheeks"):
    505.                         ToggleVisibility(sliderControlList[28].transform, false);
    506.                         ToggleVisibility(sliderControlList[29].transform, false);
    507.                         ToggleVisibility(sliderControlList[30].transform, false);
    508.                         ToggleVisibility(sliderControlList[31].transform, false);
    509.                         break;
    510.             case ("Mouth"):
    511.                         ToggleVisibility(sliderControlList[34].transform, false);
    512.                         ToggleVisibility(sliderControlList[35].transform, false);
    513.                         ToggleVisibility(sliderControlList[25].transform, false);
    514.                         break;
    515.             case ("Jaw"):
    516.                         ToggleVisibility(sliderControlList[26].transform, false);
    517.                         ToggleVisibility(sliderControlList[27].transform, false);
    518.                         break;
    519.             case ("Chin"):  
    520.                         ToggleVisibility(sliderControlList[22].transform, false);
    521.                         ToggleVisibility(sliderControlList[23].transform, false);
    522.                         ToggleVisibility(sliderControlList[24].transform, false);
    523.                         break;
    524.             case ("Neck"):
    525.                         ToggleVisibility(sliderControlList[2].transform, false);
    526.                         break;
    527.             case ("Arms"):
    528.                         ToggleVisibility(sliderControlList[3].transform, false);
    529.                         ToggleVisibility(sliderControlList[38].transform, false);
    530.                         ToggleVisibility(sliderControlList[39].transform, false);
    531.                         ToggleVisibility(sliderControlList[40].transform, false);
    532.                         ToggleVisibility(sliderControlList[4].transform, false);
    533.                         break;
    534.             case ("Torso"):
    535.                         ToggleVisibility(sliderControlList[36].transform, false);
    536.                         ToggleVisibility(sliderControlList[41].transform, false);
    537.                         break;
    538.             case ("Hips"):
    539.                         ToggleVisibility(sliderControlList[42].transform, false);
    540.                         ToggleVisibility(sliderControlList[37].transform, false);
    541.                         break;
    542.             case ("Legs"):
    543.                         ToggleVisibility(sliderControlList[5].transform, false);
    544.                         ToggleVisibility(sliderControlList[6].transform, false);
    545.                         ToggleVisibility(sliderControlList[11].transform, false);
    546.                         break;
    547.             case ("Height"):
    548.                         ToggleVisibility(sliderControlList[0].transform, false);
    549.                         break;
    550.             case ("Muscle"):
    551.                         ToggleVisibility(sliderControlList[7].transform, false);
    552.                         ToggleVisibility(sliderControlList[8].transform, false);
    553.                         break;
    554.             case ("Fat"):
    555.                         ToggleVisibility(sliderControlList[9].transform, false);
    556.                         ToggleVisibility(sliderControlList[10].transform, false);
    557.                         break;
    558.                 default:
    559.                         break;
    560.             }// switch
    561.        
    562.         return;
    563.         }// umaHideSlider
    564.    
    565.     void umaShowSlider(string itemName)
    566.         {
    567.        
    568.         switch (itemName)
    569.             {
    570.             case ("Head"):
    571.                         ToggleVisibility(sliderControlList[1].transform, true);
    572.                         ToggleVisibility(sliderControlList[43].transform, true);
    573.                         ToggleVisibility(sliderControlList[32].transform, true);
    574.                         ToggleVisibility(sliderControlList[33].transform, true);
    575.                         break;
    576.             case ("Eyes"): 
    577.                         ToggleVisibility(sliderControlList[44].transform, true);
    578.                         ToggleVisibility(sliderControlList[45].transform, true);
    579.                         break;
    580.             case ("Nose"):
    581.                         ToggleVisibility(sliderControlList[15].transform, true);
    582.                         ToggleVisibility(sliderControlList[16].transform, true);
    583.                         ToggleVisibility(sliderControlList[17].transform, true);
    584.                         ToggleVisibility(sliderControlList[18].transform, true);
    585.                         ToggleVisibility(sliderControlList[19].transform, true);
    586.                         ToggleVisibility(sliderControlList[20].transform, true);
    587.                         ToggleVisibility(sliderControlList[21].transform, true);
    588.                         break;
    589.             case ("Ears"):
    590.                         ToggleVisibility(sliderControlList[12].transform, true);
    591.                         ToggleVisibility(sliderControlList[13].transform, true);
    592.                         ToggleVisibility(sliderControlList[14].transform, true);
    593.                         break;
    594.             case ("Cheeks"):
    595.                         ToggleVisibility(sliderControlList[28].transform, true);
    596.                         ToggleVisibility(sliderControlList[29].transform, true);
    597.                         ToggleVisibility(sliderControlList[30].transform, true);
    598.                         ToggleVisibility(sliderControlList[31].transform, true);
    599.                         break;
    600.             case ("Mouth"):
    601.                         ToggleVisibility(sliderControlList[34].transform, true);
    602.                         ToggleVisibility(sliderControlList[35].transform, true);
    603.                         ToggleVisibility(sliderControlList[25].transform, true);
    604.                         break;
    605.             case ("Jaw"):
    606.                         ToggleVisibility(sliderControlList[26].transform, true);
    607.                         ToggleVisibility(sliderControlList[27].transform, true);
    608.                         break;
    609.             case ("Chin"):  
    610.                         ToggleVisibility(sliderControlList[22].transform, true);
    611.                         ToggleVisibility(sliderControlList[23].transform, true);
    612.                         ToggleVisibility(sliderControlList[24].transform, true);
    613.                         break;
    614.             case ("Neck"):
    615.                         ToggleVisibility(sliderControlList[2].transform, true);
    616.                         break;
    617.             case ("Arms"):
    618.                         ToggleVisibility(sliderControlList[3].transform, true);
    619.                         ToggleVisibility(sliderControlList[38].transform, true);
    620.                         ToggleVisibility(sliderControlList[39].transform, true);
    621.                         ToggleVisibility(sliderControlList[40].transform, true);
    622.                         ToggleVisibility(sliderControlList[4].transform, true);
    623.                         break;
    624.             case ("Torso"):
    625.                         ToggleVisibility(sliderControlList[36].transform, true);
    626.                         ToggleVisibility(sliderControlList[41].transform, true);
    627.                         break;
    628.             case ("Hips"):
    629.                         ToggleVisibility(sliderControlList[42].transform, true);
    630.                         ToggleVisibility(sliderControlList[37].transform, true);
    631.                         break;
    632.             case ("Legs"):
    633.                         ToggleVisibility(sliderControlList[5].transform, true);
    634.                         ToggleVisibility(sliderControlList[6].transform, true);
    635.                         ToggleVisibility(sliderControlList[11].transform, true);
    636.                         break;
    637.             case ("Height"):
    638.                         ToggleVisibility(sliderControlList[0].transform, true);
    639.                         break;
    640.             case ("Muscle"):
    641.                         ToggleVisibility(sliderControlList[7].transform, true);
    642.                         ToggleVisibility(sliderControlList[8].transform, true);
    643.                         break;
    644.             case ("Fat"):
    645.                         ToggleVisibility(sliderControlList[9].transform, true);
    646.                         ToggleVisibility(sliderControlList[10].transform, true);
    647.                         break;
    648.                 default:
    649.                         break;
    650.             }// switch
    651.        
    652.         return;
    653.         }// umaShowSlider
    654.  
    655.     void UMAWindow(int windowID)
    656.         {
    657.        
    658.         GUILayout.BeginVertical();
    659.         if (GUILayout.Button(sexArray[0].itemName, GUILayout.Width(75)))
    660.             {
    661.            
    662.             }// if
    663.        
    664.         if (GUILayout.Button(sexArray[1].itemName, GUILayout.Width(75)))
    665.             {
    666.        
    667.             }// if
    668.        
    669.         GUILayout.EndVertical();
    670.        
    671.         GUILayout.BeginVertical();
    672.         GUILayout.BeginHorizontal();
    673.        
    674.         if (GUILayout.Button("<", GUILayout.Width(20))  uUMAMenu > 0 || iUMAMenu == 0)
    675.             {
    676.      
    677.             if (iUMAMenu > 0)
    678.                 {
    679.                
    680.                 uUMAMenu--;
    681.                 }// if
    682.             iUMAMenu++;
    683.    
    684.             Debug.LogError("bodyArray = "+bodyArray[uUMAMenu].itemName+" uUMAMenu = "+uUMAMenu+" iUMAMenu = "+iUMAMenu);
    685.            
    686.             umaHideSlider(bodyArray[uUMAMenu+1].itemName);
    687.             umaShowSlider(bodyArray[uUMAMenu].itemName);
    688.             }// if
    689.        
    690.         GUILayout.Box(bodyArray[uUMAMenu].itemName, GUILayout.Width(75));
    691.        
    692.         if (GUILayout.Button(">", GUILayout.Width(20))  uUMAMenu < 15)
    693.             {
    694.            
    695.             uUMAMenu++;
    696.            
    697.             Debug.LogError("bodyArray = "+bodyArray[uUMAMenu].itemName+" uUMAMenu = "+uUMAMenu+" iUMAMenu = "+iUMAMenu);
    698.            
    699.             umaHideSlider(bodyArray[uUMAMenu-1].itemName);
    700.             umaShowSlider(bodyArray[uUMAMenu].itemName);
    701.             }// if
    702.    
    703.         GUILayout.EndHorizontal();
    704.         GUILayout.EndVertical();
    705.        
    706.         GUI.DragWindow();
    707.    
    708.         return;
    709.         }// UMAWindow  
    710.     }// UMACustomization
    711.  
     

    Attached Files:

    Last edited: Oct 31, 2013
  2. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    I recommend copying the code out of crowd and making your own controller for this. You can add functionality to control gender but the crowd is essentially a random function. You should consider it a simple example showing how to create UMA from code, I don't plan on using the crowd script anywhere in my own projects.

    I did the Japanese webplayer with onGUI and that certainly doesn't have 3 fps, so I'm guessing you're doing something wrong, do you mark it dirty every frame? Triggering re-atlas every frame is the only way I can imagine getting 3 fps.
     
  3. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Hey UnLogick,

    I didn't even look at the crowd code but will. On the onGUI 3 FPS what I did wrong was copy the slider instantiate code directly into an onGUI refreshed window so that's what was wrong. <:-(

    I will look at your Japanese example the crowd code. Thanks. :)


    Hmmm....Japanses example is very slow but that's because my Intel HD Graphics 1st Gen PC doesn't like shadows and more than one light source I think; but a stylized version of you onGUI control in that scene is what I'm trying to write.


    ...OK, I see I got it...I just have to change the appropriate variables in UMACrowd to static I can get/set them in UMACustomization. ...thanks...

    ciao
     
    Last edited: Oct 31, 2013
  4. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Hi there!
    For the guys that like some graphs, here are the latest changes I´ve included (right click for full image):


    Nothing fancy or amazing, just got the legacy CombineInstances back, for those not using extra bones on any content. This is entirely optional and is only useful if you don´t plan dynamically including extra bones to final rig.
    I´m not using Joen code on that one by not, and we believe performance might get even better when I get manage to use it.
    Sampled worst performance on legacy, and best/worse case on new combiner
     
  5. Ribosome

    Ribosome

    Joined:
    Jan 15, 2013
    Posts:
    43
    Hi, there, when can wen have access to the latest version of UMA? really want to try it
     
  6. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Hi there!
    I was holding the latest news until next week, when I'll (finally) pack everything for the Asset Store, but let me share those now: UMA full project is already available at GitHub. There you will aways find the latest version :)
    https://github.com/huika/
     
  7. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    So if we create assets or modify scripts of UMA then we should branch it off of your UMA (particularly if it's a free asset) or submit it to the Asset Store (which could take a lot of server space fast unless special care is made to only submit the extra changed from the Asset Store UMA)?

    Maybe Unity will create a guide for how they want Content Pack add-ons and scripts to be submitted.
     
  8. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Hi there Goat!
    If I correctly understood your post, the plan is that all extra Assets and code, both created to be shared freely or sold, will be sent directly to AssetStore as any other Asset. The GitHub is basically a way to keep the base project source code.
    UMA was made in a modular way, so extra content can be provided separated from the rest and included in other projects using UMA.
    Let me know if I misunderstood your question.

    Cheers,
    Fernando R.
     
  9. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    No, that's what I wanted to know. I'm just changing 2 scripts so I wasn't wanting to do anything but share those 2 scripts to interested folk. So I'll do that in the Asset Store or post them here and let somebody else do so if they like.
     
  10. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    That´s great =)
     
  11. mikezenox

    mikezenox

    Joined:
    Oct 18, 2012
    Posts:
    55
    For some reason, when I adjust most of the sliders on the first row (head size, ear size, etc), all the proportions of the character change with it. I also have these error codes for each body part:
    Code (csharp):
    1.  
    2. bodyArray = Head uUMAMenu = 0 iUMAMenu = 1
    3. UnityEngine.Debug:LogError(Object)
    4. UMACustomization:UMAWindow(Int32) (at Assets/UMA/UMA_Project/Scripts/UMACustomization.cs:683)
    5.  
     
  12. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Hi there!
    You´re getting this as soon you open the pack and create some avatars, using a clean scene?
     
  13. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Hey MikeZenox Fernando,

    Thanks. I found that...the numbering indices into the morphs got messed up.

    If you wait a couple of days I'm working on something much more like UnLogick's Japan example that will have isolated structures for different characters.

    I'm rusty with coding and basically to C# but once I get this declaration problem solved:

    Code (csharp):
    1.  
    2.     public struct genderStruct
    3.         {
    4.         public string gender; // allow a sex to be chosen
    5.         }// genderStruct
    6.  
    7.     public struct BodyStruct
    8.         {
    9.         public string part; // morphable body part
    10.         public float morph; // scale for the body part
    11.         }// BodyStruct
    12.  
    13.     public struct ClothingStruct
    14.         {
    15.         public string part;   // clothing type
    16.         public string color;  // clothing color
    17.         public float morph;   // morph factor
    18.         }// ClothingStruct
    19.  
    20.     public struct raceStruct
    21.         {
    22.         public string race;                          // race of this avatar
    23.         public genderStruct sex[MAXGENDERS];         // sex of this avatar
    24.         public BodyStruct iBody[MAXMORPHS];          // morphs to create this avatar
    25.         public ClothingStruct clothing[MAXCLOTHING]; // clothes this avatar wears
    26.         }// raceStruct
    27.  
    gives this error:

    Assets/UMA/UMA_Project/Scripts/UMACustomization.cs(238,35): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
    Assets/UMA/UMA_Project/Scripts/UMACustomization.cs(238,35): error CS1663: `UMACustomization.jobStruct.sex': Fixed size buffers type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double

    I'm not sure of the problem. I last coded extensively is 1998. Seems it doesn't like nested structs and/or a string since the strings can be variable length.

    If someone know an easy way to fix those structures for C# I'd appreaciate. Otherwise it will take me a few hours to figure out (one of those not so famous monkeys at a henpecked keyboard). Maybe I need to redef string decl to be a sufficiently large char array.

    ???
     
  14. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    MAXMORPHS is the indices into Fernanado's DNA structures (don't know why I didn't name dna instead of morph it's shorter and makes connection more obvious, I'll rename later):

    e.g.
    Code (csharp):
    1.  
    2. umaDna.height=sliderControlList[0].actualValue;
    3. umaDna.headSize=sliderControlList[1].actualValue;
    4. umaDna.headWidth=sliderControlList[43].actualValue;
    5.  
    When I'm done you can simply create multiple 1-dim arrays of floats and adjust the DNA value at the top of the code for different races. I'll have 2 simple arrays commented for each dna value of races...

    but not it's late so I'm going to sleep. Goodnight. Told you I wasn't a real coder anymore ;-)


    hmmm, sorry, I think I'll change:
    Code (csharp):
    1.  
    2.     public struct raceStruct
    3.         {
    4.         public string race;                          // race of this avatar
    5.         public genderStruct sex[MAXGENDERS];         // sex of this avatar
    6.         public BodyStruct iBody[MAXMORPHS];          // morphs to create this avatar
    7.         public ClothingStruct clothing[MAXCLOTHING]; // clothes this avatar wears
    8.         }// raceStruct
    9.  
    Code (csharp):
    1.  
    2.     public struct genderStruct
    3.         {
    4.         public string gender; // allow a sex to be chosen
    5.         }// genderStruct
    6.  
    7.     private genderStruct[] sex = new genderStruct[MAXGENDERS];
    8.  
    9.     public struct BodyStruct
    10.         {
    11.         public string[] part = new string[MAXDNA]; // morphable body part
    12.         public float[] dna   = new float[MAXDNA];  // scale for the body part
    13.         }// BodyStruct
    14.  
    15.     private BodyStruct[] iBody = new BodyStruct[MAXRACES];   // currently 51 morphable body parts when
    16.                                                                                                      // hair, hair color, eye color,  eye color
    17.                                                                                                      // are counted
    18.  
    19.     public struct clothingStruct
    20.         {
    21.         public string[] part  = new string[MAXCLOTHING]; // clothing type
    22.         public string[] color = new string[MAXCLOTHING]; // clothing color
    23.         public float[] morph  = new float[MAXCLOTHING];  // morph factor
    24.         }// ClothingStruct
    25.  
    26.     private clothingStruct[] clothing = new clothingStruct[MAXRACES];   // list of jobs
    27.  
    28.     public struct raceStruct
    29.         {
    30.         public string race;  // race of this avatar
    31.         public string sex;   // sex of this avatar
    32.         public int iBody;    // index to dna to create this avatar, i.e MAXRACES index
    33.         public int clothing; // index to clothes this avatar wears, i.e. MAXRACES index
    34.         }// raceStruct
    35.  
    36.     private raceStruct[] jobs = new raceStruct[MAXRACES];   // list of jobs
    37.  
    And initialize as indices to point to external arrays with the proper values.

    If anyone wants to volunteer a proper C# solution to these structures feel free. Thanks.
     
    Last edited: Nov 3, 2013
  15. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Hey mikezenox:

    I have gotten around my lack of C# expertise and have got the basic look of the GUI down so you can decide if you like to wait. I want to finish by Tuesday evening.

    What I have remaining:

    1. Update UMACustomization.Update() to use Unity UI Sliders and not the prefab Slider function (TransferValues/ReceiveValues/isDirty)

    2. Figure out how eye / hair / skin color is updated add that to the race data structure represent on the UI.

    3. Figure out how to change the hair and add that to the race data structure.

    4. Figure out how to change the clothes and add that to the race data structure represent on the UI.

    5. Individually place more than one avatar on the viewport at a time.

    6. Because the DNA morph values will be different between males females each DNA morph value array will need a male female version between each race. Races vary quite a bit within so customizations to the prototype I want to name, save, restore (but maybe this part comes after Tuesday).

    7. I want to limit the precision to 4 always print with precision 4 on the sliders.

    After I get the Update function updated I will post the scripts here (2 will change) you can help test while I do the hair, color, clothes if you like.

    Ciao


    $UMAUI.png

    I wonder is she's just clumsy or she just can't keep her hands off me?

    $UMAUI.png
     
    Last edited: Nov 3, 2013
  16. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Amazing results =D
    Would you like to enter skype beta test group? There are other guys working on similar situations. Just PM me with your skype ID.
    Cheers!
     
  17. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Hey Fernando,

    OK. But if I'm actually there depend on the time of your meeting. I need to install Skype...

    Ciao

    MikeZenox:

    This is not done yet (only one random char at a time but you can adjust 'shapes' as you like for a default male/female of the races) but if you want to create DNA Morph 'Race' templates while I try finish the code the data structure looks like this:

    Code (csharp):
    1.  
    2.     float[] raceOrcFemaleDNA = new float[MAXDNA]
    3.         {
    4.         /* Height */         0.500f, /* Head Size*/      0.500f, /* Neck Size */     0.500f,
    5.         /* Arm Length */     0.500f, /* Hand Size */     0.500f, /* Foot Size */     0.500f,
    6.         /* Bandy Legs */     0.500f, /* Upper Muscle */  0.500f, /* Lower Muscle */  0.500f,
    7.         /* Upper Weight */   0.500f, /* Lower Weight */  0.500f, /* Leg Size */      0.500f,
    8.         /* Ear Size */       0.500f, /* Ear Height */    0.500f, /* Ear Angle */     0.500f,
    9.         /* Nose Size */      0.500f, /* Nose Curve */    0.500f, /* Nose Breadth */  0.500f,
    10.         /* Nose Slope */     0.500f, /* Nose Height */   0.500f, /* Nose Sharp */    0.500f,
    11.         /* Nose Flat */      0.500f, /* Chin Size */     0.500f, /* Chin Sharp */    0.500f,
    12.         /* Chin Height */    0.500f, /* Jaw Jut */       0.500f, /* Jaw Size */      0.500f,
    13.         /* Jaw Height */     0.500f, /* Cheek Size */    0.500f, /* Cheek Height */  0.500f,
    14.         /* Cheek Breadth */  0.500f, /* Cheek Drawn */   0.500f, /* Forehead Size */ 0.500f,
    15.         /* Forehead Depth */ 0.500f, /* Lips */          0.500f, /* Mouth */         0.500f,
    16.         /* Chest Size */     0.500f, /* Buttock Size */  0.500f, /* Arm Width */     0.500f,
    17.         /* Forearm Length */ 0.500f, /* Forearm Width */ 0.500f, /* Belly Size */    0.500f,
    18.         /* Waist Size */     0.500f, /* Head Breadth */  0.500f, /* Eye Size */      0.500f,
    19.         /* Eye Angle */      0.500f, /* Hair */          0.500f, /* Hair Color */    0.500f,
    20.         /* Eye Color */      0.500f, /* Skin Color */    0.500f
    21.         }; // Orc Female
    22.  
    Change how you like, record on paper, another window if you do this for each of the DNA Morph data types (HumanMale, HumanFemale, ElfMale, ElfFemale, OrcMale, OrcFemale) in the default shapes later after I finish changing UMACrowd I'll add the default colors, hair, cloths... will make for very good tests of the avators code...

    ...for now I still have a lot of work in UMACrowd

    I'm attaching the UMACustomization.cs the UMACrowd.cs scripts:

    1. In Unity -> Open in Explorer copy the original UMACustomization.cs / UMACrowd.cs to a safe folder
    2. Double click in Unity Editor on both the UMACrowd.cs / UMACustomization.cs to open in MonoDevelop / VS Studio
    A. Open the two attached files in WordPad / NotePad for each of the 2 files:
    I. 'select all' 'copy' in Word Pad / NotePad
    II. 'select all' 'paste' in the appropriate file in MonoDevelop / Visual Studio
    3. Save

    P.S. If something messes up the indices into the meshes such mess up you probably have to delete project make a new one with a new name. Although I've tested already somewhat...

    Good night for now.

    Ciao
     

    Attached Files:

    Last edited: Nov 4, 2013
  18. mikezenox

    mikezenox

    Joined:
    Oct 18, 2012
    Posts:
    55
    @goat, thanks, I have a pretty hectic work schedule but this is right in the direction I was planning to take so I've downloaded the scripts and plan to check it out. I'll be back with news of results asap.

    Side note, Importing UMA into a different project with both your scripts and the popular Character System asset went pretty smoothly and required very little coding.

    Ex:
    $Untitled.jpg
    (I'm having trouble with uploading an image to the unity forums for some reason)
    http://postimg.org/image/69mesjyrh/

    @FernandoRibeiro, I appreciate it very much and am interested in checking it out but I also do not use Skype. How does the channel work per say?
     
    Last edited: Nov 4, 2013
  19. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Glad she has strong hands.

    Don't worry about hurrying, as you see it will be easy, if tedious, to create structures to hold custom characters. I did send my Skype address to Fernando maybe others have more efficient or better ways than I have so far. I just started a couple of days ago.

    As I said I have much work to do on the UMACrowd to create the races. It is all random now, but I'll post the new scripts here if you check back every few days. Maybe I'll post them to the asset store but I'm not sure I want to support them long term, once they do what they do and give good examples it should be easy to modify new looks with the base Fernando has created.
     
  20. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    goat: Its a skype group, so you can just pop in anytime, no meetings or so.
    Great job on that menu! But seems a bit tedious to have it that detailed, a lot of clicking, i think it would be better to just separate in into maybe upper/lower body or something.
     
  21. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Good, don't have the name of the group yet, but I will have to see how you ask for questions exchange work.

    I did the details that way to save space and to concentrate on the area being edited. I want later add menu options to zoom in frontal and profile on the head and body to better see the effects of the sliders. It's mainly intended to load DNA presets easily which I haven't done the UMACrowd changes to enable yet.

    I agree somewhat. I think I will join the height, muscle, weight into one. Then the head, hair, forehead. But it will depend if I represent later with icons rather than words. I want to try to make international with no fuss. It's easy to rearrange now that I created a arrays consts with the name in them.

    +++++

    Haven't forgotten...but using I'm getting pummeled trying to figure out how to changed colors...

    View attachment 73484
     

    Attached Files:

    Last edited: Nov 6, 2013
  22. cynel

    cynel

    Joined:
    Apr 18, 2012
    Posts:
    734
    anyways are there any new Shapes Being worked on ?
     
  23. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
  24. cynel

    cynel

    Joined:
    Apr 18, 2012
    Posts:
    734
    hmm the nose looks a little more pointy to me and that Shirt looks new.
     
  25. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Hehehe =D Nose changes were done based on sliders :)
    This tshirt is also available on https://github.com/huika/UMA
    Cheers
     
  26. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    Hey Fernando,
    thanks for this amazing plugin, we're looking integrating it into our game, making it as a mainly feature :)
    I can't read the last 50 pages of this thread, but I have a quite simple question.
    I created a character using the demo scene, how can I save it to use it after in my game? I mean not only in real time, creating a prefab and use it.

    Thanks again,
    cAyou.
     
  27. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    I managed to create it when launching the runtime, by using the same code as the one behind the Save Tool.
    It's not persistent data, but I can work with it for now.

    Please, let me know if there is a way to create a real prefab with your character system, I'm still interested on it :)

    Edit: here is the code I made
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. [RequireComponent(typeof(UMAData))]
    6. public class ActivateUMAOnCharacter : MonoBehaviour {
    7.    
    8.     public TextAsset textFile;
    9.     private UMAData umaData;
    10.     // Use this for initialization
    11.     void Start ()
    12.     {
    13.         umaData = GetComponent<UMAData>();
    14.        
    15.         if(textFile != null  !string.IsNullOrEmpty(textFile.text))
    16.         {
    17.             umaData.streamedUMA = textFile.text;
    18.             umaData.LoadFromMemoryStream();
    19.             umaData.Dirty(true, true, true);
    20.         }
    21.     }
    22. }
    23.  
     
    Last edited: Nov 10, 2013
  28. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Hi there!
    I won´t provide this out of the box: You need to save all atlas textures and create a prefab from avatar, also saving the resulting mesh.
    It´s also a good idea to bake the changes done to adjust bones into their pair bones, to reduce bone count.
    Cheers
     
  29. cAyouMontreal

    cAyouMontreal

    Joined:
    Jun 30, 2011
    Posts:
    315
    Alright, got it.
    If I add that, I'll post here ;)
     
  30. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Hey! Thanks =) That would be a great contribution to entire community : ))
     
  31. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Fernando will this character creation system work with ragdoll system for characters?
     
  32. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Sure, just be sure to set the colliders/joints to the parent bones and not the adjust bones themselves, or you´re gonna get some weird results hehehe =D
     
  33. alexaclaire11

    alexaclaire11

    Joined:
    Nov 11, 2013
    Posts:
    1
    Thanks!!!!!!!! this thread is really grt..........
     
  34. cynel

    cynel

    Joined:
    Apr 18, 2012
    Posts:
    734
    Well with 4.3 going Public im thinking this would have to be made to work with the new update.
     
  35. DrHeinous

    DrHeinous

    Joined:
    Jun 25, 2013
    Posts:
    19
    Yeah, it seems to break UMAGenerator.cs 171

    animator.GotoState(i, snapshot.stateTime, snapshot.stateHash);

    with

    Error CS1061: 'UnityEngine.Animator' does not contain a definition for 'GotoState' and no extension method 'GotoState' accepting a first argument of type 'UnityEngine.Animator' could be found (are you missing a using directive or an assembly reference?) (CS1061) (Assembly-CSharp)


    Clearly something has changed in the animator, no surprise I suppose.
     
  36. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    640
    If you comment out that line it will still work but the animations will get reset when you move the sliders in the test scene. Or you can get the newest version from github which has the fix - https://github.com/huika/UMA
     
  37. cynel

    cynel

    Joined:
    Apr 18, 2012
    Posts:
    734
    so now what?
     
  38. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Well, I'm not sure. I'm waiting for my bout of A.D.D. to end to finish what I was working on, I'm not sure of your progress on your plans to use UMA, and I think Fernando's close to releasing...maybe the female mesh needs a pig nose though...

    I see Fernando's moved SliderControl.cs HUDFPS.cs to the Example folder so that's a good way for any of us to contribute to Fernando's efforts 'harmlessly' without altering the main part of the code base. It's also something to keep in mind if you plan on selling to the asset store. No offense, but Fernando and Unlogick have expertise that you I don't: it just makes it easier for us to contribute where we can.

    For those interested and don't have the patience to wait for me I've attached my scripts but they aren't much changed since last week as I haven't worked on them. I've limited the number of avatars to 9 because of my computer and rearranged the menus to make a separate section for color. Tomorrow I will use some flesh, hair, eye color swatches I 'googled' for Gimp to finish the colors over the weekend. Hopefully changing out clothes and also ear noses (for 'Orc' and 'Elf' races) and then finally saving characters for later templates and editing...but you've seen I won't work when I go 'A.D.D.' (for lack of better terminology...sorry I'll try to get something serviceable eventually).


    Bizarre...it won't let me upload umaCustomization because it's too 'big'...yes I am one of those verbose obvious coders...but that's the nature of UI code too so here it is below....sorry.

    ...forget in-lining too long numbers get copied. I'll try zip file...these files once unzipped copy them into the UMA-master\Assets\UMA\Example\Scripts folder...
     

    Attached Files:

    Last edited: Nov 15, 2013
  39. mikezenox

    mikezenox

    Joined:
    Oct 18, 2012
    Posts:
    55
    I managed to finish a few races but realized a few of the sliders weren't affecting, and to how subjective it all is to ones opinion. I can ses the finished work sometime in the future if your still interested, goat.
     
  40. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Hey guys, I´m finishing the UMA C# DLL for AssetStore, I will probably send it to Caitlyn early next week. =)
    Cheers!
     
  41. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Ohh btw, you might want to see this:


    It´s my first test with high detail scan and IBL.
     
  42. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Sure, I'd be interested in your code. For the sliders I've made the hair and colors so far have no effect. Other sliders have effects because they are direct from the example code but can be subtle, like the forehead.

    For my purposes, 'Races' in the UI are humanoid variants using Fernando's Humanoid Male and Female base meshes. For me an Elf will be a Humanoid mesh with 'Elf' ears and an Orc will be a Humanoid mesh with a 'Pig' nose.

    But for Fernando's and technical purposes, 'Race' is more like 'Species' or really it's just a term to describe using a base mesh other than his Male or Female Human Base mesh. Given that those meshes are so flexible, it's likely new meshes will be for different species of life more so than for races of a specific species.

    I am about to start work on colors today. Ciao.
     
    Last edited: Nov 15, 2013
  43. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    So everything but what's in the Example folder will be a DLL? Will that make it faster? Scan looks excellent.
     
  44. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    It wont be faster, but you dont have to recompile the code everytime you change something.
    Also its a little bit easier to manage with fewer files.
     
  45. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    And safer to work on, if you´re not an experienced programmer. Using the DLL, it´s clear what is UMA core code and the part that is expected to be customized.
    Also, important to say this is a C# DLL, so there´s no need for PRO.
     
  46. cynel

    cynel

    Joined:
    Apr 18, 2012
    Posts:
    734
    things are shaping up very well.
     
  47. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Oh, I hope I am understanding that correctly. :)
     
  48. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    But keep in mind the full source code will aways be available at https://github.com/huika/
     
  49. reset

    reset

    Joined:
    May 22, 2009
    Posts:
    393
    Wow!! Love the scan work. Looking great.

    Can you please tell me what sorta road map you are working to? What do you plan for the near future of UMA?

    Is skinning something you are working on for the project?
     
  50. mateodon

    mateodon

    Joined:
    Oct 1, 2013
    Posts:
    39
    Arm models?

    Would it be possible to generate just the the arms and hands of a character to be used in a first person perspective?
     
Thread Status:
Not open for further replies.