Profile Picture

Unity Dev Thread

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

Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 133, Visits: 2.2K
There are some great threads for Unreal Engine 4 and 5 development, but I didn't see one for Unity Developers (Not a centralized thread anyway). So, I'm hoping this thread will serve as a place for Unity Devs to congregate and share tips and tricks, get help with issues they encounter, collaborate, etc.

MilesV
MilesV
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 133, Visits: 2.2K
So to get things started:

The Unity Pipeline seems to be causing problems for a lot of people. Per the below thread, RL plans to provide auto-setup for Unity 2020.3 LTS (currently compatible with 2019.3). What is your current workflow for bringing CC3 characters into newer unsupported versions of Unity? How are you handling the new Smart Hair in Unity?

https://forum.reallusion.com/483154/Unity-Auto-Setup-Plans-for-2021?Keywords=unity%20auto
MilesV
MilesV
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 133, Visits: 2.2K
I came across this article while looking into solutions for game hair. It's a really informative article that grounded my expectations.

Why Hair In Video Games Is So Hard To Do Well (kotaku.com.au)
Victor.Soupday
Victor.Soupday
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)

Group: Forum Members
Last Active: 5 hours ago
Posts: 523, Visits: 7.2K
Hair is certainly a headache to get right in Unity. I'm getting some OK results with the HDRP/Hair shaders.

https://forum.reallusion.com/uploads/images/6c30a28f-1127-4038-a036-71ee.png

Remember to bake the diffuse and specular maps in the export settings...

First thing to do is lower the smoothness of any scalp materials and give them a darker base map tint, so it doesn't show through so much and there are no specular reflections. Set it's Sorting Priority to lower than than the main hair material so it gets drawn first and is then overdrawn properly with the hair.

https://forum.reallusion.com/uploads/images/1e2518db-89f5-4b7c-a8cb-52c8.png


Main Hair Materials

I'm using the HDRP/Hair shaders for these. Plug in the diffuse and AO Map. The smart hairs don't usually come with normals or bump maps, but here I'm faking it with a copy of the diffuse texture imported as a height map. It can improve the look a little bit.

https://forum.reallusion.com/uploads/images/1d402320-dee0-46c4-baa7-97b1.pnghttps://forum.reallusion.com/uploads/images/52215fae-b84e-4bed-b086-26ee.png

Some settings
  • Back then Front Render to draw the underside of the hair cards properly,
  • Depth Pre-pass to help with any remaining Z-sorting problems.
  • Depth Post-Pass and Write Motion Vectors is needed for some post processing effects, notably motion blur and depth of field.
  • No Depth Write.
  • Alpha Clipping and Shadow Clipping is needed to make the depth prepass work.
  • Alpha to Mask for better anti-aliasing effect.
  • Double Sided of course.
  • Double Sided Normal Mode: set to whatever looks best, it varies with lighting conditions, usually 'None' is a safe bet.
  • Alpha Clip should be fairly low ~ 0.1. Too high and it starts to eat up all the little strands.
  • Alpha Clip Threshold Depth Prepass: this is quite an important setting, it pre-calculates which pixels (based on the clip threshold) are closest to the viewer so that it doesn't draw anything else underneath them. Some hair meshes with relatively few z-sorting issues (like this example) can get away with a high depth pre-pass. Less well sorted meshes will need a lower pre-pass threshold, but too low a setting will make the hair look thin and like there is nothing else underneath so this needs some experimentation.
  • Alpha Clip Threshold Depth Postpass: Set to about the same as Alpha Clip.
  • Shadow threshold, not too low as it can make the hair look too dark in strong lighting.
  • The smoothness and specular settings control the anisotropic specular reflections. There's lots to play with here. Keep the Max Smoothness < 0.5 so the reflections aren't too strong and keep the Transmission Rim very low otherwise the hair looks too translucent.

MilesV
MilesV
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)Distinguished Member (1.2K reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 133, Visits: 2.2K
Thank you, Victor.Soupday! I didn't get to play with this much last night, but quickly got some decent results. You've saved me and I'm sure plenty of other people a ton of time. I really appreciate you taking the time to break things down for me and I love the Blender plugin you've been developing.

Almost all my experience with Unity has been with the built-in pipeline. I've recently been experimenting with Gaia Pro and GeNa Pro to create game environments using URP and HDRP, but they do all the heavy lifting for me. I was starting to dive into the documentation Unity has for Shader Graph and was getting a little overwhelmed. Its great to know I can switch to the hair and eye shaders from the inspector and not have to go down the rabbit hole of the node editor just yet.

Thanks again!
cynsegura
cynsegura
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (5.5K reputation)Distinguished Member (5.5K reputation)Distinguished Member (5.5K reputation)Distinguished Member (5.5K reputation)Distinguished Member (5.5K reputation)Distinguished Member (5.5K reputation)Distinguished Member (5.5K reputation)Distinguished Member (5.5K reputation)Distinguished Member (5.5K reputation)

Group: Forum Members
Last Active: 2 days ago
Posts: 192, Visits: 1.1K
Hi guys thank you for creating this thread. I am wondering if to be able to make the character talk as a real human which is c3 plus from cc3.4 version. Do i need to create manual blendshapes for unity? Or is any better way with the recent updates. Please let me know. Kind regards
Victor.Soupday
Victor.Soupday
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)

