@@ -184,8 +184,6 @@ Shader "Mixed Reality Toolkit/Standard"
184
184
#pragma shader_feature _ENVIRONMENT_COLORING
185
185
#pragma shader_feature _IGNORE_Z_SCALE
186
186
187
- #define IF (a, b, c) lerp (b, c, step ((fixed ) (a), 0.0 ));
188
-
189
187
#include "UnityCG.cginc"
190
188
#include "UnityUI.cginc"
191
189
#include "UnityStandardConfig.cginc"
@@ -279,7 +277,7 @@ Shader "Mixed Reality Toolkit/Standard"
279
277
UNITY_VERTEX_INPUT_INSTANCE_ID
280
278
};
281
279
282
- struct v2f
280
+ struct v2f
283
281
{
284
282
float4 position : SV_POSITION ;
285
283
#if defined (_BORDER_LIGHT)
@@ -456,7 +454,7 @@ Shader "Mixed Reality Toolkit/Standard"
456
454
457
455
#if defined (_ROUND_CORNERS)
458
456
#if defined (_INDEPENDENT_CORNERS)
459
- float4 _RoundCornersRadius;
457
+ float4 _RoundCornersRadius;
460
458
#else
461
459
fixed _RoundCornerRadius;
462
460
#endif
@@ -473,7 +471,7 @@ Shader "Mixed Reality Toolkit/Standard"
473
471
#endif
474
472
475
473
#if defined (_ROUND_CORNERS) || defined (_BORDER_LIGHT)
476
- fixed _EdgeSmoothingValue;
474
+ float _EdgeSmoothingValue;
477
475
#endif
478
476
479
477
#if defined (_INNER_GLOW)
@@ -530,7 +528,7 @@ Shader "Mixed Reality Toolkit/Standard"
530
528
{
531
529
float proximityLightDistance = dot (proximityLight.xyz - worldPosition, worldNormal);
532
530
#if defined (_PROXIMITY_LIGHT_TWO_SIDED)
533
- worldNormal = IF ( proximityLightDistance < 0.0 , -worldNormal, worldNormal) ;
531
+ worldNormal = proximityLightDistance < 0.0 ? -worldNormal : worldNormal;
534
532
proximityLightDistance = abs (proximityLightDistance);
535
533
#endif
536
534
float normalizedProximityLightDistance = saturate (proximityLightDistance * proximityLightParams.y);
@@ -556,12 +554,12 @@ Shader "Mixed Reality Toolkit/Standard"
556
554
return length (max (abs (position) - cornerCircleDistance, 0.0 )) - cornerCircleRadius;
557
555
}
558
556
559
- inline fixed RoundCornersSmooth (float2 position, float2 cornerCircleDistance, float cornerCircleRadius)
557
+ inline float RoundCornersSmooth (float2 position, float2 cornerCircleDistance, float cornerCircleRadius)
560
558
{
561
559
return smoothstep (1.0 , 0.0 , PointVsRoundedBox (position, cornerCircleDistance, cornerCircleRadius) / _EdgeSmoothingValue);
562
560
}
563
561
564
- inline fixed RoundCorners (float2 position, float2 cornerCircleDistance, float cornerCircleRadius)
562
+ inline float RoundCorners (float2 position, float2 cornerCircleDistance, float cornerCircleRadius)
565
563
{
566
564
#if defined (_TRANSPARENT)
567
565
return RoundCornersSmooth (position, cornerCircleDistance, cornerCircleRadius);
@@ -668,7 +666,7 @@ Shader "Mixed Reality Toolkit/Standard"
668
666
669
667
#if defined (_BORDER_LIGHT) || defined (_ROUND_CORNERS)
670
668
o.uv.xy = TRANSFORM_TEX (v.uv, _MainTex);
671
-
669
+
672
670
float minScale = min (min (o.scale.x, o.scale.y), o.scale.z);
673
671
674
672
#if defined (_BORDER_LIGHT)
@@ -723,8 +721,8 @@ Shader "Mixed Reality Toolkit/Standard"
723
721
724
722
#if defined (_BORDER_LIGHT)
725
723
float scaleRatio = min (o.scale.x, o.scale.y) / max (o.scale.x, o.scale.y);
726
- o.uv.z = IF ( o.scale.x > o.scale.y, 1.0 - (borderWidth * scaleRatio), 1.0 - borderWidth) ;
727
- o.uv.w = IF ( o.scale.x > o.scale.y, 1.0 - borderWidth, 1.0 - (borderWidth * scaleRatio) );
724
+ o.uv.z = o.scale.x > o.scale.y ? 1.0 - (borderWidth * scaleRatio) : 1.0 - borderWidth;
725
+ o.uv.w = o.scale.x > o.scale.y ? 1.0 - borderWidth : 1.0 - (borderWidth * scaleRatio);
728
726
#endif
729
727
#elif defined (_UV)
730
728
o.uv = TRANSFORM_TEX (v.uv, _MainTex);
@@ -798,8 +796,8 @@ Shader "Mixed Reality Toolkit/Standard"
798
796
fixed4 albedo = fixed4 (1.0 , 1.0 , 1.0 , 1.0 );
799
797
#else
800
798
#if defined (_TRIPLANAR_MAPPING)
801
- fixed4 albedo = tex2D (_MainTex, uvX) * triplanarBlend.x +
802
- tex2D (_MainTex, uvY) * triplanarBlend.y +
799
+ fixed4 albedo = tex2D (_MainTex, uvX) * triplanarBlend.x +
800
+ tex2D (_MainTex, uvY) * triplanarBlend.y +
803
801
tex2D (_MainTex, uvZ) * triplanarBlend.z;
804
802
#else
805
803
#if defined (_USE_SSAA)
@@ -860,7 +858,7 @@ Shader "Mixed Reality Toolkit/Standard"
860
858
#endif
861
859
#if defined (_CLIPPING_BORDER)
862
860
fixed3 primitiveBorderColor = lerp (_ClippingBorderColor, fixed3 (0.0 , 0.0 , 0.0 ), primitiveDistance / _ClippingBorderWidth);
863
- albedo.rgb += primitiveBorderColor * IF (( primitiveDistance < _ClippingBorderWidth), 1.0 , 0.0 );
861
+ albedo.rgb += primitiveBorderColor * ( primitiveDistance < _ClippingBorderWidth ? 1.0 : 0.0 );
864
862
#endif
865
863
#endif
866
864
@@ -1013,13 +1011,13 @@ Shader "Mixed Reality Toolkit/Standard"
1013
1011
#if defined (_BORDER_LIGHT)
1014
1012
fixed borderValue;
1015
1013
#if defined (_ROUND_CORNERS)
1016
- fixed borderMargin = _RoundCornerMargin + _BorderWidth * 0.5 ;
1014
+ fixed borderMargin = _RoundCornerMargin + _BorderWidth * 0.5 ;
1017
1015
1018
1016
cornerCircleRadius = saturate (max (currentCornerRadius - borderMargin, 0.01 )) * i.scale.z;
1019
1017
1020
1018
cornerCircleDistance = halfScale - (borderMargin * i.scale.z) - cornerCircleRadius;
1021
1019
1022
- borderValue = 1.0 - RoundCornersSmooth (roundCornerPosition, cornerCircleDistance, cornerCircleRadius);
1020
+ borderValue = 1.0 - RoundCornersSmooth (roundCornerPosition, cornerCircleDistance, cornerCircleRadius);
1023
1021
#else
1024
1022
borderValue = max (smoothstep (i.uv.z - _EdgeSmoothingValue, i.uv.z + _EdgeSmoothingValue, distanceToEdge.x),
1025
1023
smoothstep (i.uv.w - _EdgeSmoothingValue, i.uv.w + _EdgeSmoothingValue, distanceToEdge.y));
@@ -1152,7 +1150,7 @@ Shader "Mixed Reality Toolkit/Standard"
1152
1150
// Environment coloring.
1153
1151
#if defined (_ENVIRONMENT_COLORING)
1154
1152
fixed3 environmentColor = incident.x * incident.x * _EnvironmentColorX +
1155
- incident.y * incident.y * _EnvironmentColorY +
1153
+ incident.y * incident.y * _EnvironmentColorY +
1156
1154
incident.z * incident.z * _EnvironmentColorZ;
1157
1155
output.rgb += environmentColor * max (0.0 , dot (incident, worldNormal) + _EnvironmentColorThreshold) * _EnvironmentColorIntensity;
1158
1156
@@ -1255,7 +1253,7 @@ Shader "Mixed Reality Toolkit/Standard"
1255
1253
ENDCG
1256
1254
}
1257
1255
}
1258
-
1256
+
1259
1257
Fallback "Hidden/InternalErrorShader"
1260
1258
CustomEditor "Microsoft.MixedReality.Toolkit.Editor.MixedRealityStandardShaderGUI"
1261
1259
}
0 commit comments