Skip to content

Commit

Permalink
1.2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
lilxyzw committed Feb 4, 2022
1 parent 3679dab commit c300079
Show file tree
Hide file tree
Showing 53 changed files with 425 additions and 83 deletions.
14 changes: 13 additions & 1 deletion Assets/lilToon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ 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.2.8] - 2022-1-30
## [1.2.9] - 2022-02-04
### Added
- Added cubemap fallback / override
- Added preset button to MatCap UV settings

### Changed
- Moved shader settings to tab

### Fixed
- Fixed an issue where `Fix lighting` wasn't showing up in the right-click menu
- Fixed refraction shader getting too bright in ForwardAdd

## [1.2.8] - 2022-01-30
### Added
- 3rd shadow
- `Randomize` property for fur
Expand Down
14 changes: 13 additions & 1 deletion Assets/lilToon/CHANGELOG_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ 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.2.8] - 2022-1-30
## [1.2.9] - 2022-02-04
### 追加
- Cubemapのフォールバック・オーバーライド機能を追加
- MatCapのUV設定に一括設定ボタンを追加

### 変更
- シェーダー設定をタブとして再配置

### 修正
- `Fix lighting`が右クリックメニューに表示されていなかった問題を修正
- 屈折シェーダーがForwardAddで明るくなりすぎていたのを修正

## [1.2.8] - 2022-01-30
### 追加
- 3影を追加
- ファーに`ランダム化`プロパティを追加
Expand Down
3 changes: 2 additions & 1 deletion Assets/lilToon/Editor/Resources/lang.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sEditorMode Editor Mode 編集モード 편집 모드 编辑器模式 編輯器
sEditorModeSimple Simple 簡易設定 간이 설정 简单设置 簡單設置
sEditorModeAdvanced Advanced 詳細設定 상세 설정 详细设置 詳細設置
sEditorModePreset Preset プリセット 프리셋 预设 預設
sEditorModeShaderSetting Shader Setting シェーダー設定 쉐이더 설정 着色器设置 著色器設置
sHelpSimple In this mode, you can easily edit the appearance. 簡単に見た目を編集するモードです。 간단하게 외형을 편집하는 모드입니다. 这种模式进行简单的设置。 這種模式進行簡單的設置。
sHelpAdvanced In this mode, you can make detailed settings for the material. 詳細設定を行うモードです。 상세 설정을 실시하는 모드입니다. 此模式用于进行详细设置。 此模式用於進行詳細設置。
sHelpPreset In this mode, you can easily set up materials from presets. プリセットから一括で設定するモードです。 프리셋에서 일괄로 설정하는 모드입니다. 在这个模式下,你可以很容易地从预设中设置材料。 在這個模式下,你可以很容易地從預設中設置材料。
Expand Down Expand Up @@ -494,7 +495,7 @@ sSettingTexFurLength Fur Length Mask ファー長さマスク 퍼 길이 마스
sSettingFurCollision Fur Collision ファー当たり判定 퍼 충돌 毛皮碰撞 毛皮碰撞
sSettingTessellation Tessellation (Extremely high load) テッセレーション (非常に高負荷) 테셀레이션 (매우 높음) Tessellation (极高的负荷) Tessellation (極高的負荷)
sSettingDefaultValue Default Value (used for "Fix Lighting" and lighting presets) 初期値 (Fix Lightingやライティングプリセットに使用) 초기값 (Fix Lighting이나 라이팅 프리셋에 사용) 初始值 (用于Fix Lighting或照明预设) 初始值 (用於Fix Lighting或照明預設)
sSettingBuildSizeOptimization Build size optimization ビルドサイズの最適化 빌드 사이즈 최적화 优化构建大小 優化構建大小
sSettingBuildSizeOptimization Build size optimization (for all materials) ビルドサイズの最適化 (全マテリアル共通) 빌드 사이즈 최적화 (전체 재료 공통) 优化构建大小(用于所有材质) 優化構建大小(用於所有材質)
sSettingApplyShadowFA Enable shadow in ForwardAdd ForwardAddパスで影を有効化 ForwardAdd로 그림자 활성화 通过ForwardAdd启用阴影 通過ForwardAdd啟用陰影
sSettingUseForwardAdd Use ForwardAdd ForwardAddパスを使用 ForwardAdd 사용 使用ForwardAdd 使用ForwardAdd
sSettingUseVertexLight Use vertex light 頂点ライトを使用 꼭지점 라이트 사용 使用顶点灯 使用頂點燈
Expand Down
229 changes: 161 additions & 68 deletions Assets/lilToon/Editor/lilInspector.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Assets/lilToon/Editor/lilToonEditorUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public static class lilToonEditorUtils
private const string menuPathFixLighting = menuPathGameObject + "[GameObject] Fix lighting";

