Menu

Daz to Unity : Exporting Daz3D Models or Characters into Unity for Animation

June 1, 2016 - Daz Studio, Unity
Daz to Unity : Exporting Daz3D Models or Characters into Unity for Animation

This is a tutorial showing how to get Daz3D models into Unity for the purpose of animation as I have been asked a few times about how I do it in my projects.

I’m currently using the most up to date versions of both programs, but I’ve had it working like this for a few generations of each program.

So here I am using Daz Studio 4.9 and Unity 5.3.4f1.

First load up a model in Daz and clothe her/him as you like. Remember that more complex clothes generally mean more polygons – so that’s a consideration for working in Unity. A standalone character will be fine on most PCs. I’ve had characters with many hundreds of thousands of polygons running on my 6 Core i7 and GTX970 and also on lower specs. But if you want a terrain and some sort of world, you might need to go lower.

When I first started this I was using Victoria 4.2 as she’s quite low in polygons. Over a few years I have also used Genesis 2 models, but now I feel Genesis 3 is the way to go.

Daz also make a Decimator for Daz Studio which can reduce the number of polygons quite well and still keep a good shape. I won’t go into that here though.

OK so I have a character here… this is a Genesis 3 model.

Shot 1

Note that hair can be troublesome. Some will look okay in Unity and others won’t. This one is Fashion Hair for Genesis 2 which I fitted to Genesis 3. Also hair can be incredibly costly in terms of polygons, so note that.

Leave the model in the T-Pose and in Daz Studio go to Export. When the file dialog opens choose to export as FBX – then enter your filename as usual.

Here are my export settings.

Shot 2

Under Export Options the important things are ‘Figures’ & ‘Morphs’ – so tick those. Under Output Options I use FBX 2012 — Binary. And the settings under that will likely already be ticked, but you can compare mine to yours and make alterations if needs be.

The next thing here, is the morphs. You need certain morphs to control parts the body, for example the mouth shapes for lip-sync. I will concentrate on those.

Click the ‘Edit Morph Export Rules’ button.

You can add expressions here that will cause morphs to export if they match the pattern. I won’t go into detail here, as you can find out more about that in the Daz docs and online.

Shot 3

But for the purpose of this tutorial, make sure you have the rules as I have set them up here. The ‘.CTRLVS’ pattern is the one that will grab the mouth shapes (Visemes) that you need for lip sync. And you can see from the Action segment that these should all be exported. These are what will appear in Unity under ‘Blendshapes’. In the future, at this stage, you will probably find other things you need or don’t need. What I have shown here is enough to get you going on things like lip-sync and blinking.

Now export her and you should find wherever you saved it, the FBX model and a sub folder with all the textures in it.

Shot 4

That’s all we need from Daz, so save your scene with the character if you wish, close Daz down and open up Unity.

Start a new Unity project, find help online if you need it. In a fresh project you won’t see much, but here we will do the importing. Click on the ‘Project’ tab in the bottom left and then the ‘Assets’ tab.

Shot 5

Now the easy bit, just drag your FBX model into the Assets folder pane. Wait a bit while Unity does it’s work.

You should then end up with a model, and a couple of folders that contain materials and textures. This has improved no end over the years, it used to be a chore to assign all the materials manually, but now they should already be set up.

Shot 6

Now lets rig the model. Click on the model (test in my screen shot) and you will see information in the ‘Inspector tab’ on the right.

Shot 7

Click on ‘Rig’…

Shot 8

Then in the ‘Animation Type’ drop down, choose Humanoid. You can also choose to optimise game objects here too… Click Apply.

Shot 9

Once Unity is ready click on the ‘Configure…’ button. This will bring up the rigging screen.

Shot 10

Now as Daz makes their models so well and Unity does a great job on their side, there is really nothing to do here but you can tweak bones and things here if you need to. I really can’t talk about this section in depth here, so on this occasion just have a browse around and see how things are lined up. When you are done just click on ‘Done’ in the inspector.

That’s it ! She is now rigged for animation. Again animation is a big subject. But now you should be able to attach an animation to her and she will animate – check out the Unity asset store for free and commercial animations. Let’s just see where the morphs are though (or as Unity call them ‘blendshapes’).

Drag your model into the scene. Navigate in the scene hierarchy to Genesis3Female.Shape (or whatever generation you used) – this is your main model, other things will be clothes and props. You should see something like this…

Shot 11

 

Notice I have highlighted Blendshapes in the Inspector. Ignore her eyes for the moment. If you open up the blendshapes branch you will see all those morphs we exported out of Daz Studio – play with those to see that they will affect the model. Here I have increased the OW mouth shape. It’s by controlling those in script that you can do things like lip sync.

