soupday / cc_unity_tools_3D

Package for importing and auto setup of Character Creator (3 & 4) and iClone (7 & 8) character exports for Unity Built-in (3D) Pipeline.
Other
66 stars 19 forks source link

Building Materials In Unity3d Core Doesn't Give Correct Result, Yet HDRP Does #39

Open DireLykaios opened 1 year ago

DireLykaios commented 1 year ago

Hi! I'm having issue building materials in Unity3d Core, it gives me a messed up result. I kinda need it to properly build materials in this version because I will be using other tools that only work in Core.

As you can see, everything works well in blender after exporting from CC4. My issue happens when I export the fbx file to Unity and try to build the materials using the plugin. I've tested the material building in HDRP and it works perfectly, is there any way I can achieve the same result in Core?

Photos Attached Blender Works Unity Model Broken

soupday commented 1 year ago

it looks washed out, is your project set to linear color space? (Unity 3D core defaults to gamma color space, URP and HDRP default to linear). You need to be in Linear color space for CC3/4 characters (and PBR based materials in general)

cs

DireLykaios commented 1 year ago

Hi, it is set to linear, and I also have the processing stack installed. It’s like everything’s grey and metallic like.

On Sun, Dec 18, 2022 at 04:58 Victor Soupday @.***> wrote:

it looks washed out, is your project set to linear color space? (Unity 3D core defaults to gamma color space, URP and HDRP default to linear)

[image: cs] https://user-images.githubusercontent.com/79094830/208291919-7a865a15-80fd-4331-8dc0-ca17709e8823.jpg

— Reply to this email directly, view it on GitHub https://github.com/soupday/cc_unity_tools_3D/issues/39#issuecomment-1356761757, or unsubscribe https://github.com/notifications/unsubscribe-auth/A42LS55YH36ANTJ3ZONCBALWN3N35ANCNFSM6AAAAAATCLJ5VA . You are receiving this because you authored the thread.Message ID: @.***>

DireLykaios commented 1 year ago

Do I need to rebuild the materials after changing to linear?

As I had mentioned everything works perfectly in HDRP so I know it’s an issue with the material setup or way it’s displayed.

On Sun, Dec 18, 2022 at 12:03 Aximilion @.***> wrote:

Hi, it is set to linear, and I also have the processing stack installed. It’s like everything’s grey and metallic like.

On Sun, Dec 18, 2022 at 04:58 Victor Soupday @.***> wrote:

it looks washed out, is your project set to linear color space? (Unity 3D core defaults to gamma color space, URP and HDRP default to linear)

[image: cs] https://user-images.githubusercontent.com/79094830/208291919-7a865a15-80fd-4331-8dc0-ca17709e8823.jpg

— Reply to this email directly, view it on GitHub https://github.com/soupday/cc_unity_tools_3D/issues/39#issuecomment-1356761757, or unsubscribe https://github.com/notifications/unsubscribe-auth/A42LS55YH36ANTJ3ZONCBALWN3N35ANCNFSM6AAAAAATCLJ5VA . You are receiving this because you authored the thread.Message ID: @.***>

soupday commented 1 year ago

Is it just because you're in an new empty scene? The default empty scene lighting isn't very interesting (and there's no post processing set up in it). What does it look like in the tool's own preview scene?

DireLykaios commented 1 year ago

I messed around with the lighting, it doesn't seem to make much of a difference. For comparison here is a similarly textured character I had run through some other plugins. Something's going wonky with the material building on my end.

vrm conversion

soupday commented 1 year ago

Ok, I have a feeling I know what it is.

Coming from Blender, the textures aren't in a suitable format for Unity so they have to be baked: diffuse + alpha, metallic + roughness to metallic alpha smoothness, that sort of thing. But it only does this once, because it takes quite a long time, and then it re-uses that initial bake on subsequent rebuilds.

But... if the character is first build when the project is in Gamma color space, that gamma space is permanently baked into these textures and they look washed out and too smooth, even when the project is then changed to Linear color space, e.g:

washy

So, to fix it: There is a setting to re-bake these Blender textures, turning it on and rebuilding the character should fix it.

settings

DireLykaios commented 1 year ago

Yep, that option and rebuilding the materials fixed the weird skin coloration and everything. Final question, if you do know, is how would I improve the hair transparency issues?

Really appreciate your help so far, and I'd recommend documenting this troubleshooting process for others who may have had similar problems. Better

DireLykaios commented 1 year ago

Is there something I can do with the way the hair is displayed in Unity at this step to resolve the way its rendering? The hair is made up of many cards of transparent mesh, with an alpha material painted over them to mimic hair, but I'm sure you know how CC4 does it already.

DireLykaios commented 1 year ago

For example, here is the same hair, the right one was just imported through multiple other steps. Is there a way to achieve better hair rendering through your plugin, maybe with some additional steps?

Hair

soupday commented 1 year ago

Use the prefab generated in the Prefabs folder. The Fbx can't be set up properly as all the mesh objects in it are read only, so the character is built in the prefabs.

The hair materials for two pass hair in particular don't work on the Fbx.

soupday commented 1 year ago

Alternatively there is the single pass hair, which is drawn as dithered opaque, faster performance, but it's the lowest quality. Or there is the MSAA Coverage Single pass hair shader which is also rendered opaque but does some kind of trickery with the MSAA anti-aliasing to make it look alpha blended. It's probably the fastest rendering performance but requires MSAA enabled, which may overall be slower. (And only seems to work in the Game window)

Two-pass hair has the best visual quality but renders the hair twice, firstly rendering the inner 'core' of the hair cards as opaque alpha clipped, then renders just the remaining visible outer edges of the hair cards as alpha blended. It sounds like a lot of work but it is actually much better performance and better quality than just alpha blending, because most of the hair is rendered opaque.

DireLykaios commented 1 year ago

Awesome, thanks. I've determined that the main issue I'm facing is that my hair material is rendering as a standard shader, with cutout as its rendering mode. Changing the rendering mode as fade makes it more appealing for now, with the cost of a transparency effect.

I appreciate your help, and I'll try to build a better more authentic hair material for the avatar from here.

soupday commented 1 year ago

If you change the hair materials Shader from Pbr to Digital Human Hair in CC4 before exporting, this will tell the Unity setup to treat it as hair and use the correct hair shaders.

It may need some tweaking, but it should improve things.

DireLykaios commented 1 year ago

We're in business now, baby. The hair became an issue where the normal maps were not being imported and created like other materials. I did it by hand for now.

Also, if Unity is giving you problems the option “Blendshape Normals” to “None” or enable “Legacy Blendshape Normals”. That fixed some of my other shadow/mesh issues later on down the line.

Fixing

cjus commented 1 year ago

Just want to say I for one appreciate this thread. Good takeaways.