private const int menuPriorityAssets = 1100;
private const int menuPriorityGameObject = 1100;
private const int menuPriorityGameObject = 21; // This must be 21 or less
private const int menuPriorityRefreshShaders = menuPriorityAssets + 0;
private const int menuPriorityAutoShaderSetting = menuPriorityAssets + 1;
private const int menuPriorityRemoveUnusedProperties = menuPriorityAssets + 20;
private const int menuPriorityConvertNormal = menuPriorityAssets + 21;
private const int menuPriorityPixelArtReduction = menuPriorityAssets + 22;
private const int menuPriorityConvertGifToAtlas = menuPriorityAssets + 23;
private const int menuPrioritySetupFromFBX = menuPriorityAssets + 24;
private const int menuPriorityFixLighting = menuPriorityGameObject + 0;
private const int menuPriorityFixLighting = menuPriorityGameObject;

private const string anchorName = "AutoAnchorObject";

Expand Down
2 changes: 1 addition & 1 deletion Assets/lilToon/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# lilToon
Version 1.2.8
Version 1.2.9

# Overview
This shader is developed for services using avatars (VRChat, etc.) and has the following features.
Expand Down
2 changes: 1 addition & 1 deletion Assets/lilToon/README_JP.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# lilToon
Version 1.2.8
Version 1.2.9

# 概要
アバターを用いたサービス(VRChat等)向けに開発したシェーダーで以下のような特徴があります。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ Shader "#NAME#"
[lilHDR] _ReflectionColor ("Color", Color) = (1,1,1,1)
[NoScaleOffset] _ReflectionColorTex ("Color", 2D) = "white" {}
[lilToggle] _ReflectionApplyTransparency ("Apply Transparency", Int) = 1
[NoScaleOffset] _ReflectionCubeTex ("Cubemap Fallback", Cube) = "black" {}
[lilHDR] _ReflectionCubeColor ("Color", Color) = (0,0,0,1)
[lilToggle] _ReflectionCubeOverride ("Override", Int) = 0
_ReflectionCubeEnableLighting ("Enable Lighting", Range(0, 1)) = 1

//----------------------------------------------------------------------------------------------------------------------
// MatCap
Expand Down
2 changes: 1 addition & 1 deletion Assets/lilToon/Shader/Includes/lil_common_frag.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@
// Premultiply
#if LIL_RENDER != 2
#define LIL_PREMULTIPLY
#elif defined(LIL_PASS_FORWARDADD)
#elif defined(LIL_PASS_FORWARDADD) && !defined(LIL_REFRACTION)
#define LIL_PREMULTIPLY fd.col.rgb *= saturate(fd.col.a * _AlphaBoostFA);
#else
#define LIL_PREMULTIPLY fd.col.rgb *= fd.col.a;
Expand Down
22 changes: 22 additions & 0 deletions Assets/lilToon/Shader/Includes/lil_common_functions.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,19 @@ float3 lilGradationMap(float3 col, TEXTURE2D(gradationMap), float strength)
return lerp(col, outrgb, strength);
}

