Coder Social home page Coder Social logo

d4rkavataroptimizer's People

Contributors

coriullusfox avatar d4rkc0d3r avatar float3 avatar fraxul avatar orels1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

d4rkavataroptimizer's Issues

d4rkAvatarOptimizer.cs Error CS0246: The type or namespace name 'IEditorOnly' could not be found

Freshly imported this into my project and have been getting this without fail. Tried importing it into a brand-new project and getting the same thing. Not sure exactly how to fix it. Unity won't go into play mode because of this, as well.

Packages\d4rkpl4y3r.d4rkavataroptimizer\Editor\d4rkAvatarOptimizer.cs(27,51): error CS0246: The type or namespace name 'IEditorOnly' could not be found (are you missing a using directive or an assembly reference?)

Using the 'https://d4rkc0d3r.github.io/vpm-repos/main.json' repository to import the optimizer

I hope it could support Poiyomi Shaders

Sometimes it works, sometimes it not. I have unlocked all shaders before optimization. After optimization, my avatar turns pure black. Could you have a look?

Material merging results in corrupted material/textures

Using Silent's Crosstone, I've been trying to merge 4 materials together, but the results are a bit... complicated.

There's something like a 50-50 chance that the merged materials result as either

Unity_vhzFT5Lbz9

or

Unity_dUrDqaVgFh

The latter looks almost right, but with strange shadow stepping along the hair.

Both produce an identical error message:

Unity_3Enc5MqoGa

I've attached the resulting shader/material for result 1 and 2.
result 1.zip
result 2.zip

Release as UPM/VPM Package

would be nice to have, also later down the line maybe VRC could even have the package in the VCC, making quick and easy optimization more popular and accessible.

I personally would like to use the UPM, but the formats should be compatible either way. If you need help setting up a package manifest or the assembly definition I'd be happy to help, I could even PR this myself if you like.

Shader issue?

Optimizer failing generating shader. Using Sunao Shader and a pure 512x512 one color texute.

image
image
image
image

(modular avatar compatibility)Compatibility support for NDMF

Although not yet in its official version, modular avatar is in the process of introducing NDMF, a non-destructive modification system compatibility system.
It seems to me that this process needs to be taken into consideration when dealing with modular avatar in the future.

https://ndmf.nadena.dev

(modular avatar互換性)NDMFへの互換性対応
まだ正式版ではないですが、modular avatarがNDMFという非破壊改変システムの互換システムの導入を進めています。
今後modular avatarへの対応を行う場合、この処理を考慮する必要があるように思います。

Lyuma's Waifu2D slight incompatibility

https://github.com/lyuma/LyumaShader#waifu2d
It seems that Lyuma's Waifu2D causes some strange behavior, where it stops working somewhat on optimized copy.
In my case my Body mesh and witch hat were the only ones that were still being able to turn 2D, because for unknown reason animation paths for them were not altered in animation files:
Unity_2022-11-05_02-41-45
When I replaced these affected animations with ones from the unoptimized version of my avatar all of its effects worked fine.
I guess that Waifu2D's modifications should be applied to shaders on optimized copy and if possible it's specific animation paths be not affected by optimizer?
Waifu2D seems to add some sort of comment to any shader it modified so that it can't be affected twice, which I guess could be also utilized to detect its presence by the optimizer.
Unity_2022-11-05_02-55-35

IndexOutOfRangeException Error

Version: 3.1.2
Log:

IndexOutOfRangeException: Index was outside the bounds of the array.
d4rkAvatarOptimizer+<>c.<AnalyzeFXLayerMergeAbility>b__153_25 (UnityEditor.Animations.ChildAnimatorState s) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:1418)
System.Linq.Enumerable.Any[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkAvatarOptimizer.AnalyzeFXLayerMergeAbility () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:1418)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:193)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <a259d3c004024353a2c217da97495055>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Null pointer error on Create Optimized Copy

