umasteeringgroup / UMA

Unity Multipurpose Avatar
MIT License
740 stars 168 forks source link

Unable to use UMA with LWRP #296

Closed masonwheeler closed 4 years ago

masonwheeler commented 4 years ago

Describe the bug It doesn't appear to currently be possible to upgrade UMA from the legacy render pipeline to LWRP.

Environment (please complete the following information):

To Reproduce

  1. Open a new LWRP project
  2. Import UMA from the Asset Store
  3. Open a UMA demo scene. All the people are magenta, which means the textures need to be updated.
  4. Use the normal Unity material update process to update the UMA materials to LWRP

Expected behavior The avatars look right

Observed behavior The materials don't convert; instead you end up with a purple square with the words "NOT SET" written on it over and over again, which makes for some very odd-looking people!

Jaimi commented 4 years ago

This is not a bug. The LWRP (URP) shaders changed the texture keywords. To solve this, edit every UMAMaterial in your project, and make sure the texture channels point to the correct keywords (you can select it from the list). If I recall correctly, the only change was that _MainTex changed to _BaseMap or something like that.

masonwheeler commented 4 years ago

How is that different from any other material? Unless you're referring to something different from what it looks like you're referring to, what you're describing is the specific reason why we have the auto-update functionality in the Unity editor. (Or one of them at least.) It takes care of automatically renaming the keywords that have changed, so you don't have to do them all by hand. And it works for all the materials I've tried... except the UMA ones. So it really feels like there's something more going on here.

kenamis commented 4 years ago

The "UMAMaterial" assets are different than Unity "Materials". An UMAMaterials stores a reference to a Unity Material to use as a template. When you run the autoconverter you upgrade the Unity Materials, which is needed. But, then you need to manually update the UMAMaterial (there is no auto converter for UMAMaterial). The UMAMaterial stores a list of shader property names that correspond to the names on the shader in the Unity Material it uses. When you switch from built-in rendering to URP, the main changes is from "_MainTex" to "_BaseMap". So, that's what you need to change in the UMAMaterials you are using.

On Sun, Feb 2, 2020 at 7:48 PM masonwheeler notifications@github.com wrote:

How is that different from any other material? Unless you're referring to something different from what it looks like you're referring to, what you're describing is the specific reason why we have the auto-update functionality in the Unity editor. (Or one of them at least.) It takes care of automatically renaming the keywords that have changed, so you don't have to do them all by hand. And it works for all the materials I've tried... except the UMA ones. So it really feels like there's something more going on here.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/umasteeringgroup/UMA/issues/296?email_source=notifications&email_token=AA46NGZT4LGS2HKWT2NVDMDRA6HZFA5CNFSM4KO534H2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKSMTXI#issuecomment-581224925, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA46NG2YXGMVPRW7G643ZJ3RA6HZFANCNFSM4KO534HQ .

masonwheeler commented 4 years ago

I see! Thanks for the clarification.

masonwheeler commented 4 years ago

That helps quite a bit, but hair still comes out magenta. The UMA_Mesh_Hair_DoubleSided and UMA_Mesh_Hair_SingleSided materials are using custom hair shaders that don't appear to have a LWRP equivalent, as of 2.8.5 RC1.

albertodf1977 commented 4 years ago

Hello, I am using built-in rendering pipeline, and with the new updates of UMA and Unity I have the mentioned problem of "Not Set" in the my UMA character, it is pink color with "Not Set" texture. I have changed _MainTex by _BaseMap (as you mentioned, see photo attached) and the character dissapears. I am quite frustrated with this issue, thinking not to use any longer UMA assets. Can you help me, please? I attach 3 screenshots. UMA Built-in Rendering Pipeline 01 UMA Built-in Rendering Pipeline 02 UMA Built-in Rendering Pipeline 03

albertodf1977 commented 4 years ago