float3 lilDecodeHDR(float4 data, float4 hdr)
{
float alpha = hdr.w * (data.a - 1.0) + 1.0;

#if defined(UNITY_COLORSPACE_GAMMA)
return (hdr.x * alpha) * data.rgb;
#elif defined(UNITY_USE_NATIVE_HDR)
return hdr.x * data.rgb;
#else
return (hdr.x * pow(abs(alpha), hdr.y)) * data.rgb;
#endif
}

//------------------------------------------------------------------------------------------------------------------------------
// UV

Expand Down Expand Up @@ -985,6 +998,15 @@ float3 lilGetAnisotropyNormalWS(float3 normalWS, float3 anisoTangentWS, float3 a
return normalize(lerp(normalWS, anisoDirectionWS, abs(anisotropy)));
}

//------------------------------------------------------------------------------------------------------------------------------
// Reflection
float3 lilCustomReflection(TEXTURECUBE(tex), float4 hdr, float3 viewDirection, float3 normalDirection, float perceptualRoughness)
{
float mip = perceptualRoughness * (10.2 - 4.2 * perceptualRoughness);
float3 refl = reflect(-viewDirection, normalDirection);
return lilDecodeHDR(LIL_SAMPLE_CUBE_LOD(tex, sampler_linear_repeat, refl, mip), hdr);
}

//------------------------------------------------------------------------------------------------------------------------------
// Glitter
float3 lilCalcGlitter(float2 uv, float3 normalDirection, float3 viewDirection, float3 lightDirection, float4 glitterParams1, float4 glitterParams2)
Expand Down
17 changes: 17 additions & 0 deletions Assets/lilToon/Shader/Includes/lil_common_input.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ SAMPLER(sampler_linear_clamp);
float4 _MetallicGlossMap_ST;
float4 _ReflectionColorTex_ST;
#endif
#if defined(LIL_MULTI_INPUTS_REFLECTION) || defined(LIL_GEM)
float4 _ReflectionCubeColor;
float4 _ReflectionCubeTex_HDR;
#endif
#if defined(LIL_MULTI_INPUTS_MATCAP)
float4 _MatCapColor;
float4 _MatCapTex_ST;
Expand Down Expand Up @@ -555,6 +559,7 @@ SAMPLER(sampler_linear_clamp);
float _SpecularBorder;
float _SpecularBlur;
float _ReflectionNormalStrength;
float _ReflectionCubeEnableLighting;
#endif
#if defined(LIL_MULTI_INPUTS_REFLECTION)
float _Metallic;
Expand Down Expand Up @@ -727,6 +732,9 @@ SAMPLER(sampler_linear_clamp);
lilBool _SpecularToon;
lilBool _ReflectionApplyTransparency;
#endif
#if defined(LIL_MULTI_INPUTS_REFLECTION) || defined(LIL_GEM)
lilBool _ReflectionCubeOverride;
#endif
#if defined(LIL_MULTI_INPUTS_MATCAP)
lilBool _MatCapApplyTransparency;
lilBool _MatCapPerspective;
Expand Down Expand Up @@ -907,6 +915,10 @@ SAMPLER(sampler_linear_clamp);
float4 _MetallicGlossMap_ST;
float4 _ReflectionColorTex_ST;
#endif
#if defined(LIL_FEATURE_REFLECTION) || defined(LIL_GEM)
float4 _ReflectionCubeColor;
float4 _ReflectionCubeTex_HDR;
#endif

