Skip to content

Commit

Permalink
Merge branch 'master' into minimum-osc-support
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 authored Nov 2, 2024
2 parents c7d22c5 + 439ddcf commit 514f6b3
Show file tree
Hide file tree
Showing 47 changed files with 1,062 additions and 281 deletions.
2 changes: 1 addition & 1 deletion .docs/content/docs/basic-concept/index.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Avatar Optimizerは、アバターを非破壊的に最適化するためのツ
BlendShapeを統合すると、そのBlendShapeに対するアニメーションによる動作が変わってしまうため、これはバグとして扱われます。\
このバグを使用して、あるSkinned Mesh RendererのBlendShapeに対するアニメーションを、別のSkinned Mesh RendererのBlendShapeに対しても同時に作用させることができます。\
しかし、これはサポートされていない動作であり、他のコンポーネントが動作を壊すかもしれません。\
例えば、`AAO Trace and Optimize`コンポーネントの`BlendShapeを自動的に固定・除去する`は、このバグによって`AAO Merge Skinned Mesh`コンポーネントで統合されて動くようになる可能性があるBlendShapeであっても、固定・除去します。
例えば、`AAO Trace and Optimize`コンポーネントの`BlendShapeを最適化する`は、このバグによって`AAO Merge Skinned Mesh`コンポーネントで統合されて動くようになる可能性があるBlendShapeであっても、固定・除去します。

## Avatar Optimizerの振る舞いは将来のバージョンでも安定していますか? {#behavior-stability}

Expand Down
2 changes: 1 addition & 1 deletion .docs/content/docs/basic-concept/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ For example, `AAO Merge Skinned Mesh` component in 1.7.x or older merges BlendSh
This behavior is treated as a bug since this makes impossible to animate them separately.\
You may use this bug to sync the BlendShape animation of an Skinned Mesh Renderer with one of another Skinned Mesh Renderer.\
However, this is not supported behavior and some other components may break the behavior.\
For example, `Automatically Freeze BlendShape` in `AAO Trace and Optimize` component will freezes the BlendShapes which might be animated with this buggy behavior by being merged by `AAO Merge Skinned Mesh` component.
For example, `Optimize BlendShape` in `AAO Trace and Optimize` component will freezes the BlendShapes which might be animated with this buggy behavior by being merged by `AAO Merge Skinned Mesh` component.

## How is the behavior of Avatar Optimizer stable for future versions? {#behavior-stability}

Expand Down
7 changes: 5 additions & 2 deletions .docs/content/docs/reference/merge-physbone/index.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ MultiChildTypeはIgnoreになります。
それぞれの項目について、統合対象の項目から値をコピーする場合は`Copy`(すべての統合対象で値が同じ場合のみ有効)、
代わりに新しい値を設定する場合は`Override`を選択してください。

コライダーについては、`Merge`を選択して統合対象のコライダー一覧を統合することも出来ます
コライダーについては、`Merge`を選択して統合対象のコライダー一覧を統合することができます

Endpoint Positionについては、`Clear`を選択して[Clear Endpoint Position](../clear-endpoint-position)を使用することもできます。
Endpoint Positionについては、`Clear`を選択して[Clear Endpoint Position](../clear-endpoint-position)を使用することができます。

角度制限では、`Fix`を選択することで、ボーンに対する捻るような回転(Roll)の値を自動で揃えられます。
これにより、Rollの値だけが異なっているような場合に角度制限を纏めて適用することができます。
3 changes: 3 additions & 0 deletions .docs/content/docs/reference/merge-physbone/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ For each property, you may select `Copy` to copy value from source property
For colliders, you can select `Merge` to merge colliders array from source physbones.

For Endpoint Position, you can select `Clear` to apply [Clear Endpoint Position](../clear-endpoint-position)

For Limit Rotation, you can select `Fix` to fix different roll axis on the model.
If your model has different roll bones, you can limit their rotations together with this option.
22 changes: 11 additions & 11 deletions .docs/content/docs/reference/merge-skinned-mesh/index.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ weight: 21

