Profile Picture

[CC3 to Unity] Scyra's Exotic Tricks and Traps

Posted By Scyra 5 Years Ago
Rated 5 stars based on 2 votes.
Author
Message
Scyra
Idea.png
Scyra
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)

Group: Forum Members
Last Active: 4 Years Ago
Posts: 220, Visits: 2.5K
26, December 2019 Update: Hair Shader mini-guide located here.

A Common Question: Why does my character look different in Unity?

https://forum.reallusion.com/uploads/images/2b1614c3-b30f-4e45-9691-37d9.png

Let's aim for Digital Human realism in Unity. To get there, first we'll start out by emulating the basic CC3 look.

https://forum.reallusion.com/uploads/images/7932e1d3-685f-4737-82a6-45a7.png

If we could then come close to the quality of Digital Humans within Unity, we'd be approaching industry standard graphics from inside our bedrooms. That'd be nice, right?

Replicating CC3 in Unity: Initial Setup

I made a scene that looks close to CC3's Default Stage. I use this scene to import, adjust, and test characters. Because the lighting setup is similar, it helps me to notice and adjust any material import discrepancies. I'll post instructions so you can make this scene if you'd like. You may find it to be like a crash course..

I am modifying the default SampleScene for a new 2019.2 project using 3D with Extras template. It is the same for HDRP. Here is an image guide for the initial scene setup you may find helpful to clarify the instructions below...

https://forum.reallusion.com/uploads/images/dcda97f1-4f8c-4a59-a31f-2922.png
  • Window > Package Manager > Update Post-processing (currently version 2.1.7)
  • Disable Gizmo Icons & Grid
  • In the Scene tab's menu bar, set the Scene View Camera Field of View to 40 & the Main Camera (Game View camera) to 26.99
  • Disable FXAA on the Main Camera. This type of anti-aliasing degrades quality and is worse than none at all. I have 4x Multi Sampling set in Project Settings > Quality — this setting takes effect when setting "No Anti-aliasing" in the Post Process Layer component.
  • In the Scene tab's menu bar, toggle all Scene View effects on: skybox, fog, and other effects.
  • In Hierarchy, expand ExampleAssets and disable Props, expand Workshop Set and disable everything except Ground, expand Reflection Probes and disable all except Reflection Probe Main.
  • Set Reflection Probe Main's Box Size to 300 for X, Y, & Z. This one proble will be used to cover a huge (empty) area.
  • Scale the Ground to 100 for X, Y, & Z, and disable its Mesh Renderer component. The character will be able to run for a good ways on invisible ground.
It is a good time to import the Character Creator and iClone Auto Setup Script for Unity it is not already in your project. Current version 1.01 is officially for 2019.1 but works with the latest 2019.2. The generated Editor folder can safely be placed inside the CC_Assets folder if you'd like.

CC3 to Unity Export — Traps!

Export a CC character with the proper settings. There are a few special settings you need to be aware of...

https://forum.reallusion.com/uploads/images/56157c2f-1fab-4c83-9742-a32d.png

The Mouth Open as Morph adds an important corrective BlendShape and is not enabled by default. It is also important to include the Current Pose (export in T-Pose or one of the default CC pose presets). The default CC poses received a corrective update, and if you fail to include Current Pose, this will happen when you go into Play Mode...

https://forum.reallusion.com/uploads/images/1a01eb02-567e-46e4-ad7a-c581.png

Shader Problems & Fixes

Remember to go into the Tools menu and disable Auto-Processing after import (and re-enable before next import). Characters imported into Unity will have clothing and hair transparency problems...

https://forum.reallusion.com/uploads/images/373bcec8-587e-4385-a45c-a51c.png

These are limitations with the aging Unity Standard Shader. It is a Unity problem and Reallusion cannot fix this. HDRP users will fare better because the new shader supports double-sided materials, which is the problem we see with the clothing. Because I am primarily working with non-HDRP at this time, I paid $5 for Azerilo's Double Sided Standard Material shader to fix the clothing problem. I tried a few free double-sided shaders and found that they did not support PBR, and looked bad as a result. The hair problem is more complicated and will be covered in the next post.

Note: I use non-HDRP because I bought many assets that do not support HDRP. Standard Unity with paid assets can still compete with and overperform HDRP at the moment, but eventually there will be mass movement to HDRP as it becomes standard...

Another problem you may notice is that the Smooth Mesh options: Tessellation & Subdivision, are lacking in Unity. Again this is a shader issue, and HDRP will have Tessellation, but I paid $10 for the Beast shader to solve the low poly breasts & butts issue in Unity...

https://forum.reallusion.com/uploads/images/592c8e07-9d6b-44dd-8cae-99b1.jpg

