Fix bounds antialiasing on text

Previously the gradient was being calculated before taking the boundaries into account, resulting in the edges being too hard or too soft
pull/21/head
Andrew Cassidy 4 years ago
parent d705a92b0d
commit eb7bb211ab
No known key found for this signature in database
GPG Key ID: 963017B38FD477A1

@ -6,7 +6,6 @@ float _OutlineWidth;
void surf(DecalSurfaceInput IN, inout SurfaceOutput o) {
float4 color = _DecalColor;
float dist = _Cutoff - tex2D(_Decal, IN.uv_decal).r; // text distance
float ddist = SDFdDist(dist); // distance gradient magnitude
#ifdef DECAL_OUTLINE
// Outline
@ -16,7 +15,7 @@ void surf(DecalSurfaceInput IN, inout SurfaceOutput o) {
#ifdef DECAL_FILL
// Outline and Fill
float outlineDist = -dist - outlineOffset;
float outlineFactor = SDFAA(outlineDist, ddist);
float outlineFactor = SDFAA(outlineDist);
dist -= outlineOffset;
color = lerp(_DecalColor, _OutlineColor, outlineFactor);
#else
@ -28,6 +27,7 @@ void surf(DecalSurfaceInput IN, inout SurfaceOutput o) {
#endif
dist = max(dist, BoundsDist(IN.uv, IN.vertex_normal, _DecalNormal));
float ddist = SDFdDist(dist); // distance gradient magnitude
o.Alpha = _DecalOpacity * SDFAA(dist, ddist);
o.Albedo = UnderwaterFog(IN.worldPosition, color).rgb;

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4b9f1df541672d2c5aa8b7900bbba84d7845a72104b08e7be776c65fcf698f8f
size 888707
oid sha256:92429ce733ae3a02250d831b6d1ebbcef733467be87f1ef10604964374d8b6f7
size 890502

Loading…
Cancel
Save