Closed kandohar closed 2 years ago
Are they using the new skin colouring options in CC4? You'll need to bake the skin colouring when exporting from CC4 (It think it's the very last option in the export window). Until I can figure out what those colour controls actually do and update the Unity shaders.
The hair: Is it using the digital human hair shader in CC? Looks like it's not detecting that it should be transparent. You can try switching the materials in Unity to transparent,
But basic alpha blending really doesn't work very well in Unity, so your best option might be to set the shader type to digital human hair in CC, then it will use the Unity hair shader and should look a lot better though it may need some tweaking.
For the skin color, no we use CC3 but I'm not the one who created and exported the avatars. But yes, the texture is white in Unity so I guess the Bake option was not used. I will check that.
Ok, this was my fault. There was a diffuse colour modifier missing from the skin shaders. I've updated the packages, it should fix your problem.
Ok thanks! I re-imported them all and they now look like that: That's definitely better but they appear a bit darker than the reference. The color in the json is perhaps not that perfect.
About the man's hair, when re-importing him, I got these 2 errors:
Unable to find json material data: Undercut_fade 1/Materials/Scalp_Pbr UnityEngine.Debug:LogError (object) Reallusion.Import.Importer:ProcessObjectBuildPass (UnityEngine.GameObject) (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/Importer.cs:305) Reallusion.Import.Importer:ProcessObjectTreeBuildPass (UnityEngine.GameObject) (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/Importer.cs:273) Reallusion.Import.Importer:Import () (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/Importer.cs:227) Reallusion.Import.ImporterWindow:ImportCharacter (Reallusion.Import.CharacterInfo) (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/ImporterWindow.cs:850) Reallusion.Import.ImporterWindow:BuildCharacter () (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/ImporterWindow.cs:987) Reallusion.Import.ImporterWindow:OnGUI () (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/ImporterWindow.cs:346) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
and
Unable to find json material data: Undercut_fade 1/Materials/Hair_Pbr UnityEngine.Debug:LogError (object) Reallusion.Import.Importer:ProcessObjectBuildPass (UnityEngine.GameObject) (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/Importer.cs:305) Reallusion.Import.Importer:ProcessObjectTreeBuildPass (UnityEngine.GameObject) (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/Importer.cs:273) Reallusion.Import.Importer:Import () (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/Importer.cs:227) Reallusion.Import.ImporterWindow:ImportCharacter (Reallusion.Import.CharacterInfo) (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/ImporterWindow.cs:850) Reallusion.Import.ImporterWindow:BuildCharacter () (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/ImporterWindow.cs:987) Reallusion.Import.ImporterWindow:OnGUI () (at Library/PackageCache/com.soupday.cc3_unity_tools@1219467552/Editor/ImporterWindow.cs:346) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
I can't check right now about the settings in CC, but I will do ASAP.
Diffuse colour modifier probably needs a colour space correction. (Some of the parameters are in linear space, some in RGB, but it's hit and miss which is which...)
Can you attach the .json data file for the character that causes those errors. I've never seen a case where it can't find specific materials (it's usually all or nothing). I suspect it's something to do with the space in the name, (they're usually all replaced with underscores).
Ok thanks, I see.
Here is the file (renamed to .txt because .json are not allowed): Adult_Male21.txt
This might be a long shot, but try this json data. I think you've found a bug in character creator. It's truncating the object name at the space and putting the material definition in the wrong section. This is a corrected Json.
Yes, totally fixed, no error, no weird hair.
Should I report a bug somewhere?
oh, and one last thing, on some avatars, there are some visual artefacts on hairs, like flat surfaces. Here are 2 examples:
Do you know where these came from? and if it's fixable?
That's Unity making a mess of the recalculated normals.
I added a function to smooth out the normals just for this: select the mesh object and use menu - Reallusion > Mesh Tools > Auto smooth Normals. It usually does a better job of it.
It applies the smoothed mesh to the prefab. It might be best to do this in the preview scene.
I'll try and figure out what's causing the bug at the character creator side of things and report it to devs directly.
Works like a charm! (only did it on the bun)
Thank you for your time!
Hi again, I tried to fix the skin color problem and you were right, it's a Color Space problem for the Diffuse Color. I added some code just before here : https://github.com/soupday/cc3_unity_tools_HDRP/commit/121946755298ba378eb2a490e0c360abb31815b4#diff-c89a8555fe4a5b6481ae8332f3774e0542d8132f964dc7969c4e8e901fd11993R1008
Color diffuseColor = matJson.GetColorValue("Diffuse Color");
Color convertedDiffuse = new Color();
convertedDiffuse.r = Mathf.LinearToGammaSpace(diffuseColor.r);
convertedDiffuse.g = Mathf.LinearToGammaSpace(diffuseColor.g);
convertedDiffuse.b = Mathf.LinearToGammaSpace(diffuseColor.b);
convertedDiffuse.a = diffuseColor.a;
mat.SetColorIf("_DiffuseColor", convertedDiffuse);
And the result is very good:
I'm not sure if this correction is always mandatory but can you maybe add an option to allow it?
@soupday any feedback about my request?
Changes live now. The colour space correction is pretty much mandatory, no need to make it optional. It was the same for the eyes and the hair colour parameters.
Speaking of the hair I've added a colour modifier for the hair too, and even remembered to put it in the right colour space.
And that's perfect! The hair look more accurate now thanks! Thanks again for your works!
Hi, I'm using this package to import Avatars in Unity HDRP and I experienced some problems with dark skinned avatars. They sometimes appears white, Cf picture below, 1,2, and 5 are bad whereas 3 and 4 look good.
And I experience a weird visual artefact with the hair of 5, they look like this: The GameObjects are named "Undercut_fade", "Undercut_fade 1" and "Undercut_fade0" and all the materials use the "HDRP/Lit" shader.
Otherwise the result is very convincing, nice job! Don't hesitate if you need more information.