このコンポーネントは、メッシュを指定していないSkinnedMeshRendererコンポーネントがある新規GameObjectに追加してください。(分類: [Source Edit Skinned Mesh Component](../../component-kind/edit-skinned-mesh-components#source-component))

{{< hint info >}}

[Trace And Optimize](../trace-and-optimize)が自動で同様の処理を行うため、大抵の場合、このコンポーネントを使用する必要はありません。

{{< /hint >}}

## 利点 {#benefits}

SkinnedMeshRendererを統合することでメッシュを変形させる処理の回数が減り、負荷が軽くなります。
Expand All @@ -27,19 +33,13 @@ Anchor Override等の設定を行うには、MergeSkinnedMeshのあるGameObject

{{< /hint >}}

また、このコンポーネントは、服のメッシュや体のメッシュを統合するのには適していますが、顔のメッシュを統合するのには適していません。\
BlendShapeは、頂点とBlendShapeの数に比例して負荷が大きくなる機能です。
顔のメッシュは一般的に多くのBlendShapeを持っているため、統合対象に含めると頂点数の増加により負荷が大きくなってしまいます。

同様に、体や服のメッシュのBlendShapeは固定・除去することを推奨します。
BlendShapeによる負荷を減らすために、体や服のメッシュのBlendShapeは固定・除去することを推奨します。\
[Freeze BlendShape](../freeze-blendshape)コンポーネントを統合対象・統合先のSkinnedMeshRendererコンポーネントのいずれか(または両方)に追加して、BlendShapeを固定・除去することが出来ます。
[Trace and Optimize](../trace-and-optimize)コンポーネントの`BlendShapeを自動的に固定・除去する`によっても同様の効果を得ることが出来ます。

{{< hint info >}}
[Trace and Optimize](../trace-and-optimize)コンポーネントの`BlendShapeを最適化する`によっても同様の効果を得ることが出来ます。

いくつかのケースでは、[Trace And Optimize](../trace-and-optimize)が自動で同様の処理を行うため、このコンポーネントを使用する必要がないかもしれません

{{< /hint >}}
以前のAvatar Optimizerは顔のメッシュを他のメッシュと統合することを推奨していませんでした
これは、Unity 2019でBlendShapeの多いメッシュを統合するとメッシュの負荷が大幅に増加してしまうためです。\
Unity 2022ではBlendShapeの負荷が改善されているため、その記述は取り下げられました。

## 設定 {#settings}

Expand Down
22 changes: 10 additions & 12 deletions .docs/content/docs/reference/merge-skinned-mesh/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Merges one or more SkinnedMeshRenderers and MeshRenderers into one SkinnedMeshRe

This component should be added to a new GameObject which has a SkinnedMeshRenderer component without Mesh specified. (Kind: [Source Edit Skinned Mesh Component](../../component-kind/edit-skinned-mesh-components#source-component))

{{< hint info >}}

[Trace And Optimize](../trace-and-optimize) will automatically do the same process, so in most cases you do not need to use this component.

{{< /hint >}}

## Benefits

Merging SkinnedMeshRenderer will reduce number of deforming mesh (skinning).
Expand All @@ -27,21 +33,13 @@ If you are using [Modular Avatar], you can add [`MA Mesh Settings`] component to

{{< /hint >}}

This component is good for merging your cloth meshes and body meshes but not good for face meshes because BlendShape can cause performance impact.
BlendShape is a feature became heavier in proportion to the count of vertices and BlendShapes.
Merging SkinnedMesh increases vertices and face mesh usually have many BlendShapes.
That's why it's not good to merge face meshes.

In addition, because of same reasons, you should freeze & remove unchanging BlendShapes for body / cloth meshes.
It's better to freeze & remove unchanging BlendShapes for body / cloth meshes to reduce BlendShape load.\
You can freeze & remove BlendShape using [Freeze BlendShape](../freeze-blendshape) component.
Add this component to both/either merge source SkinnedMeshRenderer and/or merged SkinnedMeshRenderer to freeze & remove BlendShapes.
Also, you can use `Automatically Freeze BlendShape` of [Trace and Optimize](../trace-and-optimize) component to get the same benefits.

{{< hint info >}}
Also, you can use `Optimize BlendShapes` of [Trace and Optimize](../trace-and-optimize) component to get the same benefits.

[Trace And Optimize](../trace-and-optimize) will automatically do the same process, so in some cases you do not need to use this component.

{{< /hint >}}
In previous versions of Avatar Optimizer, we recommended not merging face meshes due to merging BlendShape-heavy mesh will increase load on BlendShape much in Unity 2019.\
However, in Unity 2022, we no longer recommends not merging face meshes because the BlendShape load has been improved.

## Settings

Expand Down
5 changes: 3 additions & 2 deletions .docs/content/docs/reference/trace-and-optimize/index.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ Trace and Optimizeは「**見た目に絶対に影響させてはならない**
{{< /hint >}}

現在、以下の機能を使った自動最適化が可能です。
- `BlendShapeを自動的に固定・除去する`\
アニメーションなどで使われていないか、常に同じ値になっているBlendShapeを自動的に固定・除去します。
- `BlendShapeを最適化する`\
<small>以前は`BlendShapeを自動的に固定・除去する`という名前でしたが、機能が増えたため名前が変わりました。</small>\
アニメーションなどを走査して、BlendShapeを自動的に固定・除去・統合することでBlendShapeの数を削減します。
- `使われていないObjectを自動的に削除する`\
アニメーションなどを走査して、使われていないObject(GameObjectやコンポーネントなど)を自動的に削除します。\
また、切り替えるものと一緒に使われていて、他の方法で使われていないPhysBooneコンポーネントを自動的に切り替えるようにします。
Expand Down
5 changes: 3 additions & 2 deletions .docs/content/docs/reference/trace-and-optimize/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ We will fix it as much as we can.
{{< /hint >}}

Currently the following optimizations are applied automatically.
- `Automatically Freeze BlendShape`\
Automatically freezes BlendShapes which are always the same value or unused in animation, etc.
- `Optimize BlendShape`\
<small>Previously known as `Freeze BlendShapes` but renamed to add more functionality.</small>\
By scanning animation etc., remove, freeze, or merge BlendShapes automatically to reduce the number of BlendShapes.
- `Remove unused Objects`\
By scanning animation etc., automatically removes unused Objects (e.g. GameObjects, Components).\
In addition, this will automatically toggle PhysBone Components if they are only used by toggled objects.
Expand Down
15 changes: 12 additions & 3 deletions API-Editor/ShaderInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,25 @@ internal MaterialInformationCallback()
/// </summary>
/// <param name="propertyName">The name of the property in the material.</param>
/// <param name="considerAnimation">Whether to consider the animation of the property. If this is true, this function will never </param>
/// <returns>The integer value for the property in the material, which is same as <see cref="Material.GetInteger(string)"/>, or null if the property is not set or not found.</returns>
/// <returns>The integer value for the property in the material, which is same as <see cref="Material.GetInteger(string)"/>, or null if the property is animated.</returns>
[PublicAPI]
public abstract int? GetInteger(string propertyName, bool considerAnimation = true);

/// <summary>
/// Returns the int value for the property in the material, or null if the property is not set or not found.
/// </summary>
/// <param name="propertyName">The name of the property in the material.</param>
/// <param name="considerAnimation">Whether to consider the animation of the property. If this is true, this function will never </param>
/// <returns>The int value for the property in the material, which is same as <see cref="Material.GetInt(string)"/>, or null if the property is animated.</returns>
[PublicAPI]
public abstract int? GetInt(string propertyName, bool considerAnimation = true);

/// <summary>
/// Returns the float value for the property in the material, or null if the property is not set or not found.
/// </summary>
/// <param name="propertyName">The name of the property in the material.</param>
/// <param name="considerAnimation">Whether to consider the animation of the property. If this is true, this function will never </param>
/// <returns>The integer value for the property in the material, which is same as <see cref="Material.GetFloat(string)"/>, or null if the property is not set or not found.</returns>
/// <returns>The float value for the property in the material, which is same as <see cref="Material.GetFloat(string)"/>, or null if the property is animated.</returns>
[PublicAPI]
public abstract float? GetFloat(string propertyName, bool considerAnimation = true);

Expand All @@ -220,7 +229,7 @@ internal MaterialInformationCallback()
/// </summary>
/// <param name="propertyName">The name of the property in the material.</param>
/// <param name="considerAnimation">Whether to consider the animation of the property. If this is true, this function will never </param>
/// <returns>The integer value for the property in the material, which is same as <see cref="Material.GetVector(string)"/>, or null if the property is not set or not found.</returns>
/// <returns>The integer value for the property in the material, which is same as <see cref="Material.GetVector(string)"/>, or null if the property is animated.</returns>
[PublicAPI]
public abstract Vector4? GetVector(string propertyName, bool considerAnimation = true);

Expand Down
39 changes: 35 additions & 4 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ The format is based on [Keep a Changelog].

## [Unreleased]
### Added
- Automatically Merge Blendshape `#1300`
- This is new automatic optimization in Trace and Optimize
- This is a part of "Optimize BlendShape" optimization.
- AAO 1.8.0 introduced BlendShape support for Merge Skinned Mesh, but new default mode "Rename to avoid conflicts" would increase number of BlendShape.
- This feature is added to relax this problem by automatically merging multiple BlendShapes of one Mesh.
- With this feature, you can use rename mode without performance loss.
- Fix mode for PhysBone Limits in Merge PhysBone `#665`
- In addition to existing `Copy` and `Override`, we added `Fix` mode.
- This mode will try to correct roll axis by rotating bone.
- This feature allows you to configure the mode for PhysBone Limits in Merge PhysBone.
- This is useful if all configuration is same but roll axis is different.
- Automatically merging meshes which have BlendShapes `#1308`
- In previous version of Avatar Optimizer, meshes which have BlendShapes are not automatically merged.
- This was because BlendShape manipulation load is proportional to the number of vertices in Unity 2019.
- However, in Unity 2020 and later, BlendShape manipulation load is mostly proportional to the number of moving vertices.
- This means that increasing the number of vertices in a mesh which has BlendShapes does not increase the load of BlendShape manipulation much.
- Therefore, we decided to automatically merge such meshes.
- Improved OSC Gimmick Support `#1306`
- We added two information for OSC Gimmick in Asset Description.
- By defining parameters read / written by OSC Gimmick, your OSC Gimmick no longer breaks.
Expand All @@ -19,12 +36,25 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- NRE if specified expression parameters is None `#1303`
- This error only happens if you don't use Modular Avatar since Modular Avatar will assign parameters asset.
- "asset is not temporary asset" error if no Modular Avatar is used `#1304`
- Fix non-VRChat project support `#1310`
- 'shader' doesn't have a float or range property 'prop' error `#1312`
- Integer and Int confusion `#1313`
- NativeArray leak `#1314`
- Error if all components are on inactive GameObject`#1318`

### Security

## [1.8.0-beta.11] - 2024-10-27
### Changed
- Show version name on NDMF Console [`#1309`](https://github.com/anatawa12/AvatarOptimizer/pull/1309)

### Fixed
- NRE if specified expression parameters is None [`#1303`](https://github.com/anatawa12/AvatarOptimizer/pull/1303)
- This error only happens if you don't use Modular Avatar since Modular Avatar will assign parameters asset.
- "asset is not temporary asset" error if no Modular Avatar is used [`#1304`](https://github.com/anatawa12/AvatarOptimizer/pull/1304)
- Merge Skinned Mesh with Basic Mesh is not working [`#1307`](https://github.com/anatawa12/AvatarOptimizer/pull/1307)
- Validation system in Avatar Optimizer is not working [`#1307`](https://github.com/anatawa12/AvatarOptimizer/pull/1307)

## [1.8.0-beta.10] - 2024-10-26
### Added
- Right-click menu option to create a new GameObject with a specified component [`#1290`](https://github.com/anatawa12/AvatarOptimizer/pull/1290)
Expand Down Expand Up @@ -1690,7 +1720,8 @@ This release is mistake.
- Merge Bone
- Clear Endpoint Position

[Unreleased]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.8.0-beta.10...HEAD
[Unreleased]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.8.0-beta.11...HEAD
[1.8.0-beta.11]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.8.0-beta.10...v1.8.0-beta.11
[1.8.0-beta.10]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.8.0-beta.9...v1.8.0-beta.10
[1.8.0-beta.9]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.8.0-beta.8...v1.8.0-beta.9
[1.8.0-beta.8]: https://github.com/anatawa12/AvatarOptimizer/compare/v1.8.0-beta.7...v1.8.0-beta.8
Expand Down
Loading

0 comments on commit 514f6b3

Please sign in to comment.