Or you could just put some clothes on instead...

You will need to use it at the same setting on all body materials: head, arms, legs & body, else you will end up with seams between parts. It causes the mesh to inflate and look more like it is over 100K polycount rather than the actual Creation Base's 30K; the same way Smooth Mesh setting works in CC3. This can cause pokethrough for clothing and the scalp/hair if you didn't design with Smooth Mesh enabled in CC3. So, if you want to Tessellate the body but not the clothes, you should reflect that in your Smooth Mesh setting while designing. Game Base should also benefit but the single-material version will likely have problems (unintended things like eyeballs & teeth inflating). Tessellation is used sparingly due to performance concerns. Because the head already has a good polycount, Tessellation will have very little effect on it.

Tessellation also fixes Transformer mesh topology issues like you see here around the neck and shoulders...

https://forum.reallusion.com/uploads/images/6dbaae97-f5c3-4641-b06c-3433.png

Replicating CC3 in Unity: Lighting Setup

In CC3, apply the _Default stage and save out the IBL...

https://forum.reallusion.com/uploads/images/36a25c9d-0f86-43a4-aea2-7cc7.png

If you currently have a Digital Human Shader project open, pay attention when you load the _Default Stage: It will look like the skin just lost some detail...but rotate the IBL (or just set the Z to 130) and see how the skin detail reappears. Keep that in mind when you are doing lighting in Unity; the angle that light hits your Normal maps has a significant effect on appearance.

Using CC3 IBL's in Unity gives you great lighting for minimal effort. Here is visual guide to accompany the instructions (last two steps below are not shown in picture)...

https://forum.reallusion.com/uploads/images/daba3957-4f95-4081-b7e6-a14c.png
  • Drag the CC3 HDR file into your Unity Assets (Projects) folder & set Texture Shape to Cube Map in the Import Settings. Do not Generate Mipmaps.
  • Create a new material (Assets > Create > Material) and name it CC3 Default (or whatever you want) and change its shader to Skybox.
  • Drag the Cubemap into the new materal and set the Rotation to 45 & Exposure to 1.
  • Open Window > Rendering > Lighting Settings and drag in the CC3 Default skybox material. Set the Intensity Multiplier to 0.93.
  • Scroll to Other Settings at the bottom of the Lighting settings and disable Fog (not shown in picture)
  • Select your Directional Light and change the color to pure white, Intensity to 0.8, and Transform Rotation to X:25 Y:360 Z:-40 (not shown in picture)
Replicating CC3 in Unity: Post-processing / Final Touches

To complete the CC3 Default look, some adjustments were made to the Post-process Volume at the bottom of the SampleScene Hierarchy...

https://forum.reallusion.com/uploads/images/f1256052-a8ec-47eb-bdf9-0aea.png
  • Color Grading: Tonemapping (ACES) disabled | Temperature -3 | Tint -3 | Post-exposure (EV) -0.2 | Contrast +6
  • Bloom: Intensity 0.2 | Threshold 0.2
  • Motion Blur & Depth of Field: Disabled
  • Ambiet Occlusion: Intensity 0.5 | Thickness Modifier 1.2
The HDR Cubemap skybox we imported is not a perfect match, but it can be toggled off in both CC3 & Unity to display a grey background. Go to Preferences > Colors > Scene > Background and set the Value to 22 and toggle off the Scene View skybox. Set the Main Camera Clear Flags to Solid Color. Besides hiding the Sky In CC3, also go to the Project panel 2D Background section and uncheck Activate Image to disable the gradient...

https://forum.reallusion.com/uploads/images/2b1614c3-b30f-4e45-9691-37d9.png

Besides the hair & eyelashes, which will be covered in the next post, here are the material settings I had to adjust to achieve this...

Eyes Smoothness from .7 to .95, Albedo Value from 100 to 90
Head, Arms, Legs, & Body Smoothness from .88 to .77 (can select all at once), Face Normal from 1 to 1.25



CC3 & Daz Tricks | CC3 to Unity workflow

Edited
5 Years Ago by Scyra
Scyra
Scyra
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)

Group: Forum Members
Last Active: 4 Years Ago
Posts: 220, Visits: 2.5K
Post reserved for tutorials & experiments...

The next idea for improving character visuals in Unity is to combine Normals from the Digital Human Shader update. If you go in an start deleting the maps you'll notice which ones contribute the most to the visual effect: It's the two normals: Micro Normal and Normal Blend Map, and the Base Color Blend Map. There are Photoshop Actions and scripts that allow us to combine those Normals with our base, and the Base Color Blend Map could be replicated as a Photoshop overlay texture, merged into the Diffuse. The rest of the magic is mostly lighting and good base textures.

