Profile Picture

Unity Import Shader Settings

Posted By Irrgeist 3 Years Ago
Rated 5 stars based on 1 vote.
Author
Message
Irrgeist
Irrgeist
Posted 3 Years Ago
View Quick Profile
Veteran Member

Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 26, Visits: 110
Awesome work! Looks much better now (but yeah, as you said 1-Pass looks rather ... meh πŸ˜…).
Good idea, I added a new float for the tesselation factor, works nicely. I forgot you used Shader Graph for everything, makes it nice to adjust to my needs and play around a little bit :) 

I think exposing the tesselation value shouldn't be that much of a problem performance wise when deactivated by default? If you can add it, it would be great, then I will not have to add it myself on every update hehe.

Another short idea: 
The Jaw fix works well, but this way I loose potential masks I've setup while importing (since the .anim files are separated from the fbx/importer now). Another solution is to add a custom Curve to the importer:


This way the animation(s) reside in the fbx and there is no struggle to re-apply the jaw fix when the animations get changed (of course this only works well if all the animations in the fbx have an open jaw and no jaw bone animations). Maybe this is something for your documentation as an alternative solution for users. I see a lot of people struggling with this issue and I think this is the least cumbersome of all the solutions I've seen so far.
Maybe with a custom AssetPostprocessor this Curve could be added to a specific file (based on a file name prefix, or even using the context menu)...in the end the import settings are in the .meta file, but I am not familiar with this and maybe it's overkill anyway haha.

Victor.Soupday
Victor.Soupday
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)

Group: Forum Members
Last Active: 5 days ago
Posts: 569, Visits: 9.0K
OK, this was a problem with HDRP 12 (Unity 2021.2 / 2021.3).
It wasn't importing the shaders with depth pre-pass correctly, namely the single pass hair shader.

I've put in a fix that should get unity 2021.2 and above to use specific HDRP12 versions.
(version 1.3.2: https://github.com/soupday/cc_unity_tools_HDRP/releases)

If that works, it should be possible to think about expanding on this to expose the tessellation properies of HDRP 12 shader graphs.

Until then you can actually turn on tessellation yourself, in the custom HDRP shaders, by editing the shader graphs, ticking the tessellation box (in the graph inspector) and saving.
Edit: also set the 'tessellation factor' input in the shader graph to around 4 - 16
Irrgeist
Irrgeist
Posted 3 Years Ago
View Quick Profile
Veteran Member

Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 26, Visits: 110
Hi Victor,

thank you very much for taking your time to explain all this. I seriously thought about refunding CC4 after seeing the result and lack of support for Unity. And since I couldn't find any decent hair shader for HDRP online or in the asset store, your tool is a major relief. Don't want to spend my time writing a shader for a paid product promoting Unity support. Again, Awesome work!

I restarted my testing now (fresh new sunday xD). I cloned the git repo and actually followed your installation tutorial this time.
First I've built the HQ + Single Pass Hair materials and loaded the model up in the preview scene. Same result:


Then I created a new empty HDRP Unity project and exported Camilla from scratch using the "CC4 Camilla Facial Demo" project example and did the following:
1.) Import fbx and textures
2.) Open Importer, select model and set it to Single Pass Hair
3.) Open Preview Scene
4.) Click Build Materials
5.) Weird  Hair result

Here's a short video on the whole process (Single-Pass, then Two Pass). Maybe I am doing something wrong. If so just forget about it, will use the other shader anyway, since my project is HDRP and not URP:



I will test it with the CC4 LOD feature and also try the built in materials and test with them, because I want to check out the tesselation feature for LODs of my characters or Game Base (thus why I asked for the ability to produce Built-In Shaders and Two Pass Hair at the same time, even though the hair will then not have tesselation).  



Victor.Soupday
Victor.Soupday
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)

Group: Forum Members
Last Active: 5 days ago
Posts: 569, Visits: 9.0K
My explanation of the material types and why you shouldn't use basic materials: https://forum.reallusion.com/FindPost510104.aspx
I should probably add to that the basic materials are there just in case the others won't work on the platform you're building for.

The HQ+Single pass picture result is not the correct result, but I think I see what that is. When you press the build button it always puts the result in the prefab. So when you build the 2 pass hair prefab, the FBX file is not the single pass version. It's actually in an incomplete state because it's not possible (and not a good idea) to modify meshes in the source FBX. So once you've built the materials, don't use the FBX.

All the other functions of the tool work on the prefabs too, the FBX is just the original data source.

In HDRP the single pass hair shader is acutally quite close in quality to the 2-pass. For the Built-in pipeline and URP the single pass hair is much worse, because the only single pass solution for those pipelines is to use a dithered alpha clip opaque shader which doesn't hold up to scrutiny well.


It's an officially unofficial set up tool, or maybe it's the other way around: See the last part of this post.
Irrgeist
Irrgeist
Posted 3 Years Ago
View Quick Profile
Veteran Member

Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 26, Visits: 110
Wow, there's even a fully feature documentation :O Awesome!
Guess I will have to test the impact on the CPU when a lot of HQ characters are walking around. Maybe also have to test your Base Materials with the Game Base model of CC4 + Tesselation.
I think the importer needs an option for Basic Materials + Two Pass Hair:
Basic (See through hair):


HQ+Single Pass:


HQ+2 Pass (Looks really good imho):


But maybe I have to tweak the shaders a little?

P.S. This importer is not an official importer, right? 

Victor.Soupday
Victor.Soupday
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)

Group: Forum Members
Last Active: 5 days ago
Posts: 569, Visits: 9.0K
Biggest performance hit is on the CPU from animating the mesh. The addition GPU load from multiple characters isn't that much even with the full complex shaders (I think that's the SRP batching in action).

But you can bake the more complicated 'High Quality Materials' into simpler and better performance versions that maintain the same visual quality, These then use the standard Unity shaders, and because of that you can then turn on tesselation in the materials (at least in HDRP):
https://soupday.github.io/cc_unity_tools/usage.html#further-processing

Irrgeist
Irrgeist
Posted 3 Years Ago
View Quick Profile
Veteran Member

Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 26, Visits: 110
Thank you, I will try it out :)

Edit:
Since the CC4 Game Base looks awful and lacks settings:
What do you think is the performance impact when using your shaders with the High Res CC4 Model (let's say 10-15 characters on screen at once for real time rendering).
You scripts works really nice btw :) Had to realize that it creates a new prefab using the multires hair shader.
Is there a way to activate tesselation too?
Victor.Soupday
This post has been flagged as an answer
Victor.Soupday
Posted 3 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)Distinguished Member (5.8K reputation)

Group: Forum Members
Last Active: 5 days ago
Posts: 569, Visits: 9.0K
This is what I've got: (HDRP)

https://forum.reallusion.com/uploads/images/bf925f6e-beda-4ccf-850f-82ab.png

Have a look at: https://forum.reallusion.com/488356/Unity-Auto-Setup
It's my version of the auto setup, not the old Reallusion one.

Irrgeist
Irrgeist
Posted 3 Years Ago
View Quick Profile
Veteran Member

Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)Veteran Member (643 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 26, Visits: 110
Hi,

anyone got the exported CC4 Character setup correctly in Unity. I am still strugling a bit This is my result so far for Camilla:
 


1.) the Hair and brows look weird.
2.) The Exporter seems to have problems (see the shirt, also clipping with the shoes)
3.)I deleted the EyeOcclusion and TearLine, what exactly are these? Reflections for the eyes? What shader is necessary for these too?

Edit: I remember there was a OpenSource Import Script for CC3, will there be one for CC4? 



Reading This Topic