Getting the following when running the optimizer, it does spit out a copy but as far as I can tell no optimizations are being applied

NullReferenceException: Object reference not set to an instance of an object
d4rkAvatarOptimizerEditor.OptimizeMaterialSwapMaterials () (at Assets/d4rkAvatarOptimizer/src/d4rkAvatarOptimizerEditor.cs:551)
d4rkAvatarOptimizerEditor.Optimize (UnityEngine.GameObject toOptimize) (at Assets/d4rkAvatarOptimizer/src/d4rkAvatarOptimizerEditor.cs:2399)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Assets/d4rkAvatarOptimizer/src/d4rkAvatarOptimizerEditor.cs:2798)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Let me know any other information you need, as I'm unsure what is relevant

Unchecking Merge Static meshes as skinned causes errors

I have quite a complex avatar with some props that I do not want to get merged as meshes, since I suspect it could break stuff.
Unchecking Merge Static Meshes as Skinned or Merge Skinned Meshes causes Merge preview and Debug info to disappear and spews a lot of the same error in console:

IndexOutOfRangeException: Index was outside the bounds of the array.
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Assets/d4rkAvatarOptimizer/src/d4rkAvatarOptimizerEditor.cs:2999)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Edit: after some debugging it seems that even just adding AvatarProp root object from ThatFatKidsMom prefab as an exclusion to optimizer causes above error. Adding "object container" for your prop works fine.
Link to that prefab: https://github.com/ThatFatKidsMom/Avatar-Prop

MissingReferenceException: The object of type 'SkinnedMeshRenderer' has been destroyed

I have tried the optimizer with modular avatar. Sometime I succeed, some time not. Here is the console information.

Screenshot_5

MissingReferenceException: The object of type 'SkinnedMeshRenderer' 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.
d4rkAvatarOptimizer.GetPathToRoot (UnityEngine.Component component) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:585)
d4rkAvatarOptimizer.FindAllPhysBonesToDisable () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:1699)
d4rkAvatarOptimizer.Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:139)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:130)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

NullReferenceException: Object reference not set to an instance of an object.

I'm having a trouble with NullReferenceEXception. I tried 2 projects, am I doing something wrong/missing? I import it, add component and start the optimization. I get this error and left with new gameobject that has "(Broken)" in it. The only values that change are mesh renderers to skinned mesh renderers and that's it. If I try unchecking Merge Static Meshes as Skinned it still errors out. I'm using the newest VRCSDK.

image

Poiyomi 8.2 Optimization Errors

