Skip to content

Commit

Permalink
ver 0.18.3-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
yoship1639 committed Apr 7, 2022
1 parent 88ab981 commit a4a21c4
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## [0.18.3] - 2022-04-08
- Lightweighted logic for normal correction.

## [0.18.2] - 2022-04-05
- Added renderer feature for when outlines do not work during deferred rendering.

Expand Down
2 changes: 1 addition & 1 deletion Editor/ShaderGUI/LitShader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro
var blendModeChanged = false;

// version
GUILayout.Label("UniToon ver 0.18.2-alpha");
GUILayout.Label("UniToon ver 0.18.3-alpha");

EditorGUILayout.Space();
changed = MaterialGUI.Enum<UniToonVersion>("Version", FindProperty("_UniToonVer", properties));
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# UniToon

ver 0.18.2-alpha
ver 0.18.3-alpha

Physically-based Toon Shader for game applications. Compliant with Unity standard rendering functions. It is not targeted to be multifunctional in order to keep performance, but to be universally usable.

Expand Down
14 changes: 8 additions & 6 deletions Shaders/URP_2021_1/LitForwardPass.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct Varyings
#endif

float4 screenPos : TEXCOORD9;
float3 originWS : TEXCOORD10;
float3 normalCorrectWS : TEXCOORD10;

float4 positionCS : SV_POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
Expand Down Expand Up @@ -150,7 +150,12 @@ Varyings LitPassVertex(Attributes input)

output.positionCS = vertexInput.positionCS;
output.screenPos = output.positionCS;
output.originWS = TransformObjectToWorld(_NormalCorrectOrigin);

float3 normalCorrectOS = (input.positionOS.xyz - _NormalCorrectOrigin);
float3 normalCorrectDir = normalCorrectOS;
normalCorrectDir.y = 0.0;
normalCorrectDir = SafeNormalize(normalCorrectDir);
output.normalCorrectWS = TransformObjectToWorldNormal(normalCorrectDir);

return output;
}
Expand Down Expand Up @@ -181,10 +186,7 @@ half4 LitPassFragment(Varyings input) : SV_Target
half ramp;

// normal correct
half3 normalCorrectWS = (input.positionWS - input.originWS);
normalCorrectWS.y = 0.0;
normalCorrectWS = normalize(normalCorrectWS);
inputData.normalWS = normalize(lerp(inputData.normalWS, normalCorrectWS, _NormalCorrect));
inputData.normalWS = normalize(lerp(inputData.normalWS, input.normalCorrectWS, _NormalCorrect));

half4 color = UniToonFragmentPBR(inputData, surfaceData, shadeColor, _ToonyFactor, ramp);

Expand Down
14 changes: 8 additions & 6 deletions Shaders/URP_2021_2/LitForwardPass.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct Varyings
#endif

float4 screenPos : TEXCOORD10;
float3 originWS : TEXCOORD11;
float3 normalCorrectWS : TEXCOORD11;

float4 positionCS : SV_POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
Expand Down Expand Up @@ -189,7 +189,12 @@ Varyings LitPassVertex(Attributes input)

output.positionCS = vertexInput.positionCS;
output.screenPos = output.positionCS;
output.originWS = TransformObjectToWorld(_NormalCorrectOrigin);

float3 normalCorrectOS = (input.positionOS.xyz - _NormalCorrectOrigin);
float3 normalCorrectDir = normalCorrectOS;
normalCorrectDir.y = 0.0;
normalCorrectDir = SafeNormalize(normalCorrectDir);
output.normalCorrectWS = TransformObjectToWorldNormal(normalCorrectDir);

return output;
}
Expand Down Expand Up @@ -226,10 +231,7 @@ half4 LitPassFragment(Varyings input) : SV_Target
half ramp;

// normal correct
half3 normalCorrectWS = (input.positionWS - input.originWS);
normalCorrectWS.y = 0.0;
normalCorrectWS = normalize(normalCorrectWS);
inputData.normalWS = normalize(lerp(inputData.normalWS, normalCorrectWS, _NormalCorrect));
inputData.normalWS = normalize(lerp(inputData.normalWS, input.normalCorrectWS, _NormalCorrect));

half4 color = UniToonFragmentPBR(inputData, surfaceData, shadeColor, _ToonyFactor, ramp);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.yoship1639.unitoon",
"version": "0.18.2",
"version": "0.18.3",
"displayName": "UniToon",
"description": "A universally usable toon shader. compliant with Unity standard rendering functions, aiming to create a shader that can withstand avatar use across platforms, such as VRM, which is expected to grow in the future",
"unity": "2020.2",
Expand Down

0 comments on commit a4a21c4

Please sign in to comment.