and the console message is as follows: MissingReferenceException: The object of type 'Material' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. UMA.TextureMerge.SetupMaterial (UMA.TextureMerge+TextureMergeRect& textureMergeRect, UMA.UMAData+MaterialFragment source, System.Int32 textureType) (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/TextureMerge.cs:159) UMA.TextureMerge.SetupModule (UMA.UMAData+MaterialFragment source, System.Int32 textureType) (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/TextureMerge.cs:179) UMA.TextureMerge.SetupModule (UMA.UMAData+GeneratedMaterial atlas, System.Int32 idx, System.Int32 textureType) (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/TextureMerge.cs:192) UMA.TextureProcessPROCoroutine+d__8.MoveNext () (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/TextureProcessPROCoroutine.cs:94) UMA.WorkerCoroutine.Work () (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/WorkerCoroutine.cs:63) Rethrow as Exception: Exception in WorkerCoroutine: UMA.TextureProcessPROCoroutine UMA.WorkerCoroutine.Work () (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/WorkerCoroutine.cs:67) UMA.WorkerCoroutine.Work () (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/WorkerCoroutine.cs:33) UMA.UMAGeneratorBuiltin.HandleDirtyUpdate (UMA.UMAData data) (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:233) UMA.UMAGeneratorBuiltin.OnDirtyUpdate () (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:285) UnityEngine.Debug:LogException(Exception) UMA.UMAGeneratorBuiltin:OnDirtyUpdate() (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:301) UMA.UMAGeneratorBuiltin:Work() (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:148) UMA.UMAGeneratorBuiltin:Update() (at Assets/Editor Default Resources/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:101)

Jaimi commented 4 years ago

The UMAMaterial is complaining that it can't find _BaseMap in the material shader. You forgot to convert your materials to URP. The system even warns you to do that if you run the UMA conversion tool. Converting to URP is part of URP, not part of UMA.

Honestly, if you don't want to use UMA, don't use it. Don't post here threatening to stop using it. I get you're frustrated because you missed a step. But we work on this for free.

masonwheeler commented 4 years ago

The system even warns you to do that if you run the UMA conversion tool

There's a UMA conversion tool? Cool! Where do we find it?

Also, did the hair shaders ever get fixed?

Jaimi commented 4 years ago

Its on the UMA menu -- UMA/SRP/Convert to URP (LWRP).

That will convert (most) of the UMAMaterials. You will still need to run the URP conversion wizard that ships with URP.

The hair shaders do not work with URP, you will need to find a different shader, and modify the material and UMAMaterial for it.

albertodf1977 commented 4 years ago

Hi Jaimi, Thank you for your answer and sorry for my frustration… but I still have the problem, in the Built-in Render Pipeline and in the Universal Render Pipeline. I have my pink color "not set" character on scene. I have upgraded the Project into URP and same situation. Please, find attached the _BaseMap change and the console. Is it not posible to fix the problem in the Built-in Render Pipeline?. Maybe I have missed other step for URP?. Your help will be appreciated. Thanks a lot UMA Not Set 01 UMA Not Set 02

nks a lot !!!. Alberto

Jaimi commented 4 years ago

Alberto - no problem, but please post on the discord instead of here for questions. These closed issues are hard to get to .

https://discord.gg/5b39djg

albertodf1977 commented 4 years ago

HI Jaimi, Finally I solved the problem of missing material and the NOT SET texture. After reading in detail UMA´ scripts, I found the error. Inside the script "TextureMerge", internal void EnsureCapacity(int moduleCount), I have removed the code: // if (textureMergeRects != null && textureMergeRects.Length > moduleCount) // return; Now it is working fine !!! This code was avoiding creating the materials. So now I am happy, willing to continue using UMA asset stores. Thank you. Alberto

TranAnh9x commented 2 years ago

@Jaimi Hi! i bought UMA Hair pack Vol.2 on unity asset store and Now i want to convert to URP but it isn't work. Can you show me way make it work? Thank you T_T