Error optimizing shader .poiyomi/Poiyomi 8.2/Poiyomi Pro: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at d4rkpl4y3r.ShaderOptimizer.Run () [0x00137] in C:\Users\sysmin\AppData\Local\VRChatProjects\Maya-2\Assets\d4rkAvatarOptimizer\src\ShaderAnalyzer.cs:1980 
  at d4rkpl4y3r.ShaderOptimizer.Run (d4rkpl4y3r.ParsedShader source, System.Collections.Generic.Dictionary`2[TKey,TValue] staticPropertyValues, System.Int32 mergedMeshCount, System.Collections.Generic.List`1[T] mergedMeshNames, System.Collections.Generic.HashSet`1[T] defaultAnimatedProperties, System.Collections.Generic.List`1[T] mergedMeshIndices, System.Collections.Generic.Dictionary`2[TKey,TValue] arrayPropertyValues, System.Collections.Generic.Dictionary`2[TKey,TValue] texturesToNullCheck, System.Collections.Generic.HashSet`1[T] texturesToMerge, System.Collections.Generic.Dictionary`2[TKey,TValue] animatedPropertyValues, System.Collections.Generic.List`1[T] setKeywords) [0x001c5] in C:\Users\sysmin\AppData\Local\VRChatProjects\Maya-2\Assets\d4rkAvatarOptimizer\src\ShaderAnalyzer.cs:1025 
UnityEngine.Debug:LogError (object)
d4rkpl4y3r.ShaderOptimizer:Run (d4rkpl4y3r.ParsedShader,System.Collections.Generic.Dictionary`2<string, string>,int,System.Collections.Generic.List`1<string>,System.Collections.Generic.HashSet`1<System.ValueTuple`2<string, bool>>,System.Collections.Generic.List`1<int>,System.Collections.Generic.Dictionary`2<string, System.ValueTuple`2<string, System.Collections.Generic.List`1<string>>>,System.Collections.Generic.Dictionary`2<string, string>,System.Collections.Generic.HashSet`1<string>,System.Collections.Generic.Dictionary`2<string, string>,System.Collections.Generic.List`1<string>) (at Assets/d4rkAvatarOptimizer/src/ShaderAnalyzer.cs:1029)
d4rkAvatarOptimizerEditor/<>c__DisplayClass62_0:<CreateOptimizedMaterials>b__1 (int) (at Assets/d4rkAvatarOptimizer/src/d4rkAvatarOptimizerEditor.cs:1253)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

Many of my meshes fail to combine when using Poiyomi 8.2
I had started adding meshes that failed to the exclusions, but it was failing on almost every single one (some passed fine).
err.unitypackage.gz

Separate "exclusion list" windows and bake button

It is too slow to make any modifications on the script attached to the avatar.

I am facing an issue where after optimizations, "some" of the toggles attached to hand bones failed to be previewed in editor play mode. So before optimization, Object A is default off and could be toggled on with ParameterA true. However, after optimizations, it is default off and could not be toggled on, even if the remapped animations and parameters/menu have no problems. This only happens with gesture manager in editor play mode. I want to provide more information, but it takes years to add/remove exclusion lists and bake optimalized copies to locate which asset is causing problems.

It turns out that a performant avatar will not face this issue of editor's bad performance. But in fact, the bad the avatar is, the more optimization is in need. Therefore, I think a separate exclusion list window will help a lot. Debug info is also too hard to be read, maybe a button to save log locally will benefit both the users and developers.

Shader parser fails to parse #include

I've tried using the optimiser on my avatar which uses custom shaders and noticed it failing to parse materials. Upon further inspection I have deduced that the shader analyser fails to parse #include <someUnityInclude.cginc>. The shader analyser assumes the include path is wrapped in double quotes, however Unity also happily compiles includes wrapped with <>, which I'm using to make clearer which includes are my own and which are built-in to Unity.

Index out of range exception

no matter what settings i use i get this error

IndexOutOfRangeException: Index was outside the bounds of the array.
d4rkAvatarOptimizer+<>c__DisplayClass119_3.<CombineSkinnedMeshes>b__18 (System.Int32 i) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:2531)
System.Linq.Enumerable+SelectIPartitionIterator`2[TSource,TResult].PreallocatingToArray (System.Int32 count) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable+SelectIPartitionIterator`2[TSource,TResult].ToArray () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkAvatarOptimizer.CombineSkinnedMeshes () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:2530)
d4rkAvatarOptimizer.Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:95)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:959)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <a259d3c004024353a2c217da97495055>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Automatically unlock Thry/Poiyomi materials

I am not sure if thry exposes the UnlockAll() and LockAll() methods, but if they don't, it probably wouldn't be hard to just ask them to do that. Then locked in materials could be automatically unlocked and optimized.

Should add a "Automatically unlock materials" option.

Having skinned mesh/mesh components disabled can produce incorrect results in optimized copy

As in title.
Apparently toggling skinned mesh/mesh components is way more performant than toggling the entire gameobject with mesh on it.
It seems though that optimizer does not seem to properly support these kind of scenarios and produces a copy where meshes are not getting enabled/disabled the same way as on input avatar.
To reproduce try to switch your gameobject toggles into skinned mesh component toggles in hierarchy and in animations, aka you toggle lower checkbox instead of upper one:
Unity_2022-11-03_15-29-04

Material swaps prevent material slots merging even if target materials end up being the same per mesh

I used to use inventory system from SCSS or UDIM Discard feature from Poiyomi to toggle parts of meshes on or off.
For this model I decided to use ACLS shader, which doesn't have any feature like this, so I needed to actually split my meshes to accommodate for this feature, since this optimizer is supposed to add a similar logic to any compatible shader.
Additionally I have a single material swap for all my meshes that changes its style.
I suppose because of this material swap, materials are not getting merged.
After I remove material swap logic from my animator, they do get merged as I would expect.
To reiterate, my material swap is like this, same named materials are the same:

2022-08-31_20-45-05
Unity_2022-08-31_20-40-57

Version of d4rkAvatarOptimizer used: https://github.com/d4rkc0d3r/d4rkAvatarOptimizer/tree/b70e6f1c76ebcfc16f3ef55c35758ea530ad582a

Animations affecting transforms of objects that have had their parents removed are not updated properly

This issue occurs on the nardoragon base and probably others, but this is the only one I've seen doing this so far
image
there is a bone named "TailRoot" that is never moved from it's original position contains another object named "Tail1" which is moved.

there is a set of animations which rotate Tail1 but the avatar optimiser removes TailRoot so the animations that effect Tail1 have a significant offset since TailRoot had an X rotation of -85.743, which the optimiser correctly applies to Tail1, but not to the animations that affect it

Tail1 rotation pre-optimisation is X -24.335, post-optimisation is X -110.079, but the idle animation resets it to -24.335 causing this issue to occur (the tail is too high)
image
it should look like this:
image

"KeyNotFoundException" when Delete Unused Components is On

I can successfully use Full preset with Delete Unused Components turned off, but when I try to create optimized copy with Delete Unused Components ticked, it gives following error:

KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
d4rkAvatarOptimizer+<>c__DisplayClass205_1.<CombineAndOptimizeMaterials>b__21 (d4rkAvatarOptimizer+MaterialSlot slot) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:3336)
System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Set`1[TElement].UnionWith (System.Collections.Generic.IEnumerable`1[T] other) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable+DistinctIterator`1[TSource].FillSet () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable+DistinctIterator`1[TSource].ToList () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkAvatarOptimizer+<>c__DisplayClass205_1.<CombineAndOptimizeMaterials>b__4 (System.Collections.Generic.List`1[T] list) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:3336)
System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].ToList () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkAvatarOptimizer.CombineAndOptimizeMaterials () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:3336)
d4rkAvatarOptimizer.Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:154)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:130)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <a259d3c004024353a2c217da97495055>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Extra check/viewing with fallback shaders not being a thing