// MatCap
#if defined(LIL_FEATURE_MATCAP)
Expand Down Expand Up @@ -1105,6 +1117,7 @@ SAMPLER(sampler_linear_clamp);
float _SpecularBorder;
float _SpecularBlur;
float _ReflectionNormalStrength;
float _ReflectionCubeEnableLighting;
#endif
#if defined(LIL_FEATURE_REFLECTION)
float _Metallic;
Expand Down Expand Up @@ -1315,6 +1328,9 @@ SAMPLER(sampler_linear_clamp);
lilBool _SpecularToon;
lilBool _ReflectionApplyTransparency;
#endif
#if defined(LIL_FEATURE_REFLECTION) || defined(LIL_GEM)
lilBool _ReflectionCubeOverride;
#endif
#if defined(LIL_FEATURE_MATCAP)
lilBool _UseMatCap;
lilBool _MatCapApplyTransparency;
Expand Down Expand Up @@ -1430,6 +1446,7 @@ TEXTURE2D(_BacklightColorTex);
TEXTURE2D(_SmoothnessTex);
TEXTURE2D(_MetallicGlossMap);
TEXTURE2D(_ReflectionColorTex);
TEXTURECUBE(_ReflectionCubeTex);
TEXTURE2D(_MatCapTex);
TEXTURE2D(_MatCapBlendMask);
TEXTURE2D(_MatCapBumpMap);
Expand Down
35 changes: 30 additions & 5 deletions Assets/lilToon/Shader/Includes/lil_common_macro.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@
#if defined(TEXTURE3D)
#undef TEXTURE3D
#endif
#if defined(TEXTURECUBE)
#undef TEXTURECUBE
#endif
#if defined(SAMPLER)
#undef SAMPLER
#endif
Expand Down Expand Up @@ -258,14 +261,21 @@
#define LIL_SAMPLE_2D_ARRAY(tex,samp,uv,index) tex2DArray(tex,float3(uv,index))
#define LIL_SAMPLE_2D_ARRAY_LOD(tex,samp,uv,index,lod) tex2DArraylod(tex,float4(uv,index,lod))
#define LIL_SAMPLE_3D(tex,samp,uv) tex3D(tex,uv)
#define LIL_SAMPLE_CUBE_LOD(tex,samp,uv,lod) texCUBElod(tex,float4(uv,0,lod))
#define TEXTURE2D(tex) sampler2D tex
#define TEXTURE2D_FLOAT(tex) sampler2D tex
#define TEXTURE2D_ARRAY(tex) sampler2DArray tex
#define TEXTURE3D(tex) sampler3D tex
#define TEXTURECUBE(tex) samplerCUBE tex
#define SAMPLER(samp)
#define LIL_SAMP_IN_FUNC(samp)
#define LIL_SAMP_IN(samp)
#define LIL_LWTEX

bool IsEmpty(TEXTURECUBE(tex))
{
return false;
}
#else
#define LIL_SAMPLE_1D(tex,samp,uv) tex.Sample(samp,uv)
#define LIL_SAMPLE_1D_LOD(tex,samp,uv,lod) tex.SampleLevel(samp,uv,lod)
Expand All @@ -277,13 +287,22 @@
#define LIL_SAMPLE_2D_ARRAY(tex,samp,uv,index) tex.Sample(samp,float3(uv,index))
#define LIL_SAMPLE_2D_ARRAY_LOD(tex,samp,uv,index,lod) tex.SampleLevel(samp,float3(uv,index),lod)
#define LIL_SAMPLE_3D(tex,samp,coord) tex.Sample(samp,coord)
#define LIL_SAMPLE_CUBE_LOD(tex,samp,uv,lod) tex.SampleLevel(samp,uv,lod)
#define TEXTURE2D(tex) Texture2D tex
#define TEXTURE2D_FLOAT(tex) Texture2D<float4> tex
#define TEXTURE2D_ARRAY(tex) Texture2DArray tex
#define TEXTURE3D(tex) Texture3D tex
#define TEXTURECUBE(tex) TextureCube tex
#define SAMPLER(samp) SamplerState samp
#define LIL_SAMP_IN_FUNC(samp) , SamplerState samp
#define LIL_SAMP_IN(samp) , samp