Shot 12

But those eyes…. Well different models do different things. Basically Daz uses layers on top of the actual eyes to add things like eye moisture. We don’t really need these in Unity unless you want to write a shader for them. The quick fix is to make those extra layers transparent so that we see through to the base eye texture. Like I said, these eyes can vary.

So create a small transparent PNG image in your favourite graphics program – just a totally empty transparent image then bring that into Unity and apply that to the Albedo slot of the offending material. Then change the rendering Mode for that material to ‘Transparent’ and the Shader to ‘Standard (Specular setup)’. Repeat this for any interfering layers.

Shot 13

If all that last part makes no sense, then you need to have a quick look at the Unity docs about materials. Once you have done it a few times it becomes easy, honest.

For the eyelashes and hair, just set the Rendering Mode to ‘Fade’. Again these often need tinkering with. I forgot to set the hair to fade in my screen shot, but it will look a lot better when you do.

That’s the end of the tutorial, I hope it helps people in some way. It took me a long time to nail down this method and things often change, but I find with my projects this works quite well. Leave a comment or ask questions if there is something that needs expanding, but remember this is just about getting Daz figures into Unity not a tutorial about everything mentioned.

I have a thread going over on AiDreams about some of my work on this kind of thing if it is of any further interest.

Enjoy !

Rog.

(Visited 1,358 times, 1 visits today)
Share on FacebookShare on Google+Pin on PinterestShare on LinkedInShare on StumbleUponTweet about this on Twitter
Tags: ,

13 thoughts on “Daz to Unity : Exporting Daz3D Models or Characters into Unity for Animation

John

Great. Excellent technique but how do you deal with clothes poke through when characters bend. IN Unity, On characters like with dresses etc, if they bend their skin will poke through the clothes.

And what about if the character has a full body morph applied..the clothing the skin will go out of the clothes. Can you provide solutions for that?

Reply
    Rog

    Hi John. Nope I cannot provide a solution for that. I’ve only used clothes that pretty much follow the body and not dresses. Like I said above this is only a solution to get the models into Unity.

    Reply
    Rog

    You might find https://www.morph3d.com/ will make things easier for you than going from Daz to Unity as it’s designed specifically to get models into Unity.

    Reply
bill

Nice tutorial

Reply
khepti

Great tutorial, thanks

Reply
    admin

    Glad you liked it, thanks 🙂

    Reply
MrGrumblier

I must be doing something wrong. Exporting takes an extremely long time and the import into Unity locks up my machine and I end up having to hard boot. I think the issue is the morph export rules. I have quite a few expression packages and it looks like the head. is exporting ALL of them, not just the ones associated with my model. How can I refine which head morphs get included?

Reply
    admin

    Howdy. Yes that’s not unusual – it takes mine a while too with just the basic ones. I have not had that problem with Unity though, so it does sound like you hit a limit of some kind.

    The rules I gave above export the head morphs that match the pattern – which can be a lot. You could create rules just for certain morphs, but I don’t have a tutorial for that, and I’m off to bed now !

    Here’s what you need to be searching for though : https://www.google.com/search?q=daz%20studio%20morph%20export%20rules&rct=j

    You should find more details over on the Daz Forums – or just post a question over there. I know there are some docs *somewhere*. Post back if you get stuck and I’ll take a look in the morning.

    Good luck 🙂

    Reply
      MrGrumblier

      It was due to too many morphs. I did a backup of my library then just installed the packages I wanted to export and it worked perfectly. I’ve been using Daz for awhile now, but I’m literally just starting with Unity – this is actually pretty much the first thing I’ve tried with Unity. Thanks for your assistance and the very clear and concise tutorial.

      Reply
        admin

        Great, interesting that there seems to be a limit. I’m glad it helped, it’s quite complex at first and there’s things that can be done differently – like sometimes eyes look better if you use ‘fade’ for the shader instead of ‘transparent’. I just wanted to get the basic process down, so I am glad I have achieved that. Unity is a bit of a beast so good luck with your project 🙂

        Reply
Mac

Nice, i was looking for something completely different, but i read the entire post, and it was kind of funny. This is exactly the way i figured it out in the beginning, right down to the transparent png. I’m just trying to see if i can export a single frame, and apply it to my characters pose in Unity via fbx.

Reply
    admin

    Not sure about that, I was using animations that were designed for Unity – I haven’t tried poses from Daz. Now that Unity has been updated and Daz have their new Genesis 8 models this will need a revisit I think. I believe they changed the eyes again. Thanks for popping in 🙂

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *