Skip to content

Commit 878eefc

Browse files
committed
anime attenuation fixes
1 parent 93c22ad commit 878eefc

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## Version 2.0.3
2+
- All anime shading modes now have proper attenuation, sorry about that (╥﹏╥)
3+
14
## Version 2.0.2
25
- Fixed old function call in HiFi Vertex Lighting
36

Editor/Resources/Luka_Backlace/Scripts/Project.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class Project
1313
public static readonly string project_name = "Backlace";
1414
public static readonly string project_path = "Luka_Backlace";
1515
public static readonly string project_license = "/Licenses/Backlace";
16-
public static Version version = new Version("2.0.2");
16+
public static Version version = new Version("2.0.3");
1717
public static readonly Version version_dazzle = new Version("4.6.0"); // just internally
1818
public static readonly string project_docs = "https://luka.moe/docs/backlace";
1919
public static readonly bool has_license = true; // if the project has a license file, or if you wanna show it

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
Backlace 🎀 is a versatile anime (also called "toon", "cel shaded", or "npr") shader for Unity and VRChat. Backlace is packed with a wide range of features- from anime character shading, to screen-space rim lighting, to procedural glitter. Get started with a single click for a typical fully-lit anime character or dive deep into the advanced settings like Pathing and Refraction! (─‿‿─)♡
1010

11-
**Latest Release:** 2.0.2 — see the [changelog](CHANGELOG.md) if you wish (`・ω・´)ゞ
11+
**Latest Release:** 2.0.3 — see the [changelog](CHANGELOG.md) if you wish (`・ω・´)ゞ
1212
<br>
1313
**Supported Platforms:** Unity Built-in Render Pipeline (BiRP), VRChat, Beatsaber, MateEngine, BepinEx Targetting BiRP, and more!
1414
<br>

Shaders/Includes/Backlace_Shading.cginc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ void Shade4PointLights(float3 normal, float3 worldPos, out float3 color, out flo
430430
float3 directLight = Surface.LightColor.rgb * Surface.Albedo.rgb;
431431
float lightMask = 1.0 - halftoneShadow;
432432
finalColor = lerp(finalColor, directLight, lightMask);
433-
Surface.Diffuse = finalColor;
433+
Surface.Diffuse = finalColor * Surface.LightColor.a;
434434
ApplyAmbientGradient(Surface);
435435
Surface.Attenuation = lightMask;
436436
ApplyAreaTint(Surface);
@@ -495,7 +495,7 @@ void Shade4PointLights(float3 normal, float3 worldPos, out float3 color, out flo
495495
// simple ambient add
496496
finalDiffuse += Surface.IndirectDiffuse * Surface.Albedo;
497497
#endif
498-
Surface.Diffuse = finalDiffuse;
498+
Surface.Diffuse = finalDiffuse * Surface.LightColor.a;
499499
Surface.Attenuation = band1Edge; // for specular masking
500500
ApplyAmbientGradient(Surface);
501501
ApplyAreaTint(Surface);
@@ -547,7 +547,7 @@ void Shade4PointLights(float3 normal, float3 worldPos, out float3 color, out flo
547547
float3 skinRamp = UNITY_SAMPLE_TEX2D(_SkinLUT, lutUV).rgb;
548548
float rampLuma = GetLuma(skinRamp);
549549
float3 tint = lerp(_SkinShadowColor.rgb, float3(1, 1, 1), rampLuma);
550-
Surface.Diffuse = Surface.Albedo * Surface.LightColor.rgb * skinRamp * tint;
550+
Surface.Diffuse = Surface.Albedo * Surface.LightColor.rgb * Surface.LightColor.a * skinRamp * tint;
551551
Surface.Diffuse += Surface.IndirectDiffuse * Surface.Albedo * smoothstep(0, 0.5, rampLuma);
552552
Surface.Attenuation = rampLuma;
553553
ApplyAmbientGradient(Surface);
@@ -572,7 +572,7 @@ void Shade4PointLights(float3 normal, float3 worldPos, out float3 color, out flo
572572
float normalizationFactor = lerp(1.0, 1.0 / (1.0 + _WrapFactor), _WrapNormalization);
573573
float3 ramp = lerp(_WrapColorLow.rgb, _WrapColorHigh.rgb, wrappedNdotL);
574574
ramp *= normalizationFactor;
575-
Surface.Diffuse = Surface.Albedo * ramp * Surface.LightColor.rgb;
575+
Surface.Diffuse = Surface.Albedo * ramp * Surface.LightColor.rgb * Surface.LightColor.a;
576576
Surface.Diffuse += Surface.IndirectDiffuse * Surface.Albedo;
577577
Surface.Attenuation = wrappedNdotL;
578578
ApplyAmbientGradient(Surface);

0 commit comments

Comments
 (0)