Search Unity

Voxel based character customisation

Discussion in 'Scripting' started by BubyMB, Jan 19, 2018.

  1. BubyMB

    BubyMB

    Joined:
    Jun 6, 2016
    Posts:
    140
    Hey guys, Iv'e been wanting to tackle this problem but have never really thought of a good way to do it;
    I am making a voxel based game and want to implement character customization, I'm trying to imagine ways of approaching this but I cannot think of any.
    My first Idea was to have the base player model (just skin) and in customization just change the material colour.
    But then how exactly would i be able to add clothes on? Especially in a voxel environment how could I add clothes that mold with animation.
     
    Last edited: Jan 19, 2018
  2. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    To make a 3D model of a character, you have to make the mesh, make the skeleton, and then take every single vertex in the model and "weight" it to the bones so that the vertices in an area move the exact same way the bones do there. This is called "skinning" the model. Vertices in some areas will be 100% tied to the movement of a specific bone, but vertices in others may blend between several bones, allowing them to stretch further apart, or crunch closer together, to make smoother motions.

    Clothing, as a mesh, needs to be skinned to the same bones in the same way, preferably with as close to the same weights as the "skin" underneath them. Then, when you attach that closing to the model in the game, the clothes actually move with the animations independently, but in sync, with the rest of the body. If you turned the body off, you would just see the clothes moving as if there was still a body.

    You can also do clothes as just a texture. In these cases, you make the 3D model of the character, you skin it, and you give it proper UVs (how the texture is stretched over it), then just paint the model's texture in different ways (in something like 3DCoat or Substance Painter no doubt) for different clothing, saving each out as its own texture set, and just swapping texture sets when needed. You could also make meshes for the clothing and "bake" that down onto the model, so it's like a picture overlay of a shirt on the character's skin.

    Now, the difference between skinned meshes and characters in a voxel game? It depends on what you want the characters to look like, and move like, but chances are its going to be a skinned mesh even if it looks really simple. You can build your character in pieces, then just swap out those pieces as needed, but they'll still need to be attached to and move along with the same skeleton. Making a character isn't really trivial.

    Look into UMA (Unity Multipurpose Avatar) if you want a really good system for managing your character "pieces"- can merge them all into one optimized mesh, handle wardrobe options, etc, but it can be a bit complicated to figure out. Other options may exist on the UAS if you just want to purchase a ready-made solution.
     
  3. BubyMB

    BubyMB

    Joined:
    Jun 6, 2016
    Posts:
    140
    @Lynsander Thanks for the info, am pretty new to modelling. will do some research on the topic.
    *Mod can you move this to modelling or appropriate thread