Skip to content

Commit

Permalink
Merge branch 'master' into MirrorOther-1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ishiiyuki committed Oct 12, 2024
2 parents 469f50a + 4d8a3b4 commit 2723550
Show file tree
Hide file tree
Showing 92 changed files with 525 additions and 246 deletions.
15 changes: 15 additions & 0 deletions Assets/lilToon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.8.1] - 2024-10-09
### Fixed
- SDF Face Shadow direction

## [1.8.0] - 2024-10-09
### Added
- Property animations can now be taken into account when optimizing materials from external tools
- SDF Face Shadow
- LTCGI
- Rim light for fur

### Fixed
- Fixed to search all scenes when building
- UV Discard not working with ShadowCaster

## [1.7.3] - 2024-04-08
### Fixed
- ShadowCaster disappears when the outline is deleted
Expand Down
15 changes: 15 additions & 0 deletions Assets/lilToon/CHANGELOG_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.8.1] - 2024-10-09
### Fixed
- SDF顔影の処理の方向を修正

## [1.8.0] - 2024-10-09
### 追加
- 外部ツールからマテリアルの最適化を行う際にアニメーションを考慮できるようにした
- SDF顔影機能を追加
- LTCGIに対応
- ファーのリムライト

### 修正
- ビルド時に全シーンを探索するように修正
- UV DiscardがShadowCasterで動作しない問題を修正

## [1.7.3] - 2024-04-08
### 修正
- アウトラインの頂点が削除される場合に深度の書き出しが正しく動作しない問題を修正
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,9 @@
_FurRootOffset ("sRootWidth", Range(-1,0)) = 0
_FurCutoutLength ("Cutout Length", Float) = 0.8
_FurTouchStrength ("sTouchStrength", Range(0, 1)) = 0
_FurRimColor ("sColor", Color) = (0.0,0.0,0.0,1.0)
[PowerSlider(3.0)]_FurRimFresnelPower ("sFresnelPower", Range(0.01, 50)) = 3.0
_FurRimAntiLight ("sAntiLight", Range(0, 1)) = 0.5

//----------------------------------------------------------------------------------------------------------------------
// Fur Advanced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
_FurRootOffset ("sRootWidth", Range(-1,0)) = 0
_FurCutoutLength ("sLength+ (Cutout)", Float) = 0.8
_FurTouchStrength ("sTouchStrength", Range(0, 1)) = 0
_FurRimColor ("sColor", Color) = (0.0,0.0,0.0,1.0)
[PowerSlider(3.0)]_FurRimFresnelPower ("sFresnelPower", Range(0.01, 50)) = 3.0
_FurRimAntiLight ("sAntiLight", Range(0, 1)) = 0.5

//----------------------------------------------------------------------------------------------------------------------
// Fur Advanced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
_FurRootOffset ("sRootWidth", Range(-1,0)) = 0
_FurCutoutLength ("sLength+ (Cutout)", Float) = 0.8
_FurTouchStrength ("sTouchStrength", Range(0, 1)) = 0
_FurRimColor ("sColor", Color) = (0.0,0.0,0.0,1.0)
[PowerSlider(3.0)]_FurRimFresnelPower ("sFresnelPower", Range(0.01, 50)) = 3.0
_FurRimAntiLight ("sAntiLight", Range(0, 1)) = 0.5

//----------------------------------------------------------------------------------------------------------------------
// Fur Advanced
Expand Down
1 change: 1 addition & 0 deletions Assets/lilToon/Editor/CurrentRP.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
BRP
Direct3D11