Group: Forum Members
Last Active: 5 hours ago
Posts: 523, Visits: 7.2K
All the facial blend shapes available in CC3 are exported with the characters (the full characters, not sure about the Gamebase or InstaLod'ed characters).

e.g. these are all the blend shapes on the main body mesh:

https://forum.reallusion.com/uploads/images/4fdc3f56-2bd4-4944-9bb3-5d56.png

There are also blend shapes on the tongue, eye occlusion and tearline meshes, as well as on the smart hair: beard, moustache and eyebrow meshes too. Everything that takes part in the facial animation has the requisite blend shapes.
michael.pickering
michael.pickering
Posted 3 Years Ago
View Quick Profile
Junior Member

Junior Member (193 reputation)Junior Member (193 reputation)Junior Member (193 reputation)Junior Member (193 reputation)Junior Member (193 reputation)Junior Member (193 reputation)Junior Member (193 reputation)Junior Member (193 reputation)Junior Member (193 reputation)

Group: Forum Members
Last Active: 3 Months Ago
Posts: 46, Visits: 215
Thanks for starting this thread! There's not been much joy for us Unity devs on this Forum, and it rather looks like we're being ignored by RL (after they deposited our money of course) but I'm keen to see if there are more of us.

Those hair suggestions look helpful, I'll have a look in more detail when I get back into Unity over the next few days. Thanks to those who contributed!!
Victor.Soupday
Victor.Soupday
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)

Group: Forum Members
Last Active: 5 hours ago
Posts: 523, Visits: 7.2K
MilesV (6/10/2021)
I was starting to dive into the documentation Unity has for Shader Graph and was getting a little overwhelmed. Its great to know I can switch to the hair and eye shaders from the inspector and not have to go down the rabbit hole of the node editor just yet.

But down that Rabbit hole, you must go.

It has taken me a while to figure all this out but, consider this character in CC3:
https://forum.reallusion.com/uploads/images/f3ef3fdf-2b27-43ba-8ed5-1b6e.png

She is of the quality you would expect from Character Creator, but when you export into Unity (I'm using Unity 2020.3 / HDRP Pipeline here) you get this:

https://forum.reallusion.com/uploads/images/09fab6ef-dc54-454e-942f-e163.png

Which is obviously awful, Mainly due to the FBX format, which does not support the PBR texture set. (At least not the version of FBX that CC3 exports and Unity imports.). In fact, all it understands is the Diffuse texture, the Specular mask texture (which Unity doesn't actually support), the Opacity texture and the Normals. Which is why it looks terrible, because most of the textures are missing.

The next order of business is to populate the HDRP/Lit materials with the appropriate base textures, of which we have the Diffuse, Mask (named with the suffix '_HDRP' in the files.) and Normal maps.

Here I have plugged all these textures in, changed the hair material shader to HDRP/Hair, and given them some appropriate settings:

https://forum.reallusion.com/uploads/images/2b917803-daca-4785-9a79-0966.png

(I'm using the eye occlusion texture from the OBJ export to Blender as the alpha channel in an all black diffuse map, for some reason it doesn't come with the FBX export. The tearline material is 100% transparent, max smoothness material with no textures.)

And this is probably as good as it gets with the base textures and default HDRP material shaders, but it all looks flat and lifeless compared to the CC3 image above, particularly the eyes.

To truly recreate the character with all the details and layers and effects of the CC3 shaders, you have to dive into Shader Graph. Additionally we also have the problem that there is no 1:1 mapping of CC3 to Unity. They use different lighting, different shader models, different colour mapping and who knows what else. I had the same problem in Blender when I was making the Material setup add-on for that, the only real solution being to provide enough parameters and controls to the users so that they could make the characters in Blender look like the characters in CC3.

The same is true of Unity, so to achieve similar results to CC3 we need more control over the material shaders in Unity than the default HDRP/Lit and Hair shaders can provide.

The shader nodes in Blender materials and Unity's Shader Graph are very similar. Similar enough that I could reproduce the same shaders in Unity that I made in Blender, even improve on them a bit. And they look something like this:

https://forum.reallusion.com/uploads/images/56a06e32-07f1-4cbb-a536-ab8d.png

These shaders are using all the textures for the blend layers, micro normals, normal blending, shadow layers, hair root, id and flow maps, vertex deformation for the eyes and all the parameters to control how each texture is used and layered into the final results. The eyes are refactive with iris depth control and pupil size control. The skin, hair and eyes have min-max remapping and power curve mapping for the smoothness and alpha channels and it has all the controls of the smart hair shaders too.

There's still more work to do on the shaders and they are going to take a serious amount of explaining, but so far, I'm quite pleased with the results.

https://forum.reallusion.com/uploads/images/5f9eb223-e467-4fdd-abd4-971a.png

More to follow when I get the chance...
Edited
3 Years Ago by Victor.Soupday
Victor.Soupday
Victor.Soupday
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)Distinguished Member (5.3K reputation)

Group: Forum Members
Last Active: 5 hours ago
Posts: 523, Visits: 7.2K
There's too much to show with screen shots so I've put it in a video...




Reading This Topic