yoship1639 / ValheimVRM

Mod to replace Valheim player with VRM model.
MIT License
55 stars 19 forks source link

Fails to load with Unity standard shader #29

Open imagitama opened 2 years ago

imagitama commented 2 years ago

ValheimVRM 1.20.0 (latest) Valheim 0.209.10 (latest) BepInEx 5.4.19.0 (latest) UniVRM 0.100.1 (latest)

Using default bepinex + valheimVRM player config

When I export my VRM model from Unity using UniVRM using the Unity Standard shader I get an error:

[Message:   BepInEx] BepInEx 5.4.19.0 - valheim (23/06/2022 1:01:13 PM)
[Info   :   BepInEx] Running under Unity v2020.3.33.9525882
[Info   :   BepInEx] CLR runtime version: 4.0.30319.42000
[Info   :   BepInEx] Supports SRE: True
[Info   :   BepInEx] System platform: Bits64, Windows
[Message:   BepInEx] Preloader started
[Info   :   BepInEx] Loaded 1 patcher method from [BepInEx.Preloader 5.4.19.0]
[Info   :   BepInEx] 1 patcher plugin loaded
[Info   :   BepInEx] Patching [UnityEngine.CoreModule] with [BepInEx.Chainloader]
[Message:   BepInEx] Preloader finished
[Message:   BepInEx] Chainloader ready
[Message:   BepInEx] Chainloader started
[Info   :   BepInEx] 2 plugins to load
[Info   :   BepInEx] Loading [ValheimVRM 1.2.0.0]
[Info   : Unity Log] [ValheimVRM] Add Shader: UniGLTF/NormalMapDecoder
[Info   : Unity Log] [ValheimVRM] Add Shader: UniGLTF/NormalMapEncoder
[Info   : Unity Log] [ValheimVRM] Add Shader: UniGLTF/StandardVColor
[Info   : Unity Log] [ValheimVRM] Add Shader: VRM/UnlitCutout
[Info   : Unity Log] [ValheimVRM] Add Shader: VRM/UnlitTexture
[Info   : Unity Log] [ValheimVRM] Add Shader: VRM/UnlitTransparent
[Info   : Unity Log] [ValheimVRM] Add Shader: VRM/UnlitTransparentZWrite
[Info   : Unity Log] [ValheimVRM] Add Shader: VRM/MToon
[Info   : Unity Log] [ValheimVRM] Add Shader: UniGLTF/UniUnlit
[Info   :   BepInEx] Loading [Display BepInEx Info In-Game 2.0.0]
[Message:   BepInEx] Chainloader startup complete
[Info   : Unity Log] 06/23/2022 14:23:09: Starting to load scene:start
[Warning: Unity Log] Only custom filters can be played. Please add a custom filter or an audioclip to the audiosource (Amb_MainMenu).
[Info   : Unity Log] 06/23/2022 14:23:11: Using environment
[Info   : Unity Log] 06/23/2022 14:23:11: Using steam
Setting breakpad minidump AppID = 892970
SteamInternal_SetMinidumpSteamID:  Caching Steam ID: 
[Info   : Unity Log] 06/23/2022 14:23:11: Authentication:k_ESteamNetworkingAvailability_Attempting
[Info   : Unity Log] 06/23/2022 14:23:11: Steam initialized
[Info   : Unity Log] 06/23/2022 14:23:11: Using default prefs
[Info   : Unity Log] 06/23/2022 14:23:11: Valheim version:0.209.10
[Info   : Unity Log] 06/23/2022 14:23:11: Render threading mode:MultiThreaded
[Warning: Unity Log] 06/23/2022 14:23:11: Missing audio clip in music respawn
[Info   : Unity Log] 06/23/2022 14:23:11: Checking for installed DLCs
[Info   : Unity Log] 06/23/2022 14:23:11: DLC:beta installed:False
[Info   : Unity Log] 06/23/2022 14:23:12: Loaded localization CSV:localization language:English
[Info   : Unity Log] 06/23/2022 14:23:12: Loaded localization CSV:localization_extra language:English
[Info   : Unity Log] 06/23/2022 14:23:12: Loaded localization CSV:localization language:English
[Info   : Unity Log] 06/23/2022 14:23:12: Loaded localization CSV:localization_extra language:English
[Info   : Unity Log] [ValheimVRM] ModelScale: 1.1
[Error  : Unity Log] System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: shader
  at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
  at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00008] in <c9fb31c2eee14ce4aeb36e4c61e154d8>:0
  at VRMShaders.OcclusionMetallicRoughnessConverter.get_Importer () [0x00017] in <3f747b53ad014ea5b3f09bc03783a885>:0
  at VRMShaders.OcclusionMetallicRoughnessConverter.Import (UnityEngine.Texture2D metallicRoughnessTexture, System.Single metallicFactor, System.Single roughnessFactor, UnityEngine.Texture2D occlusionTexture, System.Boolean isLegacySquaredRoughness) [0x0002b] in <3f747b53ad014ea5b3f09bc03783a885>:0
  at VRMShaders.TextureFactory+<GetTextureAsync>d__13.MoveNext () [0x00464] in <3f747b53ad014ea5b3f09bc03783a885>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at UniGLTF.ImporterContext+<LoadTexturesAsync>d__32.MoveNext () [0x000b1] in <0290791accc8417eaf81f34d0ccd7a61>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at UniGLTF.ImporterContext+<LoadAsync>d__28.MoveNext () [0x00155] in <0290791accc8417eaf81f34d0ccd7a61>:0
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
  at UniGLTF.ImporterContextExtensions.Load (UniGLTF.ImporterContext self) [0x00048] in <0290791accc8417eaf81f34d0ccd7a61>:0
  at ValheimVRM.Patch_Player_Awake.ImportVRM (System.String path, System.Single scale) [0x00018] in <9c68d11521304d628b2678b7157d1eb5>:0
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: shader
  at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
  at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00008] in <c9fb31c2eee14ce4aeb36e4c61e154d8>:0
  at VRMShaders.OcclusionMetallicRoughnessConverter.get_Importer () [0x00017] in <3f747b53ad014ea5b3f09bc03783a885>:0
  at VRMShaders.OcclusionMetallicRoughnessConverter.Import (UnityEngine.Texture2D metallicRoughnessTexture, System.Single metallicFactor, System.Single roughnessFactor, UnityEngine.Texture2D occlusionTexture, System.Boolean isLegacySquaredRoughness) [0x0002b] in <3f747b53ad014ea5b3f09bc03783a885>:0
  at VRMShaders.TextureFactory+<GetTextureAsync>d__13.MoveNext () [0x00464] in <3f747b53ad014ea5b3f09bc03783a885>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at UniGLTF.ImporterContext+<LoadTexturesAsync>d__32.MoveNext () [0x000b1] in <0290791accc8417eaf81f34d0ccd7a61>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at UniGLTF.ImporterContext+<LoadAsync>d__28.MoveNext () [0x00155] in <0290791accc8417eaf81f34d0ccd7a61>:0
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.ArgumentNullException: Value cannot be null.
Parameter name: shader
  at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
  at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00008] in <c9fb31c2eee14ce4aeb36e4c61e154d8>:0
  at VRMShaders.OcclusionMetallicRoughnessConverter.get_Importer () [0x00017] in <3f747b53ad014ea5b3f09bc03783a885>:0
  at VRMShaders.OcclusionMetallicRoughnessConverter.Import (UnityEngine.Texture2D metallicRoughnessTexture, System.Single metallicFactor, System.Single roughnessFactor, UnityEngine.Texture2D occlusionTexture, System.Boolean isLegacySquaredRoughness) [0x0002b] in <3f747b53ad014ea5b3f09bc03783a885>:0
  at VRMShaders.TextureFactory+<GetTextureAsync>d__13.MoveNext () [0x00464] in <3f747b53ad014ea5b3f09bc03783a885>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at UniGLTF.ImporterContext+<LoadTexturesAsync>d__32.MoveNext () [0x000b1] in <0290791accc8417eaf81f34d0ccd7a61>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at UniGLTF.ImporterContext+<LoadAsync>d__28.MoveNext () [0x00155] in <0290791accc8417eaf81f34d0ccd7a61>:0 <---
<---
[Info   : Unity Log] 06/23/2022 14:23:13: UI Group status changed Menu = True
[Info   : Unity Log] 06/23/2022 14:23:15: UI Group status changed Menu = True

When I switch to VRM/MToon it all works correctly:

image

The mod says it supports standard shader so I think it needs to be modified to support it

johnnyvulpine commented 2 years ago

I am having the same issue but, switching to use the MToon shader does not fix the problem.

Here is what I am currently running: ValheimVRM 1.20.0 (latest) Valheim 0.211.9 (latest) denikson-BepInExPack_Valheim-5.4.1901 (latest) UniVRM 0.105.0 (latest)

KingAzaz commented 1 year ago

Having the same issue here, any word on a fix?