bool IsEmpty(TEXTURECUBE(tex))
{
uint width, height, levels;
tex.GetDimensions(0, width, height, levels);
return width < 15;
}
#endif

#if defined(LIL_FEATURE_PARALLAX) && defined(LIL_FEATURE_POM)
Expand Down Expand Up @@ -321,7 +340,7 @@

float3 lilTransformOStoWS(float3 positionOS)
{
return mul(LIL_MATRIX_M, float4(positionOS,1.0)).xyz;
return mul(LIL_MATRIX_M, float4(positionOS, 1.0)).xyz;
}

float3 lilTransformWStoOS(float3 positionWS)
Expand Down Expand Up @@ -375,7 +394,7 @@

float3 lilTransformOStoWS(float3 positionOS)
{
return mul(LIL_MATRIX_M, float4(positionOS,1.0)).xyz;
return mul(LIL_MATRIX_M, float4(positionOS, 1.0)).xyz;
}

float3 lilTransformWStoOS(float3 positionWS)
Expand Down Expand Up @@ -652,7 +671,9 @@ float2 lilCStoGrabUV(float4 positionCS)
return UnityGI_IndirectSpecular(data, 1.0, glossIn);
}
#define LIL_GET_ENVIRONMENT_REFLECTION(viewDirection,normalDirection,perceptualRoughness,positionWS) \
lilGetEnvReflection(viewDirection,normalDirection,perceptualRoughness,positionWS)
((IsEmpty(unity_SpecCube0) || unity_SpecCube0_HDR.x == 0 || _ReflectionCubeOverride) ? \
lilCustomReflection(_ReflectionCubeTex, _ReflectionCubeTex_HDR, viewDirection, normalDirection, perceptualRoughness) * _ReflectionCubeColor.rgb * lerp(1.0, fd.lightColor, _ReflectionCubeEnableLighting) : \
lilGetEnvReflection(viewDirection,normalDirection,perceptualRoughness,positionWS))

// Fog
#if defined(LIL_PASS_FORWARDADD)
Expand Down Expand Up @@ -1226,7 +1247,9 @@ float2 lilCStoGrabUV(float4 positionCS)

// Environment reflection
#define LIL_GET_ENVIRONMENT_REFLECTION(viewDirection,normalDirection,perceptualRoughness,positionWS) \
lilGetReflectionSum(viewDirection,normalDirection,perceptualRoughness,posInput,fd.renderingLayers,fd.featureFlags)
(_ReflectionCubeOverride ? \
lilCustomReflection(_ReflectionCubeTex, _ReflectionCubeTex_HDR, viewDirection, normalDirection, perceptualRoughness) * _ReflectionCubeColor.rgb * lerp(1.0, fd.lightColor, _ReflectionCubeEnableLighting) : \
lilGetReflectionSum(viewDirection,normalDirection,perceptualRoughness,posInput,fd.renderingLayers,fd.featureFlags))

// Fog
#define LIL_APPLY_FOG_BASE(col,fogCoord) col = EvaluateAtmosphericScattering(posInput, fd.V, col)
Expand Down Expand Up @@ -1378,7 +1401,9 @@ float2 lilCStoGrabUV(float4 positionCS)

// Environment reflection
#define LIL_GET_ENVIRONMENT_REFLECTION(viewDirection,normalDirection,perceptualRoughness,positionWS) \
GlossyEnvironmentReflection(reflect(-viewDirection,normalDirection), perceptualRoughness, 1.0)
((IsEmpty(unity_SpecCube0) || unity_SpecCube0_HDR.x == 0 || _ReflectionCubeOverride) ? \
lilCustomReflection(_ReflectionCubeTex, _ReflectionCubeTex_HDR, viewDirection, normalDirection, perceptualRoughness) * _ReflectionCubeColor.rgb * lerp(1.0, fd.lightColor, _ReflectionCubeEnableLighting) : \
GlossyEnvironmentReflection(reflect(-viewDirection,normalDirection), perceptualRoughness, 1.0))