Will get to that eventually, but now you have an idea if you want to try something on your own.



CC3 & Daz Tricks | CC3 to Unity workflow

Edited
5 Years Ago by Scyra
J__s
J__s
Posted 5 Years Ago
View Quick Profile
Senior Member

Senior Member (329 reputation)Senior Member (329 reputation)Senior Member (329 reputation)Senior Member (329 reputation)Senior Member (329 reputation)Senior Member (329 reputation)Senior Member (329 reputation)Senior Member (329 reputation)Senior Member (329 reputation)

Group: Forum Members
Last Active: 4 Years Ago
Posts: 22, Visits: 751
Thanks for lovely teaching   ~ 
Scyra
Scyra
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)

Group: Forum Members
Last Active: 4 Years Ago
Posts: 220, Visits: 2.5K
You are quite welcome. I will be the one needing the teaching soon when I move on to iClone to CC3. Give and take.

The hair shader settings can be confusing. I have created a cheat-sheet to help you if you are using this particular hair shader...

https://forum.reallusion.com/uploads/images/cc5ff760-d3f8-4330-9c65-1e31.jpg

Daz hair such as the one I am using tends to have a number of layers (submeshes). Merging these submeshes can ruin the quality. Choosing one (or two) layers and setting the Render Queue to Geometry allows them to cast shadows on the other hair layers and the face. It looks good and is not too performance-intensive if you have reduced polycount (this hair reduced from ~200,000 to 5000 tris).

Hair Physics

This is another big problem. I spent all day working on a solution. Obi Cloth, which is supposed to be faster than Unity cloth, was a complete disaster. VertExmotion, being a shader, would have to be integrated into the hair shader, which was another problem, and it seemed performance would also not be acceptable. This leaves Dynamic Bone as the best option, but again there is a problem that the CC3 head bone is sort of non-existent (it sits right on top of the neck, at the jaw-level—this will not work for Dynamic Bone)...

https://forum.reallusion.com/uploads/images/c234129a-a87c-4f8d-9e33-e707.jpg

You see, there's nothing above the eyes. You've got to add bones. It needs to look something like...

https://forum.reallusion.com/uploads/images/46b4e09a-8547-44ba-bda5-4707.jpg

The English language lacks the appropriate words to describe how much I hate Blender. If someone can link a guide to do this in 3DXChange it would be appreciated. I'm looking at purchasing the Puppet3D asset to do this if necessary (but in that case I may wait for a Black Friday sale).



CC3 & Daz Tricks | CC3 to Unity workflow

Edited
5 Years Ago by Scyra
Miranda (RL)
Miranda (RL)
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (62.8K reputation)Distinguished Member (62.8K reputation)Distinguished Member (62.8K reputation)Distinguished Member (62.8K reputation)Distinguished Member (62.8K reputation)Distinguished Member (62.8K reputation)Distinguished Member (62.8K reputation)Distinguished Member (62.8K reputation)Distinguished Member (62.8K reputation)

Group: Administrators
Last Active: 2 Years Ago
Posts: 1.8K, Visits: 11.2K
Like this post!
I like the way you share your experience in using CC. It pointed out something we may not be aware of during product development, tutorial creation, or webpage commercialization. 
Are you consider to break out different topics in different threads, and highlight what it's about on the subject? 
I didn't notice it's about Transformer and CC-to-Unity before clicking into the page.
Scyra
Scyra
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)

Group: Forum Members
Last Active: 4 Years Ago
Posts: 220, Visits: 2.5K
Thank you, Miranda. I am honored that you like it. You are welcome to split the thread into separate topics in the appropriate subforums, and to change the title as you see fit.

Actually, I had purposely obfuscated the title as I am somewhat guarded against the idea of sharing pearls with anybody and everybody, but, having realized this to be a rather small yet helpful community, I have completely changed my mind (as you can see I've added the link to my signature).



CC3 & Daz Tricks | CC3 to Unity workflow

drew_927096
drew_927096
Posted 5 Years Ago
View Quick Profile
Senior Member

Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 19, Visits: 95
This thread is a huge help, thanks for sharing.

I have issues with clothing clipping into my Avatar when that character animates in Unity.

I have a system in Unity where I can change the characters outfits, so I can't just bake the clothing into the character when I export.

Have you faced and solved this problem? Is the only answer to use weight painting and try to fix it for all animations for all clothing? Or maybe there's some short cuts or hacks to get it to work?
Thanks for your help!
Scyra
Scyra
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)