1 change: 1 addition & 0 deletions Assets/lilToon/Editor/Resources/lang.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ sColorFromMain Get color from Main メインカラーから色を取得 메인
sFurSetting Fur ファー設定 퍼 설정 毛发设置 毛皮設置
sFurTips You can set the length and direction of the fur. ファーの長さや向き、質感の設定ができます 퍼의 길이와 방향, 질감을 설정할 수 있습니다 你可以设置毛发的长度和方向。 你可以設置毛皮的長度和方向。
sFur Fur ファー 퍼 毛发 毛皮
sAntiLight Anti Light Anti Light Anti Light Anti Light Anti Light
sGravity Gravity 重力 중력 重力 重力
sAO AO 陰影 AO AO AO
sVertexColor2Vector VertexColor -> Vector VertexColor -> Vector VertexColor -> Vector VertexColor -> Vector VertexColor -> Vector
Expand Down
4 changes: 2 additions & 2 deletions Assets/lilToon/Editor/lilConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace lilToon
{
public class lilConstants
{
public const string currentVersionName = "1.7.3";
public const int currentVersionValue = 43;
public const string currentVersionName = "1.8.0";
public const int currentVersionValue = 44;

internal const string boothURL = "https://lilxyzw.booth.pm/";
internal const string githubURL = "https://github.com/lilxyzw/lilToon";
Expand Down
31 changes: 31 additions & 0 deletions Assets/lilToon/Editor/lilInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,9 @@ public struct PropertyBlockData
private readonly lilMaterialProperty furRootOffset = new lilMaterialProperty("_FurRootOffset", PropertyBlock.Fur);
private readonly lilMaterialProperty furCutoutLength = new lilMaterialProperty("_FurCutoutLength", PropertyBlock.Fur);
private readonly lilMaterialProperty furTouchStrength = new lilMaterialProperty("_FurTouchStrength", PropertyBlock.Fur);
private readonly lilMaterialProperty furRimColor = new lilMaterialProperty("_FurRimColor", PropertyBlock.Fur);
private readonly lilMaterialProperty furRimFresnelPower = new lilMaterialProperty("_FurRimFresnelPower", PropertyBlock.Fur);
private readonly lilMaterialProperty furRimAntiLight = new lilMaterialProperty("_FurRimAntiLight", PropertyBlock.Fur);

private readonly lilMaterialProperty stencilRef = new lilMaterialProperty("_StencilRef", PropertyBlock.Stencil);
private readonly lilMaterialProperty stencilReadMask = new lilMaterialProperty("_StencilReadMask", PropertyBlock.Stencil);
Expand Down Expand Up @@ -1468,6 +1471,9 @@ private lilMaterialProperty[] AllProperties()
furRootOffset,
furCutoutLength,
furTouchStrength,
furRimColor,
furRimFresnelPower,
furRimAntiLight,

stencilRef,
stencilReadMask,
Expand Down Expand Up @@ -3360,6 +3366,13 @@ void UVDIMToggle(Rect position, MaterialProperty prop)
}
lilEditorGUI.MinusRangeGUI(furRootOffset, GetLoc("sRootWidth"));
LocalizedProperty(furTouchStrength);
lilEditorGUI.DrawLine();
EditorGUILayout.LabelField(GetLoc("sRimLight"), EditorStyles.boldLabel);
EditorGUI.indentLevel++;
LocalizedProperty(furRimColor);
LocalizedProperty(furRimFresnelPower);
LocalizedProperty(furRimAntiLight);
EditorGUI.indentLevel--;
EditorGUILayout.EndVertical();
EditorGUILayout.EndVertical();
}
Expand Down Expand Up @@ -5194,6 +5207,15 @@ private void DrawShadowSettings()
EditorGUI.indentLevel -= 2;
LocalizedProperty(shadowStrength);
}
else if(shadowMaskType.floatValue == 2.0f)
{
LocalizedPropertyTexture(new GUIContent("SDF", "Right (R), Left (G)"), shadowStrengthMask);
EditorGUI.indentLevel += 2;
LocalizedProperty(shadowStrengthMaskLOD);
LocalizedProperty(shadowFlatBlur, "Blend Y Direction");
EditorGUI.indentLevel -= 2;
LocalizedProperty(shadowStrength);
}
else
{
LocalizedPropertyTexture(maskStrengthContent, shadowStrengthMask, shadowStrength);
Expand Down Expand Up @@ -5334,6 +5356,15 @@ private void DrawShadowSettingsSimple()
EditorGUI.indentLevel -= 2;
LocalizedProperty(shadowStrength);
}
else if(shadowMaskType.floatValue == 2.0f)
{
LocalizedPropertyTexture(new GUIContent("SDF", "Right (R), Left (G)"), shadowStrengthMask);
EditorGUI.indentLevel += 2;
LocalizedProperty(shadowStrengthMaskLOD);
LocalizedProperty(shadowFlatBlur, "Blend Y Direction");
EditorGUI.indentLevel -= 2;
LocalizedProperty(shadowStrength);
}
else
{
LocalizedPropertyTexture(maskStrengthContent, shadowStrengthMask, shadowStrength);
Expand Down
4 changes: 2 additions & 2 deletions Assets/lilToon/Editor/lilLanguageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private static void InitializeLabels()
loc["sGlitterParams2"] = BuildParams(GetLoc("sBlinkSpeed"), GetLoc("sAngleLimit"), GetLoc("sRimLightDirection"), GetLoc("sColorRandomness"));
loc["sOutlineVertexColorUsages"] = BuildParams(GetLoc("sVertexColor"), GetLoc("sNone"), GetLoc("sVertexR2Width"), GetLoc("sVertexRGBA2Normal"));
loc["sShadowColorTypes"] = BuildParams(GetLoc("sColorType"), GetLoc("sColorTypeNormal"), GetLoc("sColorTypeLUT"));
loc["sShadowMaskTypes"] = BuildParams(GetLoc("sMaskType"), GetLoc("sStrength"), GetLoc("sFlat"));
loc["sShadowMaskTypes"] = BuildParams(GetLoc("sMaskType"), GetLoc("sStrength"), GetLoc("sFlat"), "SDF");
loc["sHSVGs"] = BuildParams(GetLoc("sHue"), GetLoc("sSaturation"), GetLoc("sValue"), GetLoc("sGamma"));
loc["sScrollRotates"] = BuildParams(GetLoc("sAngle"), GetLoc("sUVAnimation"), GetLoc("sScroll"), GetLoc("sRotate"));
loc["sDecalAnimations"] = BuildParams(GetLoc("sAnimation"), GetLoc("sXFrames"), GetLoc("sYFrames"), GetLoc("sFrames"), GetLoc("sFPS"));
Expand Down Expand Up @@ -190,7 +190,7 @@ private static void InitializeLabels()
sBlendModeList = new[]{GetLoc("sBlendModeNormal"), GetLoc("sBlendModeAdd"), GetLoc("sBlendModeScreen"), GetLoc("sBlendModeMul")};
sOutlineVertexColorUsages = BuildParams(GetLoc("sVertexColor"), GetLoc("sNone"), GetLoc("sVertexR2Width"), GetLoc("sVertexRGBA2Normal"));
sShadowColorTypes = BuildParams(GetLoc("sColorType"), GetLoc("sColorTypeNormal"), GetLoc("sColorTypeLUT"));
sShadowMaskTypes = BuildParams(GetLoc("sMaskType"), GetLoc("sStrength"), GetLoc("sFlat"));
sShadowMaskTypes = BuildParams(GetLoc("sMaskType"), GetLoc("sStrength"), GetLoc("sFlat"), "SDF");
colorRGBAContent = new GUIContent(GetLoc("sColor"), GetLoc("sTextureRGBA"));
colorAlphaRGBAContent = new GUIContent(GetLoc("sColorAlpha"), GetLoc("sTextureRGBA"));
maskBlendContent = new GUIContent(GetLoc("sMask"), GetLoc("sBlendR"));
Expand Down
58 changes: 34 additions & 24 deletions Assets/lilToon/Editor/lilMaterialUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,49 +537,54 @@ private static void SetShaderKeywords(Material material, string keyword, bool en
else material.DisableKeyword(keyword);
}

public static void RemoveUnusedTexture(Material material)
public static void RemoveUnusedTexture(Material material, params string[] animatedProps)
{
if(!material.shader.name.Contains("lilToon")) return;
RemoveUnusedTexture(material, material.shader.name.Contains("Lite"));
RemoveUnusedTexture(material, material.shader.name.Contains("Lite"), animatedProps);
}

public static void RemoveUnusedTexture(Material material, bool islite)
public static void RemoveUnusedTexture(Material material, bool islite, params string[] animatedProps)
{
RemoveUnusedProperties(material);
RemoveUnusedTextureOnly(material, islite, animatedProps);
}

public static void RemoveUnusedTextureOnly(Material material, bool islite, params string[] animatedProps)
{
if(islite)
{
if(material.GetFloat("_UseShadow") == 0.0f)
if(IsPropZero(material, "_UseShadow", animatedProps))
{
material.SetTexture("_ShadowColorTex", null);
material.SetTexture("_Shadow2ndColorTex", null);
}
if(material.GetFloat("_UseEmission") == 0.0f)
if(IsPropZero(material, "_UseEmission", animatedProps))
{
material.SetTexture("_EmissionMap", null);
}
if(material.GetFloat("_UseMatCap") == 0.0f)
if(IsPropZero(material, "_UseMatCap", animatedProps))
{
material.SetTexture("_MatCapTex", null);
}
}
else
{
if(material.GetFloat("_MainGradationStrength") == 0.0f) material.SetTexture("_MainGradationTex", null);
if(material.GetFloat("_UseMain2ndTex") == 0.0f)
if(IsPropZero(material, "_MainGradationStrength", animatedProps)) material.SetTexture("_MainGradationTex", null);
if(IsPropZero(material, "_UseMain2ndTex", animatedProps))
{
material.SetTexture("_Main2ndTex", null);
material.SetTexture("_Main2ndBlendMask", null);
material.SetTexture("_Main2ndDissolveMask", null);
material.SetTexture("_Main2ndDissolveNoiseMask", null);
}
if(material.GetFloat("_UseMain3rdTex") == 0.0f)
if(IsPropZero(material, "_UseMain3rdTex", animatedProps))
{
material.SetTexture("_Main3rdTex", null);
material.SetTexture("_Main3rdBlendMask", null);
material.SetTexture("_Main3rdDissolveMask", null);
material.SetTexture("_Main3rdDissolveNoiseMask", null);
}
if(material.GetFloat("_UseShadow") == 0.0f)
if(IsPropZero(material, "_UseShadow", animatedProps))
{
material.SetTexture("_ShadowBlurMask", null);
material.SetTexture("_ShadowBorderMask", null);
Expand All @@ -588,47 +593,47 @@ public static void RemoveUnusedTexture(Material material, bool islite)
material.SetTexture("_Shadow2ndColorTex", null);
material.SetTexture("_Shadow3rdColorTex", null);
}
if(material.GetFloat("_UseRimShade") == 0.0f)
if(IsPropZero(material, "_UseRimShade", animatedProps))
{
material.SetTexture("_RimShadeMask", null);
}
if(material.GetFloat("_UseEmission") == 0.0f)
if(IsPropZero(material, "_UseEmission", animatedProps))
{
material.SetTexture("_EmissionMap", null);
material.SetTexture("_EmissionBlendMask", null);
material.SetTexture("_EmissionGradTex", null);
}
if(material.GetFloat("_UseEmission2nd") == 0.0f)
if(IsPropZero(material, "_UseEmission2nd", animatedProps))
{
material.SetTexture("_Emission2ndMap", null);
material.SetTexture("_Emission2ndBlendMask", null);
material.SetTexture("_Emission2ndGradTex", null);
}
if(material.GetFloat("_UseBumpMap") == 0.0f) material.SetTexture("_BumpMap", null);
if(material.GetFloat("_UseBump2ndMap") == 0.0f)
if(IsPropZero(material, "_UseBumpMap", animatedProps)) material.SetTexture("_BumpMap", null);
if(IsPropZero(material, "_UseBump2ndMap", animatedProps))
{
material.SetTexture("_Bump2ndMap", null);
material.SetTexture("_Bump2ndScaleMask", null);
}
if(material.GetFloat("_UseAnisotropy") == 0.0f)
if(IsPropZero(material, "_UseAnisotropy", animatedProps))
{
material.SetTexture("_AnisotropyTangentMap", null);
material.SetTexture("_AnisotropyScaleMask", null);
material.SetTexture("_AnisotropyShiftNoiseMask", null);
}
if(material.GetFloat("_UseReflection") == 0.0f)
if(IsPropZero(material, "_UseReflection", animatedProps))
{
material.SetTexture("_SmoothnessTex", null);
material.SetTexture("_MetallicGlossMap", null);
material.SetTexture("_ReflectionColorTex", null);
material.SetTexture("_ReflectionCubeTex", null);
}
if(material.GetFloat("_UseMatCap") == 0.0f)
if(IsPropZero(material, "_UseMatCap", animatedProps))
{
material.SetTexture("_MatCapTex", null);
material.SetTexture("_MatCapBlendMask", null);
}
if(material.GetFloat("_UseMatCap2nd") == 0.0f)
if(IsPropZero(material, "_UseMatCap2nd", animatedProps))
{
material.SetTexture("_MatCap2ndTex", null);
material.SetTexture("_MatCap2ndBlendMask", null);
Expand All @@ -639,14 +644,19 @@ public static void RemoveUnusedTexture(Material material, bool islite)
material.SetTexture("_OutlineWidthMask", null);
material.SetTexture("_OutlineVectorTex", null);
}
if(material.GetFloat("_UseRim") == 0.0f) material.SetTexture("_RimColorTex", null);
if(material.GetFloat("_UseGlitter") == 0.0f) material.SetTexture("_GlitterColorTex", null);
if(material.GetFloat("_UseParallax") == 0.0f) material.SetTexture("_ParallaxMap", null);
if(material.GetFloat("_UseAudioLink") == 0.0f || material.GetFloat("_AudioLinkUVMode") != 3.0f) material.SetTexture("_AudioLinkMask", null);
if(material.GetFloat("_UseAudioLink") == 0.0f || material.GetFloat("_AudioLinkAsLocal") == 0.0f) material.SetTexture("_AudioLinkLocalMap", null);
if(IsPropZero(material, "_UseRim", animatedProps)) material.SetTexture("_RimColorTex", null);
if(IsPropZero(material, "_UseGlitter", animatedProps)) material.SetTexture("_GlitterColorTex", null);
if(IsPropZero(material, "_UseParallax", animatedProps)) material.SetTexture("_ParallaxMap", null);
if(IsPropZero(material, "_UseAudioLink", animatedProps) || material.GetFloat("_AudioLinkUVMode") != 3.0f || animatedProps.Contains("_AudioLinkUVMode")) material.SetTexture("_AudioLinkMask", null);
if(IsPropZero(material, "_UseAudioLink", animatedProps) || IsPropZero(material, "_AudioLinkAsLocal", animatedProps)) material.SetTexture("_AudioLinkLocalMap", null);
}
}

private static bool IsPropZero(Material material, string name, string[] animatedProps)
{
return material.GetFloat(name) == 0.0f && !animatedProps.Contains(name);
}

public static void RemoveShaderKeywords(Material material)
{
foreach(var keyword in material.shaderKeywords)
Expand Down
Loading

0 comments on commit 2723550

Please sign in to comment.