Devlog 2: Making of a character editor (in ue4 blueprints)
Making of a character editor in ue4.24
At the end of april, I decided to start working on a new character editor. This one is not for the player but more for me, to design and test player and NPCs.
Before starting, my NPCs looked like that:
And the main character was like that:
The NPCs are ok depending of the game (you may have recognised the Synty packs), but I want my NPCs to talk and to show some facial expressions.
Now here is my current update of the main character using this editor:
In this article I will show how I made the character editor using Blender and Unreal Engine 4.24, only in Blueprints.
Presentation of the system
Character Editor, WIP from Osgynn on Vimeo.
Here is a video about the character editor.
Making of
1. Creating the base mesh and morphs in Blender
The first step was to think about how many parts I wanted the characters to have. It can depend of your inventory system if you want your player to change his clothes and equipement.
I decided to go with 6 different parts: Head, Hair, Hat, Top, Pants and Boots. Each of these can be switched to give thousands of possibilities (if you have 5 meshes for each part, that makes 5^6 => 15 625 combinations just for the meshes, imagine now with 100 morphs, different materials and colors and you have unlimitted possibilities)
I started by modeling the entire base mesh in blender, in one piece. No hair now, just the body including the head:
I then did UVs and texturing but I won't explain too much about that in here, then it was time to skin this base character to a skeleton.
I wanted to use the UE4 Mannequin skeleton, because it is then way easier to anim in UE4 when you follow the standards. For this, there are many possibilities, but I chose to go with the plugin autorig pro, which is great because it does an incredible job at auto skinning, gives a nice auto-rig to animate and exports directly to the ue4 mannequin in one click.
After an easy setup and a few adjustment I had the base character rigged:
Now that this was done, I started to work on morph targets, or shape keys as blender calls it. For this we need to go to the Object Data Properties, under the vertex groups, and add new shape keys with the + button.
Basis is the basic shape, then we start to add shapes for any edit we may need: basically, we think about the location and size of each face part like eyes, ears or nose, but also different shapes for each of them. I tried to reproduce shapes of stylized characters I found in popular games, movies and also on artstation to have different and interesting possibilities. We must often go with the extremes for the shapes to make sure we can do what we need later.
Editing a shape is just starting from basic shape and moving vertices. It can be done in edit and sculpt mode.
I created about 60 shapes for the face and 10 for the body. For the body, I just changed the muscles and fat but not the length or size of the bones. This, we will do in UE4.
After all the shape keys, I divided the mesh in 4: Head, Top, Pants and Boots. With the Autorig plugin, I exported each part with the UE4 Preset. We will see later the creation of clothes and hair but for now, let's go back to UE4.
2. Setting up the character and editor in UE4
In UE4, to have a character composed of several skeletal meshes, there are a few setups to make.
For this editor, I used a specially made character actor but we can use any character actor to do the same.
Basically, in this actor I added 5 skeletal mesh children to the main skeletal mesh for each part of the character:
Then, to setup the animation only to the parent and avoid duplicating unnecessary processes, I used "Set Master Pose Component" in the construction script of the actor. This makes the master skeletal mesh direct all targets as if there were connected. We can now switch any part of the mesh and the animation will stay the same.
We now have a character made of 6 parts.
After this, I setup a new level for the character editor. On this level, I set up an override game mode to have separate controls and mechanics:
In this game mode I set up controls and UMGs to show up on the editor. I also stored a couple of references to the character actor and the camera manager to access them easily later (we can get any variable stored inside a game mode class by simply doing a "Get Game Mode" then "Cast to ...."
In this character editor level, I added a few things:
- The character actor
- A camera manager actor ( containing a camera and positions, and managing the camera rotation around the player for the editor)
- Basic meshes setup
- A simple lighting setup ( in this case, I use celshading from a post process material so I just added the postprocess volume and a hard directional light, working for celshading)
- A wind source (used for testing clothing, as we'll see later)
3. Camera Control UMG
I started with a camera controls HUD to manage visual aspects of the editor, and toggling diverse settings.
I setup events for each buttons like changing the camera location, rotating it around center, toggling celshading, blinking, wind and animation...
4. Character Editor UMG
This is the big one. In this UMG I controlled all the morphs, meshes, materials and parameters of the character. This is actually a quite easy thing, but very time consuming. There are many ways of doing it, some ways more efficient, some with cleaner code or blueprint. I personally used an efficient yet not perfectly optimized way as my character editor will not be used for the players but for the designers, and it will not be shipped with the game.
There is much to say about this, but I'll try to keep it simple.
This interface is based on a big Widget Switcher on the right that contains about 15 Scroll Boxes. Each of these scroll boxes contains parameters about a certain category (like face, eyes, hair, clothing). I use the buttons on the top right to select which box will be displayed. Here by default we are on Face parameters.
Most parameters are sliders, and each of those is linked to a morph target on one of several meshes, here is an example:
I also have a material customization. For the skin and hair for example, I create a dynamic material instance and I set up colors and parameters from this UMG. I used this plugin to recreate my color picker:
I also used some buttons that select a preset of mesh, material or morphs.
For each category I also added a random and a reset button. These are quite easy to make. I use a max random value and it sets a different slider value for each morph target.
Appart from morphs and materials, I also used some bone modifications to have longer legs, arms, or bigger hands... For this the best solution I found was to use float values in the animation blueprint and edit bones directly inside the anim bp. It can be a bit heavy but it is the way I found to have it in a clean non baked way.
With all these parameters I achieved pretty extreme transformations and unique possibilities! :)
I can now make Smurfs.
5. Adding Hair and Clothing
I modeled a few haircuts in Blender but I still need a lot more to make it interesting. Haircuts are quite easy to do. You just model them on top of the head of the base character and skin them only to the head bone:
After exporting from Blender, I added hair physics inside of UE4. This is very easy ( the way I did it at least). I started by adjusting the hair's Physics Asset inside of the engine to have a capsule in the place of the head, then into the hair Skeletal Mesh, in Section Selection I added and applied a new clothing data, painted like this:
This makes the hair modes a bit when the character is running or with wind and adds a lot, in my opinion. We can do the same for clothing items as well.
About clothing, I now model each part in blender as a single object (usually starting from the base mesh).
Then there is a bit of a tricky part. To avoid reskinning each element from sratch, I use Data Transfer modifier in blender to get an auto-skin, and an addon called shape transfer to auto recreate shape keys (morphs), that most of times gives me good result, but I often have to rework some shapes.
These 2 tricks allow me to model quickly many clothes and applying them to my characters, whatever his size or weight.
6. Saving and loading character appearance
My use of the character editor is to be able to save the appearances to a datatable in UE4. I use json and this plugin to do so. We can also use savegames to store data or any variable in a blueprint. I made a struct corresponding to my needs for storing characters:
Clicking the save button gives me this struct and I can use it anywhere. Characters are not baked, but that allows me to save space on baked texture and mesh data if I have hundreds of NPCs, and to change characters dynamically. The only downside is I loose some performance by reloading the appearance each time, but it isn't that bad.
A few images to conclude :)
If you have ideas or questions, don't hesitate commenting below :)
Osgynn
Osgynn is a top down RPG with strategic turn based combat and exploration.
Status | In development |
Author | Osgynn |
Genre | Role Playing, Adventure |
Tags | 3D, Open World, Singleplayer, Strategy RPG, Top-Down, Top Down Adventure, Turn-Based Combat, Unreal Engine |
More posts
- Some Images of current stateJan 18, 2021
- Devlog 1: Modeling the terrain of OrisiaApr 28, 2020
Comments
Log in with itch.io to leave a comment.
Awesome job! Is this something I can purchase?
Thank you! It is not well made enough for me to sell this and it would need some updates, but you can follow the steps of this article to recreate a similar system according to your needs! :)
It's really interesting! Thanks for sharing your knowledge with us :)
Thank you for reading :)