blog games developers portfolio gallery

More in this category:

From Daz3D model to Unity3D GameObject

For this example, I created a basic Daz3D model with some default clothes.
Default Daz3D model.

Daz3d export panel.
Next I selected File - Export and Autodesk FBX. This window pops up:
I selected Merge Clothing into Figure Skeleton because I want to end up with 1 skeleton and several skinned meshes on that skeleton.

I closed Daz3D, opened Unity and dropped the FBX file on the Unity project. It takes a while since this is a big mesh. I got a warning about the meshes being too big, but Unity splits it up for me, so no worries here.
This is because Unity has a build in maximum of 64K vertices.
Daz3d import warning.

First thing you notice is that she looks scary. Her eyes are white, her hair has no transparency and the sleeves are not rendered double sided. It is also insanely big. A total of 126K vertices, 215K triangles and 52 submeshes.
Daz3D imported.

When I look at the hierarchy, it has several skinned meshes for the body and clothes, all linked to the skeleton. It's important that there is only 1 skeleton. If you have a skinned mesh with its own skeleton, you have probably forgotten to fit the object to the model in Daz3D.

But the good thing is, that we've got something inside Unity now that we can work with. And with the help of SimpleLOD we're going to turn this into a usable game object.

Fixing shaders

Let's deal with the simple bits first: I fixed the hair by using a very good hair shader from the Asset Store (Advanced Hair Shader Pack) and the sleeves with a basic DoubleSided shader.
Daz3D Hair and sleeves fixed.

Fixing eyes

The problem with the eyes is that there are a few layers laid over the original eyes. So I select the game object that holds the body mesh and open SimpleLOD and then go to "Remove a submesh".

It shows a list of all submeshes and I select the "EyeReflection", 'Tear" and "Cornea" submeshes. In my case I have applied custom blue eyes in Daz3D and this results in 4 submeshes: The original 'VSBreeEyes" and 3 "VSBreeEyes2M" submeshes. Those 3 are for the white, blue and black of the eyes. So in my case the "VSBreeEyes" can go as well.

When I click 'Bake new mesh", the submeshes get deleted and the girl looks a bit less like a zombie.
Daz3D correcting eyes.

Merging submeshes

Daz3D many submeshes in inspector.
Looking at the body submesh in the editor, you can see that it exists of quite a few submeshes and some of them even use the same materials. That's a waste of draw calls if you ask me and it makes everything more complex than necessary.

To clear this up, I selected the first child object and merged it's submeshes together, then moved on to the 2nd child gameobject , etc.
I got new gameObjects called Genesis2Female.Shape_Merged etc. and the old ones were automatically deactivated.
Daz3D hierarchy.

Theoretically I could also have merged everything together in 1 go, but the total number of vertices is 124K and that is more than Unity's limit of 64K. SimpleLOD would fix this by splitting up the mesh in 2 parts, but that is not what I want. This is to be a relatively efficient game character and I'd like to have the total nr of vertices below 64K.

Removing hidden triangles

Let's see if we can reduce those vertices a bit by removing the triangles and vertices that are covered by her clothes. You won't see these anyway. We have to do this step by step. First the part of the legs that is underneath the trousers. I set the maximim distance to 100 millimeters, because the bottom section of the trousers is very wide.
Daz3D remove hidden triangles panel.

I do the same for the skin underneath the shirt, but with a distance of max 20 mm.

Unfortunately we are nowhere near 64K yet. The shirt alone is already 46K. The best way to bring everything down under 64K is by carefully decimating the meshes before we merge them. You can also do it by merging first and then decimating, but this way we have more control over the compression levels and their effects.

Decimating meshes

First the shirt. It has 46K vertices. I select a compression of 0.3 and for a better result I let SimpleLOD do this in 2 steps. I don't want any beads removed so I drag "remove small parts" back to 0.
Daz3d Decimating shirt.

We end up with 24K vertices instead of 46K. So that's not bad.

With the same compression level we decimate the pants from 13770 to 2847 vertices.
The hair goes from 35K to 15K.
The body itself gets a compression of 0.05

And then we are at 61K vertices!
So I merge the child meshes into 1 big skinned mesh and voila: 1 game character!
Daz3d 61K vertices.

baking atlases

The game character is looking ok, has under 64K vertices, but still has a lot of submeshes. We can change this by baking atlases. I open the "bake atlas window" and make the textures readable (by clicking the little buttons).
Daz3D atlases 1.

I'm going to make 3 atlases for:
- clothes
- hair
- body
To do this, I simply drag the various clothes parts together and do the same for the hair and the body.
Daz3D atlases 2.

I press "apply changes" and SimpleLOD now bakes new atlas textures and new meshes (because it has to change the UV coordinates to match the atlas) for me.
Daz3D atlases 3.

And....... I'm ready! I started with a mega complex object with 126 thousand vertices in 52 submeshes and I ended up with a workable game object with 61K vertices and 7 submeshes.
Daz3D ready.

And after manually editing the clothes texture a bit I removed the 2 submeshes for the beads as well.

follow us