Not too sure how to word this but there's no way to view how optimised avatars will look when a fallback shader is used.
Currently, the only way to view the avatar with shaders unloaded is with another person and vrc account.

This is a rather large issue in my eyes as the optimiser could merge meshes together that with the shader, look like normal. But when a user does not have the shader loaded, they could be seeing the avatar very differently.

Say I had an asset that I wanted off by default but could toggle on. The optimisation process might merge it with a mesh that's always displayed. To a user that doesn't have the shader loaded, this means they will see the asset that is supposed to be hidden while the user of the avatar is unaware. An example of this, the optimiser might merge an aspect of a 'dps asset' into the body. To the user and their friends, nothing is showing. To a user with shaders disabled, they'd be seeing something that was not intended to be shown. I know dps meshes are usually auto except but the attached asset might have other meshes or materials that are equally not showable.

Having to get a friend to disable their shaders and check what optimised avatars look like every time I want to update an avatar is a real pain. Some easy way to view what the avatar looks like to a user with shaders disabled would help a ton.

Blend shape index out of range

My optimization failed because of the following problem:

ArgumentException: Blend shape index out of range.
d4rkAvatarOptimizer.CombineSkinnedMeshes () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:2765)
d4rkAvatarOptimizer.Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:95)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:959)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <a259d3c004024353a2c217da97495055>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