Group: Forum Members
Last Active: 4 Years Ago
Posts: 220, Visits: 2.5K
You are welcome. I will come to the problem of outfit swapping, but cannot say whether it will be 2 weeks or 2 months (currently working on terrain until the CC3 update which is scheduled for the end of this month). The product I will be using to do this is Mount Points. The feature list specifically mentions support for masks to reduce clothing penetration, so that is probably what I will be doing. Since you already have a system, you might gain some insight from the Mount Points PDF manual about how the mask system works—seems simple enough to swap mask textures per clothing item.

Making all those mask textures will be a bother, but maybe not too bad with Photoshop's Quick Seletion Tool. If it is minor poke-through, tessellation can inflate the mesh to hide it, but tessellation is probably more expensive than masks and cutout shaders.

Another possibility is to use the hide mesh shader attached to this post to hide the entire torso/legs/arms. I don't think it's a very useful option except, perhaps, to hide the hair for helmets.



CC3 & Daz Tricks | CC3 to Unity workflow

Attachments
Hide Mesh.zip (390 views, 428 bytes)
Edited
5 Years Ago by Scyra
drew_927096
drew_927096
Posted 5 Years Ago
View Quick Profile
Senior Member

Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)Senior Member (328 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 19, Visits: 95
Thanks a ton man. When you get to the point of doing swappable outfits, let me know, as I have a ton of documentation that I could share with you of the lessons i've learned so far.
I know about mount points and have played with it, but I couldn't get it to work, I think mainly because C3 exports clothing with a weird extra bone or two and attaches the mesh to that weird bone(s).

I actually FINALLY resolved this yesterday, I have no idea why, but your post gave me this idea.
I basically loaded the clothing in C3, then I hit "transfer skin weights", then "convert to accessory", and then "transfer skin weights" again.
Now, when I export the clothes, the weird extra bones are gone! wow! can't believe this worked.

Now that this has been resolved, most of my "poke through" issues appear to be gone, although there is still some minor glitchiness, this is a huge win.
I'm also able to attach the clothing to the bones of the avatar with a simple script found here: https://forum.unity.com/threads/tutorial-how-to-make-clothes-animate-along-with-character.475253/.
Now that the bones are the same as the avatar, this works easily.

I think this simple script here also does masking, if you want to avoid using Mount Points, you can basically replicate the behavior with the script found here: https://forum.unity.com/threads/issue-with-character-body-poking-through-the-clothes-custom-shader-maybe.367220/

I think the place that Mount Points really shines is attaching arbitrary meshes to bones. But if you already have a rigged mesh (like clothing), MP may be overkill.

I am still hoping to avoid having to create a mask per each clothing item, as it seems like a pain, and I don't have artistic skills.
I will look into using the shader you attached and see what results I get.
I'm hoping to just find an automated way to hide the whole body part that the clothing is covering.


Edited
5 Years Ago by drew_927096
Scyra
Scyra
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)Distinguished Member (2.0K reputation)

Group: Forum Members
Last Active: 4 Years Ago
Posts: 220, Visits: 2.5K
UPDATE: I was able to get Mount Points working with little difficulty using the method you decribed in another thread (thanks!)...

By hiding the mesh of the character, and "delete hidden mesh" on export, C3 allows export of clothing only.

I tested this with a jacket. I was able to delete the unnecessary skeleton bones such as the legs, hands, and head—presumably this helps with performance. I think the problem you were initially encountering is specific to Game Base. I have already posted an example of the CC3 Base skeleton a couple posts earlier. This is what a clothed Game Base skeleton looked like in Blender...

https://forum.reallusion.com/uploads/images/42d418dc-bb4f-4813-943f-1fe4.jpg

Thank you for sharing your workaround for that. As far as mask textures and pokethrough, I don't think you have anything to worry about; it can be done with nothing but black & white square blocks. I had some poke-through at the elbows of the jacket and this is the mask texture I used to fix it...

https://forum.reallusion.com/uploads/images/a919834c-31c7-429b-b047-d7e5.jpg


Wow, it sounds like you might have spared me a lot of work. "This is a huge win"—I totally get what you mean, I've had plenty of those experiences in Unity so far. Every little thing is a hurdle.

The masking script you posted looks like it functions the same as the Mount Points system. I'm still going to give Mount Points a try because I already bought it at last year's Black Friday/Cyber Monday sale. And I'll look into this sometime within the next few days because it seems it is potentially a bigger problem than I anticipated (seems to be a trend).

I'm not sure that the Hide Mesh script is useful at all, come to think of it—it would be better to just toggle off the Skinned Mesh Renderer component instead. Anyway, thanks for the insights and I'll let you know my results soon.



CC3 & Daz Tricks | CC3 to Unity workflow

Edited
5 Years Ago by Scyra



Reading This Topic