Skip to content

Commit

Permalink
Merge pull request #134 from Elysia-simp/Shader-fix
Browse files Browse the repository at this point in the history
Fix diva shaders outline for PC
  • Loading branch information
Xele02 authored Oct 25, 2023
2 parents e9581e0 + c0356f2 commit 73ac3d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Unity/Assets/Shaders/diva_opaque_outline_high.shader
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ Shader "MCRS/Diva/Opaque_Outline_High" {
v2f o;

o.texcoord0 = v.texcoord0;
float4 screenvertex = UnityObjectToClipPos(v.position0);
float4 screenvertex = v.position0;
float4 projSpacePos;
projSpacePos.zw = screenvertex.zw;
float4 normaldir;
Expand All @@ -306,9 +306,10 @@ Shader "MCRS/Diva/Opaque_Outline_High" {
float4 scaledNormal = (((
(v.color0.x * _EdgeThickness)
* 0.00285) * normalize(
(UnityObjectToClipPos(float4(normaldir)))
(float4(normaldir))
)) * zbias);
projSpacePos.xy = (screenvertex.xy + scaledNormal.xy);
projSpacePos = UnityObjectToClipPos(projSpacePos); // while the original is correct on android gpu's this is typically the compilers job to fix
o.position0 = projSpacePos;
return o;
}
Expand Down
5 changes: 3 additions & 2 deletions Unity/Assets/Shaders/diva_trans_outline_high_alpha.shader
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ Shader "MCRS/Diva/Trans_Outline_High_Alpha" {
v2f o;

o.texcoord0 = v.texcoord0;
float4 screenvertex = UnityObjectToClipPos(v.position0);
float4 screenvertex = v.position0;
float4 projSpacePos;
projSpacePos.zw = screenvertex.zw;
float4 normaldir;
Expand All @@ -392,9 +392,10 @@ Shader "MCRS/Diva/Trans_Outline_High_Alpha" {
float4 scaledNormal = (((
(v.color0.x * _EdgeThickness)
* 0.00285) * normalize(
(UnityObjectToClipPos(float4(normaldir)))
(float4(normaldir))
)) * zbias);
projSpacePos.xy = (screenvertex.xy + scaledNormal.xy);
projSpacePos = UnityObjectToClipPos(projSpacePos);
o.position0 = projSpacePos;
return o;
}
Expand Down

0 comments on commit 73ac3d6

Please sign in to comment.