This could be fixed when I exclude the problematic skinned mesh, named body. It includes 286 Blend Shapes, is this a problem?

UnityExceptions; Unable to optimize post weird behaviour

KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary2[TKey,TValue].get_Item (TKey key) (at <eae584ce26bc40229c1b1aa476bfa589>:0) d4rkAvatarOptimizer+<>c__DisplayClass120_1.<CombineAndOptimizeMaterials>b__20 (d4rkAvatarOptimizer+MaterialSlot slot) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:2464) System.Linq.Enumerable+SelectListIterator2[TSource,TResult].MoveNext () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Set1[TElement].UnionWith (System.Collections.Generic.IEnumerable1[T] other) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable+DistinctIterator1[TSource].FillSet () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.Enumerable+DistinctIterator1[TSource].ToList () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) d4rkAvatarOptimizer+<>c__DisplayClass120_1.<CombineAndOptimizeMaterials>b__4 (System.Collections.Generic.List1[T] list) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:2464)
System.Linq.Enumerable+SelectListIterator2[TSource,TResult].ToList () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkAvatarOptimizer.CombineAndOptimizeMaterials () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:2464)
d4rkAvatarOptimizer.Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:131)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:93)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

//////////////////

Couldn't create asset file!
UnityEngine.StackTraceUtility:ExtractStackTrace ()
d4rkAvatarOptimizer:CreateUniqueAsset (UnityEngine.Object,string) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:293)
d4rkAvatarOptimizer:FixAnimationClipPaths (UnityEngine.AnimationClip) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:602)
d4rkAvatarOptimizer:FixAllAnimationPaths () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:703)
d4rkAvatarOptimizer:Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:144)
d4rkAvatarOptimizerEditor:OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:93)
UnityEngine.GUIUtility:ProcessEvent (int,intptr)

//////////////////

UnityException: Creating asset at path failed.
d4rkAvatarOptimizer.CreateUniqueAsset (UnityEngine.Object asset, System.String name) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:293)
d4rkAvatarOptimizer.FixAnimationClipPaths (UnityEngine.AnimationClip clip) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:602)
d4rkAvatarOptimizer.FixAllAnimationPaths () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:703)
d4rkAvatarOptimizer.Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:144)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:93)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Render queue not preserved

One of the materials on my avatar's render queue is not preserved when generating the optimised shaders and materials. I have it set to a render queue of 1600, however upon optimising, the optimised variant's render queue option is reset to 2000.

Shader errors with latest version of Silent's Crosstone

The latest release of Silent's Crosstone (still on the testing branch for now) is yielding errors that visually look similar to issue #5 with stair-stepped shadows. This is when running the optimizer with the same settings as before, with only merging different materials checked, along with same dimension textures.

Unity_nDQhpnYq6a

The Unity console shares these errors with me:

Unity_zNxVq4V1CI

And the offending generated shaders:

shaders.zip

VRAM savings from removing unused blendshapes not as high as when done through Blender