// Fog
#define LIL_APPLY_FOG_BASE(col,fogCoord) col.rgb = MixFog(col.rgb,fogCoord)
Expand Down
4 changes: 4 additions & 0 deletions Assets/lilToon/Shader/lts.shader
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ Shader "lilToon"
[lilHDR] _ReflectionColor ("Color", Color) = (1,1,1,1)
[NoScaleOffset] _ReflectionColorTex ("Color", 2D) = "white" {}
[lilToggle] _ReflectionApplyTransparency ("Apply Transparency", Int) = 1
[NoScaleOffset] _ReflectionCubeTex ("Cubemap Fallback", Cube) = "black" {}
[lilHDR] _ReflectionCubeColor ("Color", Color) = (0,0,0,1)
[lilToggle] _ReflectionCubeOverride ("Override", Int) = 0
_ReflectionCubeEnableLighting ("Enable Lighting", Range(0, 1)) = 1

//----------------------------------------------------------------------------------------------------------------------
// MatCap
Expand Down
4 changes: 4 additions & 0 deletions Assets/lilToon/Shader/lts_cutout.shader
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ Shader "Hidden/lilToonCutout"
[lilHDR] _ReflectionColor ("Color", Color) = (1,1,1,1)
[NoScaleOffset] _ReflectionColorTex ("Color", 2D) = "white" {}
[lilToggle] _ReflectionApplyTransparency ("Apply Transparency", Int) = 1
[NoScaleOffset] _ReflectionCubeTex ("Cubemap Fallback", Cube) = "black" {}
[lilHDR] _ReflectionCubeColor ("Color", Color) = (0,0,0,1)
[lilToggle] _ReflectionCubeOverride ("Override", Int) = 0
_ReflectionCubeEnableLighting ("Enable Lighting", Range(0, 1)) = 1

//----------------------------------------------------------------------------------------------------------------------
// MatCap
Expand Down
4 changes: 4 additions & 0 deletions Assets/lilToon/Shader/lts_cutout_o.shader
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ Shader "Hidden/lilToonCutoutOutline"
[lilHDR] _ReflectionColor ("Color", Color) = (1,1,1,1)
[NoScaleOffset] _ReflectionColorTex ("Color", 2D) = "white" {}
[lilToggle] _ReflectionApplyTransparency ("Apply Transparency", Int) = 1
[NoScaleOffset] _ReflectionCubeTex ("Cubemap Fallback", Cube) = "black" {}
[lilHDR] _ReflectionCubeColor ("Color", Color) = (0,0,0,1)
[lilToggle] _ReflectionCubeOverride ("Override", Int) = 0
_ReflectionCubeEnableLighting ("Enable Lighting", Range(0, 1)) = 1

//----------------------------------------------------------------------------------------------------------------------
// MatCap
Expand Down
4 changes: 4 additions & 0 deletions Assets/lilToon/Shader/lts_cutout_oo.shader
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ Shader "_lil/[Optional] lilToonOutlineOnlyCutout"
[lilHDR] _ReflectionColor ("Color", Color) = (1,1,1,1)
[NoScaleOffset] _ReflectionColorTex ("Color", 2D) = "white" {}
[lilToggle] _ReflectionApplyTransparency ("Apply Transparency", Int) = 1
[NoScaleOffset] _ReflectionCubeTex ("Cubemap Fallback", Cube) = "black" {}
[lilHDR] _ReflectionCubeColor ("Color", Color) = (0,0,0,1)
[lilToggle] _ReflectionCubeOverride ("Override", Int) = 0
_ReflectionCubeEnableLighting ("Enable Lighting", Range(0, 1)) = 1

//----------------------------------------------------------------------------------------------------------------------
// MatCap
Expand Down
Loading

0 comments on commit c300079

Please sign in to comment.