Outline Shader Drifting

This commit is contained in:
GMatrixGames 2024-05-29 14:39:59 -04:00
parent eb3f302552
commit 631530dbf7
No known key found for this signature in database
GPG Key ID: 685EB7EF9A26807C
4 changed files with 11 additions and 9 deletions

@ -1 +1 @@
Subproject commit 4e955153559be8dc156d15fc93ff8c1016d3ebfe
Subproject commit 38c1e5823978ff8c6d7d7db2bb6fb21f39f8944a

View File

@ -27,10 +27,18 @@ vec2 unpackBoneIDsAndWeights(int packedData)
return vec2(float((packedData >> 16) & 0xFFFF), float(packedData & 0xFFFF));
}
vec4 calculateScale(vec4 bindPos, vec4 bindNormal)
{
vec4 worldPos = vInstanceMatrix * bindPos;
float scaleFactor = length(uViewPos - worldPos.xyz) * 0.0035;
return transpose(inverse(vInstanceMatrix)) * bindNormal * scaleFactor;
}
void main()
{
vec4 bindPos = vec4(mix(vPos, vMorphTargetPos, uMorphTime), 1.0);
vec4 bindNormal = vec4(vNormal, 1.0);
bindPos.xyz += calculateScale(bindPos, bindNormal).xyz;
vec4 finalPos = vec4(0.0);
vec4 finalNormal = vec4(0.0);
@ -53,8 +61,6 @@ void main()
finalNormal += transpose(inverse(boneMatrix)) * bindNormal * weight;
}
}
finalPos = normalize(finalPos);
finalNormal = normalize(finalNormal);
}
else
{
@ -62,10 +68,5 @@ void main()
finalNormal = bindNormal;
}
vec4 worldPos = vInstanceMatrix * finalPos;
float scaleFactor = length(uViewPos - worldPos.xyz) * 0.0035;
vec4 nor = transpose(inverse(vInstanceMatrix)) * finalNormal * scaleFactor;
finalPos.xyz += nor.xyz;
gl_Position = uProjection * uView * vInstanceMatrix * finalPos;
}

View File

@ -98,7 +98,7 @@ public class Material : IDisposable
}
{ // ambient occlusion + color boost
if (Parameters.TryGetTexture2d(out var original, "M", "AEM", "AO", "Mask") &&
if (Parameters.TryGetTexture2d(out var original, "M", "AEM", "AO") &&
!original.Name.Equals("T_BlackMask") && options.TryGetTexture(original, false, out var transformed))
{
HasAo = true;

View File

@ -21,6 +21,7 @@ public static class TextureHelper
case "COSMICSHAKE":
case "PHOENIX":
case "ATOMICHEART":
case "MULTIVERSUS":
{
texture.SwizzleMask =
[