Comparisons done using the VRAM Calculator from Thry's VRAM performance tools, using:

  • a modified version of the Bestboi Chibi avatar base
  • comparing only the Body mesh (which is the mesh that the majority of the VRAM usage comes from)
  • with only "Use Ring Finger as Foot Collider" enabled and 0 exclusions
  • with the following passes commented out: (I might have gone overboard, but I didn't want it touching my materials for now, damnit)
    • OptimizeMaterialSwapMaterials
    • CreateTextureArrays
    • CombineAndOptimizeMaterials
    • OptimizeMaterialsOnNonSkinnedMeshes
    • SaveOptimizedMaterials

Results:

  • Unoptimized (53 blendshapes, 57 bones): 11.39 MiB
  • OptimizedCopy from this tool (28 blendshapes, 52 bones): 11.02 MiB
  • Blendshapes removed using blender (28 blendshapes, 57 bones): 8.94 MiB
    • I tried to remove exactly the same blendshapes as this tool did.

Unfortunately, this isn't 100% rigorous:

  • I commented out some passes, so it's possible that I accidentally commented out a pass that actually reduces the amount of blendshape information kept around?
    • I don't think this is the case, because the blendshapes do actually appear to be removed from the optimized mesh
  • The tool is doing more than I did in blender because I only removed/baked blendshapes.
    • but to me that just says that the other optimizations aren't making up for this going wrong?

If you want I can work on making a reproduction case that I can send to you that isn't <my personal avatar>

Optimizer failed

SDK 3.3.0
Optimizer 3.1.1

I am trying to optimize a complicated avatar with a lot of modular avatars. I do not know which one is causing the issue, I have tried to disable PB optimization, but it still fails.

InvalidOperationException: Sequence contains no elements
System.Linq.Enumerable.Max[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] selector) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkpl4y3r.AvatarOptimizer.AnimatorOptimizer.g__ConvertStateToMotion|19_1 (UnityEditor.Animations.AnimatorState s) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/AnimatorOptimizer.cs:226)
d4rkpl4y3r.AvatarOptimizer.AnimatorOptimizer.b__19_8 (UnityEditor.Animations.ChildAnimatorState x) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/AnimatorOptimizer.cs:267)
System.Linq.Enumerable+SelectArrayIterator2[TSource,TResult].ToArray () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
d4rkpl4y3r.AvatarOptimizer.AnimatorOptimizer.MergeLayers () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/AnimatorOptimizer.cs:267)
d4rkpl4y3r.AvatarOptimizer.AnimatorOptimizer.Run () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/AnimatorOptimizer.cs:115)
d4rkpl4y3r.AvatarOptimizer.AnimatorOptimizer.Run (UnityEditor.Animations.AnimatorController source, System.String path, System.Collections.Generic.Dictionary2[TKey,TValue] fxLayerMap, System.Collections.Generic.List1[T] layersToMerge, System.Collections.Generic.List`1[T] layersToDestroy) (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/AnimatorOptimizer.cs:63)
d4rkAvatarOptimizer.FixAllAnimationPaths () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:1094)
d4rkAvatarOptimizer.Optimize () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizer.cs:167)
d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Packages/d4rkpl4y3r.d4rkavataroptimizer/Editor/d4rkAvatarOptimizerEditor.cs:134)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.b__0 () (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Merge Same Ratio Blend Shapes causes idle expressions stop to work

I have set mood sets for avatar with CGE. (https://hai-vr.github.io/combo-gesture-expressions-av3/). When I toggle on parameter A, the mood set is switched to SetA, and the idle expressions include many shape key changes. However, I found that some of the blendshape keys are not set to the expected 100 value after optimization with "merge same ratio Blendshapes" on. It seems that the related Blenshape keys are merged to another shape keys, and there is no shape keys being applied at idle conditions.
MergeRatio.zip

Support UsePass in material & mesh merging

I have never seen UsePass before, but it seems to be used in lilToon to import a whole pass from another shader or a hlsl file into the shader.
Usually I optimize all my meshes and materials manually in blender and use poiyomi or my own shader, but I thought I could quickly and easily merge the 24 meshes on this cursed booth model xD
So yeah, I am by far not a shader wizard, so would be pretty sick if you figured out how to merge that. Or at least combined all materials with the same shader

Have no idea what I'm doing wrong

I only have the VRchatSDK and the add-on in the project adding a model still give me this error.
Assets\d4rkAvatarOptimizer\src\d4rkAvatarOptimizerEditor.cs(2840,54): error CS0117: 'AvatarValidation' does not contain a definition for 'RemoveIllegalComponents'

Out of range error cancelling optimisation

When trying to optimise with only Merge Different Property Materials selected, the process is aborted with the error below. The avatar also contains 3 unparsable materials (out of a total of 11), if that's relevant?

Unity_n98yetFWqy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.