@@ -488,6 +488,9 @@ inline void ApplyVertexColor(in out half4 color, in half4 vertexColor)
488
488
inline void ApplyEmissionColor (in out half4 color, half2 emissionMapUv, float intensity, half emissionMapProgress,
489
489
half emissionChannelsX)
490
490
{
491
+ // Texture compression may introduce an error of 1/256, so it's advisable to allow for some margin
492
+ const half tex_comp_err_margin = 0.004 ;
493
+
491
494
half emissionIntensity = 0 ;
492
495
half emissionColorRampU = 0 ;
493
496
#ifdef _EMISSION_AREA_ALL
@@ -498,13 +501,13 @@ inline void ApplyEmissionColor(in out half4 color, half2 emissionMapUv, float in
498
501
#if defined (_EMISSION_COLOR_COLOR) || defined (_EMISSION_COLOR_BASECOLOR)
499
502
emissionIntensity = emissionMapValue;
500
503
#elif _EMISSION_COLOR_MAP
501
- emissionIntensity = step (0.0001 , emissionMapValue);
504
+ emissionIntensity = step (tex_comp_err_margin , emissionMapValue);
502
505
emissionColorRampU = emissionMapValue;
503
506
#endif
504
507
#elif _EMISSION_AREA_ALPHA
505
- emissionIntensity = step (0.0001 , 1.0 - color.a);
508
+ emissionIntensity = step (tex_comp_err_margin , 1.0 - color.a);
506
509
emissionColorRampU = color.a;
507
- color.a = _KeepEdgeTransparency >= 0.5f ? color.a : step (0.0001 , color.a);
510
+ color.a = _KeepEdgeTransparency >= 0.5f ? color.a : step (tex_comp_err_margin , color.a);
508
511
#endif
509
512
510
513
half3 emissionColor = 0 ;
0 commit comments