Daz Studio to Unreal Engine 4 (via Blender)
I’ve seen several requests on these forums asking how to bring characters from Daz Studio into Unreal Engine 4. I’ve got a pretty decent workflow for doing this so I thought I’d type it up for anyone who might be interested.
Before I get started, though, I want to make a few points. A lot of people new to game development look at a tool like Daz and think it will allow them to cheaply get good results without paying for an artist or becoming an artist themselves. That’s not exactly the case, for a number of reasons
Licensing: DAZ content is not licensed for redistribution in games. Just because you’ve bought a character, clothing, or props, doesn’t mean you can use them in your game. In order to use the content in a game, you have to specifically get a license designed for game dev. You can buy a license on the DAZ store that will let you use their base content. It’s currently $500 if you or your company make less than $100,000 per year, otherwise it’s $2,000 (these licenses do sometimes go on sale, so worth keeping an eye on if you’re interested). There’s a catch, though. That license doesn’t cover the vast majority of the content that DAZ sells on their store. Most of figures, outfits, and accessories are actually created by third parties, and you have to license separately from each third party whose content you use. Some of the content creators offer licenses right on the DAZ store using the same exact pricing model ($500/$2,000), though many do not, and you have to contact those creators individually to negotiate a license. So, looking at a cost estimate: if you build a character with content from three content creators in addition to the DAZ base content, you’re looking at $2,000 or $8,000 (depending on your current revenue) to license the content. You might be better off spending that money to hire a freelancer, which would give you a game-ready model that’s exactly what you want and tailored to your game and target hardware.
Topology: The models aren’t designed for games. The edge loops are very different than what you typically find in game models and there’s a lot of stuff going on under the hood in DAZ Studio to make sure, for example, that bent limbs look right. The models look fine in the game engine, but can be a challenge to work with and tend to be on the high poly side.
Process: It’s far from a one-button export to get something from Daz into UE4. Even the simplest, most straightforward path takes time and effort, and if you want your models to look good, you have to invest even more time. It’s less time than creating a character from scratch, but a lot more time and effort than most people assume.
That all being said, DAZ models can be a good option for some situations, and they’re a great tool for knocking out prototypes and proof-of-concepts that won’t be released, so I thought it was worth typing this up.
Tools Used in this Tutorial:
This tutorial uses the following tools:
Click on images for full-size version.
Build the Character
Start by assembling the character you want to use in DAZ Studio. I’m not going to cover that part of the process, but it’s pretty self-explanatory and there are plenty of existing tutorials out there on the subject. If you’re planning to use the model in an actual game that will be publicly released (even if you plan to release it for free), make a note of every piece of content you use when creating the character so that you can secure the appropriate licensing before you release for your game. For demonstration purposes, I quickly threw together this character:
This character uses assets from DAZ3D (base content, hair), P3Design (character and texture), and 3D Universe (clothing). Unfortunately, neither P3Design nor 3DUniverse offer a game developer license on the DAZ Store, so that means if I wanted to release a game with this character, I’d have to try and find contact information for both of these content creators and individually negotiate a license – if they’re willing to. Good thing I’m not going to release this, because that sounds like a pain.
Make sure you’ve saved the character in a DAZ Studio scene then export the model using Collada. Going from DAZ to Blender, Collada gives (by far) the best and most predictable results. Here are the export settings I use:
Export the Character
It’s important that the “Merge Skeletons” option is NOT selected. It has a tendency to screw up the rig, sometimes very badly. I also haven’t had great luck with the “Merge Diffuse and Alpha” option, so typically avoid using that and do the merge manually in Blender. Once the export is finished, go to the Scene pane in DAZ Studio, expand the little disclosure triangle next to your model. Select all of the items (clothing, hair, props, etc.) except the base model. These should all be children of your base model though, depending on your settings and the version of DAZ Studio, it’s possible they won’t be. Either way, select everything except the actual body.
Make and Export the Base Character
We’re going to export just the naked base model by itself. Remember how we didn’t use the “merge” skeletons option before? Even without that option, DAZ often does some funny things when exporting multiple objects in a single file like I’ve done here. The model we exported is going to have multiple rigs with different combinations of bones. Sometimes the scales on the different rigs won’t match. Exporting the base model will give us a working base armature with no problems. With everything except the base body selected in the Scene pane, just tap the delete key to get rid of them. You’ll be left with a bald naked figure, which is exactly what you want… um… as weird as that sounds.
Export the naked figure using the exact same settings you used to export the full figure. Make sure to select a different name. I also typically save a second DAZ Studio scene with the base character, in case I need to come back and re-export, or if I want to come back and create morph targets.
Gather the Maps
DAZ Studio’s exporters only export the diffuse and alpha map. Most models actually have a number of other maps, often including specular (or gloss), bump, normal, and SSS. You’re going to want all the maps that are available when it comes time to build your shaders in UE4. The way I find them all is to simply search my DAZ 3D directory for the filenames that were actually exported. For example, the face diffuse map that was exported for this character is called
P3DMariaFace_1001.jpg. Searching for that in my DAZ 3D directory, I find a directory containing all the maps for that character. This particular model comes with diffuse, specular, bump, normal, and SSS maps. Many models will have additional diffuse maps, as well (for, e.g., different color eyes or different makeup options). Not all objects will have every kind of map. All the maps for a single object will usually be in a single folder, so don’t spend time looking for missing maps once you’ve found its texture folder. I copy all these extra files over to the same folder where I exported my character, in a subfolder called “Extra Maps”, so they’ll be readily available from Blender and UE4 (and so I won’t accidentally overwrite the original). This process has to be repeated for every separate object in the original export. If you’ve applied any options like makeup or tattoos or if you’ve mixed and matched features from different characters (e.g. base texture from one character, eyes from another), you may have to do additional searching to find all the maps.
Over to Blender
At this point, we have all we need from DAZ Studio to get a character over to UE4, so you can shut it down and fire up Blender. Make sure you’ve got Lui’s tools and both of my addons installed in your addons folder and turned on in settings. Before we import anything, select the UE4Tools tab, click “Scene Tools”, and select “Set UE4 Scale”. This will set up Blender so that we can export to UE4 with no scale issues.
Import the Base Character
From the File menu, select “Import”, then “Collada (.dae)”. Navigate to the folder where you exported the files earlier, but don’t import anything yet. Before you import, look in the lower left, at the Import COLLADA options. Make sure “Import Units”, “Find Bone Chains” and “Auto Connect” are all selected. The last option, “Keep Bind Info” isn’t strictly needed, but I usually select it, as it preserves some metadata that will be included if you ever export back out to COLLADA. It doesn’t hurt anything and doesn’t add much to the file size, so I usually use it. If you’re running 2.78c (or earlier) and don’t see the “Keep Bind Info” option, don’t worry about it - I only started noticing it recently. It may be a new 2.79 feature and, like I said, we don’t really need it.
Once you’ve set your import options, select the base character you exported earlier – the naked one – then hit the “Import Collada” button. It should open up in Blender looking something like this:
Right-click on one of the armature bones to select just the armature. Find the properties panel and select the Object tab (box icon) and change the name of the armature object to “Armature”. UE4 4.16 and later will automatically remove the additional root bone that Blender adds if you name your armature “Armature”.
Now click on the Armature tab (stick figure icon) and change the name of the Armature itself also to “Armature”. I also like to change the armature type to “Stick” and turn on X-ray.
Now your imported figure will look something like this:
Right-click the mesh to select the body instead of the armature. You probably want to give the mesh a unique name rather than the default name of Genesis3SkinInstance, which you can do on the Object (box icon) and Data (triangle icon) tabs. Next, on the Data tab (triangle icon), find the UV Maps section, and double-click Genesis3Female-geom-uvs-array and rename it to UVMap. By default, every object that comes in from DAZ Studio comes in with a unique UVMap name. We need to make sure they all have the same name before we export. This will allow us to join or separate objects without inadvertently creating multiple UVMaps on an object. If two objects are joined and have UVMaps with the same name, it will merge them. Otherwise, it will create separate maps, which can be a pain to deal with and can cause problems once we get into Unreal.
On the Properties Shelf on the right side of the 3D view (press N-key with cursor over the 3D view if it’s not showing), find the Material Tools button. These buttons from my Material Tools add-on above, so if they don’t show up, make sure they’re installed and turned on under preferences. With the body mesh still selected, press each of the Material Tools buttons once. This will do some of the necessary configuration on the imported materials for us and will make sure we don’t have any materials we don’t need. While you’re here, also look for the “View” section on the Properties shelf, and under that “Clip:”. Set the End plane to a smaller amount - maybe 20m to avoid see-through geometry.
Now, go to the Materials tab of the Properties pane. DAZ characters come in with several materials. These materials only have diffuse and alpha maps, and the alpha isn’t configured correctly. Transparent materials aren’t configured correctly either. Let’s fix that. First, select the eye lash material (probably called “Eyelashes”, but can be something different). Switch to the texture tab (checkerboard icon) and make sure the texture is selected. Expand the “Image Sampling” section and click on “Calculate” under “Alpha:”. To make sure it worked, click the “Show Alpha” checkbox under the preview. While you’re here, find the Mapping section and select “UVMap” for the Map: combo box. You’ll want to do that for every material. It’s not strictly needed as long as there’s only one UVMap per object, but it’s safest to explicitly specify which map it should be using.
I usually get rid of the DAZ eyeballs and replace them with the UE4 eyeball from the Content Samples project, but for this first tutorial I’ll stick with using the DAZ ones. Go back to the Materials tab and find a material named “EyeMoisture”, “EyeTransparency” or some similar name. It should be a pure white material right now. If it’s not blank white, it’s not the right material. Once selected, go down under Transparency. Make sure Transparency is checked, change Transparency type to Raytrace, and change Alpha to 0.0 and IOR (which stands for Index of Refraction) to 1.33.
Now, look for an eye material. It might be called “Cornea” or “Eyes” or “Pupils”. If there’s more than one, look for one that has two textures, one of which looks like two white dots on a black background (or vice versa). This is a transparency mask that we’re not going to use. Delete this texture. There may also be a reflection texture on this material, especially if it’s an older character. If there is, delete that texture too. Go back to the Material tab and set “Transparency” to unchecked. Hit the tab key to go into edit mode, and from the material tab of the properties view, with the eye material still selected, hit the select button to select all the eye faces. Hit Shift-H to hide the rest of the geometry. Now, select the following faces (you can switch to face selection mode using control-tab) and assign them to the EyeMoisture or EyeTransparency material.
Press Alt-H to bring back the hidden geometry, press A to unselect all faces, and press tab to get out of edit mode. At this point, your model should look mostly right in Blender if you go to materials mode or Render mode.
We have a couple of choices at this point. We could set up the materials fully in Blender, or we can leave them as-is and then import the extra maps directly into UE4 and create our materials there. Another option is to use Blender’s baking functionality to combine several of the maps (all the skin ones) into a single map, combining the diffuse and alpha into a single texture. This makes the character easier to work with in UE4 and also gives you the ability to easily make texture edits in ZBrush. These are all more advanced topics, though. I may cover them in a future addendum but, for now, let’s keep it simple. We’re going to keep these materials like they are in Blender and later, we’ll use the extra maps we got to make the materials look right in UE4.
But we’re not ready to export to UE4, unless what you need a bald naked character, so let’s pull in the clothing and hair.
Importing the rest of the Character
Switch to layer 1 (the default layer is layer 0) using the layer buttons at the bottom of the 3D view:
The model you were working on will disappear - don’t wory, it’s still there, just on a layer that’s no longer visible. From the File menu, select Import->Collada(.dae) again. Using the same settings, import the full character you exported earlier, the one with clothes and hair. Once it’s done importing, it’ll look something like this:
Right-click on the armature to select it. Make sure nothing else is selected, then hit X to delete it. Everything will drop to the floor. That’s okay. Now, right-click on the face to select the body mesh. We don’t need two bodies, so press X again to delete that. You’ll be left with the hair and clothes. Press A to select all, then press R to rotate, then press X, 9, 0 on the keyboard to rotate everything 90 degrees and back into the correct position. You can quickly eyeball to make sure they’re in the right position by shift-clicking the button for layer 0 to make it visible.
Usually everything will line up perfectly, but once in a while, especially with props, you may have to manually move the object to get it to line up.
Now, for each of the clothing, hair, or prop items, you need to do select them one at a time and do the following to each:
- Press each of the Material Tools buttons like we did earlier with the body.
- Change the name of the object’s UVMap to “UVMap” (make sure capitalization is the same every time)
- For each texture in each material, set the UVMap to “UVMap”
- Most props and clothing items won’t use transparency, but hair will, and sometimes clothing that includes lace or other similar materials may, as well. For those, you need to find the transparency texture in the material and click the “Calculate” checkbox under Alpha so that transparency works properly. Some objects will have more than one material, and you may have to fix the transparency under every one.
- With the object selected, shift-right-click the armature and hit ctrl-p. When the menu pops up, select “Armature Deform”.
- Optionally, feel free to change the object and/or data block name and material names to something that’s more descriptive.
Once you’ve completed these steps for every piece of clothing, hair, or prop, you should then be able to select the armature, press control-tab to go into pose mode, and pose the character. Using either material or render display mode should work now, though with a fairly simple shader that doesn’t show bump or specular or SSS.
Renaming the Bones
We want to rename our bones for two reasons. One, we want to match the UE4 skeleton as closely as possible so that we don’t have to manually specify which bones of the Epic skeleton retarget to which of our bones. We also want to conform to the Blender left/right naming convention so that we can use bone mirroring. I would suggest saving if you haven’t done so already.
The UE4 Bone Tool script you installed earlier should have added some buttons to your 3D View properties shelf:
Find the appropriate button for the model you’re using. This particular character I’m using for demonstration purposes is a Genesis 3 Female character, so I’ll right-click the armature, make sure it’s in object mode, then click the Genesis 3 Female to Epic Skeleton button. The script that runs will rename the bones and make some minor tweaks to the bone hierarchy so that it imports properly. If we turn on bone names, you can see that our bones now match the bone names of the Epic Skeleton, and bones that don’t exist in the Epic skeleton follow a similar naming convention for consistency.
With the armature selected, go into pose mode. We now need to pose the armature in the same pose as the Epic skeleton, or as close to it as we can. The Epic Skeleton defaults in an A pose while the DAZ models come over in a T-pose. I will often import a copy of the Epic mannequin into Blender as a guide while posing the model. Matching the position involves the following:
- Rotating clavicle down and back a bit
- Rotating rotating the arms down
- Bending the forearm a little on the local X-axis (select lowerarm_l or lowerarm_r in pose mode, then hit R-X-X to rotate on local X axis)
- Moving the legs a tiny bit apart
- Rotating the feet a bit inward.
- Tweaking the finger and hand positions
We’re unlikely to get the pose perfect the first time. We’ll likely have to try retargeting a couple of times, coming back to Blender to make minor tweaks to the pose. The fingers are where it can get tricky to match. I usually create a pose library and save the pose there to make sure I can get back to it if I accidentally reset the pose. You’ll also be able to import that pose into other blender files and apply to other characters imported from DAZ Studio.
One super useful trick - once the bones have been renamed, make your tweaks in pose mode to just the left or right-side bones, then select the bones you adjusted and (still on Pose mode) press Ctrl-C to copy the pose. Then invert the bone selection with Ctrl-I and press Ctrl-Shift-V to paste the mirrored bone positions.
Get Rid of Unneeded Geometry (Optional)
This step is not stricly needed, but is highly recommended. DAZ Studio layers clothing and props on top of the body, but if you’re not building a customizable clothing system, you don’t need any geometry you can’t see. The way game engines work, there’s a lot of work that gets done for every vertex in a model, even if ultimately, those vertices can’t be seen. Different types of occlusion can reduce the work, but there is quite a bit of work in the vertex shader that will always happen for all vertices of any visible objects. Since this character has clothes on, all the vertices that make up the body under the clothes are just creating extra work for no reason. So, best bet is to go into the model and delete the vertices that can’t posibly ever be seen in-game. Which vertices these are will depend on the type of camera used to view the character. For a third-person controller where the camera can be moved to many positions, you’ll need to leave more vertices than you would for a side scroller with a fixed camera position.
Here’s what the model might look like after getting rid of the geometry we don’t need:
Reducing Hair Complexity (Optional)
Daz Hair tends to be very, very dense. It’s not at all unusual for the hair mesh to have several times more vertices than the base mesh. Overall, DAZ hair isn’t really great for use in a game engine and typically, I wouldn’t use DAZ hair but, for this first tutorial, I wanted to keep things simple and stick with just DAZ meshes. For most purposes, we probably don’t need nearly as many vertices. We an probaly decimate most hairs down to 20% or less and not see a huge difference. It will depend on the hair. It also depends on whether the hair has any control bones. This hair does not, so it’s fairly simple. Decimation creates really bad topology for animating, so if your hair has bones, decimation is less of an option.
Exporting the Model
Once you’ve matched the Epic A-pose as closely as you can, it’s time to try exporting. For good measure, save what you’ve got. Press Ctrl-Tab to get out of pose mode, then select the armature and all of the meshes. From the File menu, select “Export” then “FBX (.fbx)”. Use these settings:
Import into UE4
In your UE4 project, press the “Import” button and select the FBX you just exported. Make sure it’s importing as a Skeletal Mesh, with “None” selected in the Skeletal Mesh field. Make sure “Use T0As Ref Pose” is checked. Make sure Normal Generation Method is set to Mikk T Space and that “Import Animations” is unchecked then hit the “Import” button. It may take a few seconds (or longer on some machines) to import it. You may get a warning about Influence count exceeding the max count. Don’t worry about this. This has to do with different limits between DAZ/Blender and UE4, but the skinning seems to work fine despite the difference.
It won’t look quite right because the imported materials only have diffuse. We’ll fix the materials later. Let’s first get get the pose and retargeting working before we worry about that.
Setting up Retargeting Options
Open up your imported model in Persona by double-clicking on it. Navigate to the Skeleton tab, and in the lower right corner of the Skeleton Tree, click the thing that says “All Bones, Active Sockets”. A menu will pop up. Select “Show Retargeting Options”. Click the root node of the tree, right-click, and select “Recursively Set Translation Retargeting Skeleton”. That will make it so that all nodes say “Skeleton” in the “Translation Retargeting” column. Change RootNode to “Animation”, and the pelvis bone to “Animation Scaled”.
Now lick the Retarget Manager button to bring up the Retargeting Manager. Click “Add New Retarget Source” and select your imported mesh. Down in the lower part, where it says “Select Rig”, select “Select Humanoid Rig”. All the bones should populate correctly except possibly the Root node, which you may have to manually point to RootNode. Save and close the Persona window.
Navigate to the Epic mannequin (usually in /Game/Content/Mannequin) and open it up in Persona. In the Retarget Manager, select Add New Retarget Source, select “SK_Mannequin”, and then select “Humanoid Rig” again. This time, the bones should all populate correctly. Save and close.
It’s now time to check our pose by retargeting. Find the animation blueprint for your project (/Game/Content/Mannequin/Animations in the third party template). Right-click on it and select “Retarget Anim Blueprints”. Select the imported mesh as your target, and select a different folder for output by using the “Change…” button in the lower right. I also like to change the name, so I’m going to have it replace “ThirdPerson” with “DazGirl” so that I can tell the animations apart. Click the Retarget button and it will retarget the entire animation blueprint and any animations it relies on.
Open up one of the animations (idle, walk, or run are good choices). We an see that idle is mostly correct, but not 100%. The shoulders are hunched a bit, the hands are in odd poses, and the arms are too far away from the body. There’s no silver bullet for this next part. We have to go back to Blender and update the pose. Since the shoulders are too high, we have to lower them. Because the arms are too wide, we have to bring them in in our bind pose. Best bet is to make a few changes, then export again using the same name and file location, then right-click the skeletal mesh in UE4 and select “Reimport”.
After re-importing, do the re-targeting over from scratch, don’t rely on any change you see in the existing animations after the re-import.
To Be Continued…
This has ended up being a lot longer than I expected and I haven’t gotten to everything I wanted to get to. I’ll try to do additional installments in the coming weeks – if people are interested. Some things I can cover:
- Setting up materials in UE4 - Baking to a single Diffuse/Alpha map instead of using separate maps for head/torso/legs/eyes/mouth - Tweaking diffuse and bump map in ZBrush and generating new maps from those changes - Replacing eyes with the Epic character rendering eye
Corrections, suggestions for improvements are welcome, as are requests for future additions. I will try to also record accompanying video to go along with this, but I can’t promise I’ll have time to get to it and, if I do, it’ll probably take a little while to get to.
Thanks for reading!