Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,18 @@ void frag(VertexOutput i, out float4 finalRGBA : SV_Target0
float3 halfDirection = normalize(viewDirection + lightDirection);

#ifdef _IS_PASS_FWDBASE
float3 Set_LightColor = lightColor.rgb;
float3 Set_BaseColor = lerp((_BaseColor.rgb * mainTex.rgb),
((_BaseColor.rgb * mainTex.rgb) * Set_LightColor), _Is_LightColor_Base);
//v.2.0.5
const float3 baseAlbedo = _BaseColor.rgb * mainTex.rgb;
const float4 firstShadeTex = lerp(SAMPLE_TEXTURE2D(_1st_ShadeMap, sampler_MainTex, mainTexUV),mainTex, _Use_BaseAs1st);
float3 Set_1st_ShadeColor = lerp((_1st_ShadeColor.rgb * firstShadeTex.rgb),((_1st_ShadeColor.rgb * firstShadeTex.rgb) * Set_LightColor), _Is_LightColor_1st_Shade);
const float3 firstShadeAlbedo = _1st_ShadeColor.rgb * firstShadeTex.rgb;
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace should be removed from the end of this line.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

const float4 secondShadeTex = lerp(SAMPLE_TEXTURE2D(_2nd_ShadeMap, sampler_MainTex, mainTexUV),firstShadeTex, _Use_1stAs2nd);
float3 Set_2nd_ShadeColor = lerp((_2nd_ShadeColor.rgb * secondShadeTex.rgb),((_2nd_ShadeColor.rgb * secondShadeTex.rgb) * Set_LightColor), _Is_LightColor_2nd_Shade);
const float3 secondShadeAlbedo = _2nd_ShadeColor.rgb * secondShadeTex.rgb;
Comment on lines +147 to +151
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The albedo variables are declared within the _IS_PASS_FWDBASE block but are used in other code paths (lines 363, 365-366, 455, 457-458). These variables should be moved outside the #ifdef _IS_PASS_FWDBASE block to be accessible in all rendering passes, similar to how they are declared at the top of the function in UniversalToonBodyShadingGradeMap.hlsl.

Copilot uses AI. Check for mistakes.

//v.2.0.5
float3 Set_LightColor = lightColor.rgb;
float3 Set_BaseColor = lerp((baseAlbedo),(baseAlbedo * Set_LightColor), _Is_LightColor_Base);
float3 Set_1st_ShadeColor = lerp(firstShadeAlbedo,(firstShadeAlbedo * Set_LightColor), _Is_LightColor_1st_Shade);
float3 Set_2nd_ShadeColor = lerp(secondShadeAlbedo,(secondShadeAlbedo * Set_LightColor), _Is_LightColor_2nd_Shade);
float _HalfLambert_var = 0.5 * dot(lerp(i.normalDir, normalDirection, _Is_NormalMapToBase), lightDirection) + 0.5;


//v.2.0.6
//Minmimum value is same as the Minimum Feather's value with the Minimum Step's value as threshold.
Expand Down Expand Up @@ -358,11 +360,10 @@ void frag(VertexOutput i, out float4 finalRGBA : SV_Target0
//v.2.0.5: Filtering the high intensity zone of PointLights
float3 Set_LightColor = lightColor;
//
float3 Set_BaseColor = lerp((_BaseColor.rgb * mainTex.rgb * _LightIntensity),
((_BaseColor.rgb * mainTex.rgb) * Set_LightColor), _Is_LightColor_Base);
float3 Set_BaseColor = lerp((baseAlbedo * _LightIntensity),(baseAlbedo * Set_LightColor), _Is_LightColor_Base);
//v.2.0.5
float3 Set_1st_ShadeColor = lerp((_1st_ShadeColor.rgb * firstShadeTex.rgb * _LightIntensity),((_1st_ShadeColor.rgb * firstShadeTex.rgb) * Set_LightColor), _Is_LightColor_1st_Shade);
float3 Set_2nd_ShadeColor = lerp((_2nd_ShadeColor.rgb * secondShadeTex.rgb * _LightIntensity),((_2nd_ShadeColor.rgb * secondShadeTex.rgb) * Set_LightColor), _Is_LightColor_2nd_Shade);
float3 Set_1st_ShadeColor = lerp((firstShadeAlbedo * _LightIntensity),(firstShadeAlbedo * Set_LightColor), _Is_LightColor_1st_Shade);
float3 Set_2nd_ShadeColor = lerp((secondShadeAlbedo * _LightIntensity),(secondShadeAlbedo * Set_LightColor), _Is_LightColor_2nd_Shade);
float _HalfLambert_var = 0.5 * dot(lerp(i.normalDir, normalDirection, _Is_NormalMapToBase), lightDirection) + 0.5;

//v.2.0.5:
Expand Down Expand Up @@ -451,11 +452,10 @@ void frag(VertexOutput i, out float4 finalRGBA : SV_Target0
//v.2.0.5: Filtering the high intensity zone of PointLights
float3 Set_LightColor = lightColor;
//
float3 Set_BaseColor = lerp((_BaseColor.rgb * mainTex.rgb * _LightIntensity),
((_BaseColor.rgb * mainTex.rgb) * Set_LightColor), _Is_LightColor_Base);
float3 Set_BaseColor = lerp((baseAlbedo * _LightIntensity),(baseAlbedo * Set_LightColor), _Is_LightColor_Base);
//v.2.0.5
float3 Set_1st_ShadeColor = lerp((_1st_ShadeColor.rgb * firstShadeTex.rgb * _LightIntensity),((_1st_ShadeColor.rgb * firstShadeTex.rgb) * Set_LightColor), _Is_LightColor_1st_Shade);
float3 Set_2nd_ShadeColor = lerp((_2nd_ShadeColor.rgb * secondShadeTex.rgb * _LightIntensity),((_2nd_ShadeColor.rgb * secondShadeTex.rgb) * Set_LightColor), _Is_LightColor_2nd_Shade);
float3 Set_1st_ShadeColor = lerp((firstShadeAlbedo * _LightIntensity),(firstShadeAlbedo * Set_LightColor), _Is_LightColor_1st_Shade);
float3 Set_2nd_ShadeColor = lerp((secondShadeAlbedo * _LightIntensity),(secondShadeAlbedo * Set_LightColor), _Is_LightColor_2nd_Shade);
float _HalfLambert_var = 0.5 * dot(lerp(i.normalDir, normalDirection, _Is_NormalMapToBase), lightDirection) + 0.5;

//v.2.0.5:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ void frag(VertexOutput i, out float4 finalRGBA : SV_Target0
const float4 highlightTex = tex2D(_HighColor_Tex, TRANSFORM_TEX(Set_UV0, _HighColor_Tex));
const float4 highlightMaskTex = tex2D(_Set_HighColorMask, TRANSFORM_TEX(Set_UV0, _Set_HighColorMask));

const float3 baseAlbedo = _BaseColor.rgb * mainTex.rgb;
const float3 firstShadeAlbedo = _1st_ShadeColor.rgb * firstShadeTex.rgb;
const float3 secondShadeAlbedo = _2nd_ShadeColor.rgb * secondShadeTex.rgb;

#ifdef _DBUFFER
ApplyDecalToSurfaceDataUTS(input.positionCS, mainTex.rgb, surfaceData, normalDirection);
#endif
Expand Down Expand Up @@ -135,12 +139,10 @@ void frag(VertexOutput i, out float4 finalRGBA : SV_Target0

#ifdef _IS_PASS_FWDBASE
float3 Set_LightColor = lightColor.rgb;
float3 Set_BaseColor = lerp((mainTex.rgb * _BaseColor.rgb),
((mainTex.rgb * _BaseColor.rgb) * Set_LightColor), _Is_LightColor_Base);
float3 Set_BaseColor = lerp((baseAlbedo), (baseAlbedo * Set_LightColor), _Is_LightColor_Base);
//v.2.0.5
float3 _Is_LightColor_1st_Shade_var = lerp((firstShadeTex.rgb * _1st_ShadeColor.rgb),((firstShadeTex.rgb * _1st_ShadeColor.rgb) * Set_LightColor), _Is_LightColor_1st_Shade);
float3 _Is_LightColor_1st_Shade_var = lerp(firstShadeAlbedo,(firstShadeAlbedo * Set_LightColor), _Is_LightColor_1st_Shade);
float _HalfLambert_var = 0.5 * dot(lerp(i.normalDir, normalDirection, _Is_NormalMapToBase), lightDirection) + 0.5;
// Half Lambert

//v.2.0.6
float4 _ShadingGradeMap_var = tex2Dlod(_ShadingGradeMap,
Expand Down Expand Up @@ -432,11 +434,10 @@ void frag(VertexOutput i, out float4 finalRGBA : SV_Target0
//v.2.0.5: Filtering the high intensity zone of PointLights
float3 Set_LightColor = lightColor;
//
float3 Set_BaseColor = lerp((_BaseColor.rgb * mainTex.rgb * _LightIntensity),
((_BaseColor.rgb * mainTex.rgb) * Set_LightColor), _Is_LightColor_Base);
float3 Set_BaseColor = lerp((baseAlbedo * _LightIntensity), (baseAlbedo * Set_LightColor), _Is_LightColor_Base);
//v.2.0.5
float3 Set_1st_ShadeColor = lerp((_1st_ShadeColor.rgb * firstShadeTex.rgb * _LightIntensity),((_1st_ShadeColor.rgb * firstShadeTex.rgb) * Set_LightColor), _Is_LightColor_1st_Shade);
float3 Set_2nd_ShadeColor = lerp((_2nd_ShadeColor.rgb * secondShadeTex.rgb * _LightIntensity),((_2nd_ShadeColor.rgb * secondShadeTex.rgb) * Set_LightColor), _Is_LightColor_2nd_Shade);
float3 Set_1st_ShadeColor = lerp((firstShadeAlbedo * _LightIntensity),(firstShadeAlbedo * Set_LightColor), _Is_LightColor_1st_Shade);
float3 Set_2nd_ShadeColor = lerp((secondShadeAlbedo * _LightIntensity),(secondShadeAlbedo * Set_LightColor), _Is_LightColor_2nd_Shade);
float _HalfLambert_var = 0.5 * dot(lerp(i.normalDir, normalDirection, _Is_NormalMapToBase), lightDirection) + 0.5;

// float4 _Set_2nd_ShadePosition_var = tex2D(_Set_2nd_ShadePosition, TRANSFORM_TEX(Set_UV0, _Set_2nd_ShadePosition));
Expand Down Expand Up @@ -551,12 +552,11 @@ void frag(VertexOutput i, out float4 finalRGBA : SV_Target0
notDirectional);
//v.2.0.5: Filtering the high intensity zone of PointLights
float3 Set_LightColor = lightColor;
//
float3 Set_BaseColor = lerp((_BaseColor.rgb * mainTex.rgb * _LightIntensity),
((_BaseColor.rgb * mainTex.rgb) * Set_LightColor), _Is_LightColor_Base);
float3 Set_BaseColor = lerp((baseAlbedo * _LightIntensity), (baseAlbedo * Set_LightColor), _Is_LightColor_Base);

//v.2.0.5
float3 Set_1st_ShadeColor = lerp((_1st_ShadeColor.rgb * firstShadeTex.rgb * _LightIntensity),((_1st_ShadeColor.rgb * firstShadeTex.rgb) * Set_LightColor), _Is_LightColor_1st_Shade);
float3 Set_2nd_ShadeColor = lerp((_2nd_ShadeColor.rgb * secondShadeTex.rgb * _LightIntensity),((_2nd_ShadeColor.rgb * secondShadeTex.rgb) * Set_LightColor), _Is_LightColor_2nd_Shade);
float3 Set_1st_ShadeColor = lerp((firstShadeAlbedo * _LightIntensity),(firstShadeAlbedo * Set_LightColor), _Is_LightColor_1st_Shade);
float3 Set_2nd_ShadeColor = lerp((secondShadeAlbedo * _LightIntensity),(secondShadeAlbedo * Set_LightColor), _Is_LightColor_2nd_Shade);
float _HalfLambert_var = 0.5 * dot(lerp(i.normalDir, normalDirection, _Is_NormalMapToBase), lightDirection) + 0.5;

// float4 _Set_2nd_ShadePosition_var = tex2D(_Set_2nd_ShadePosition, TRANSFORM_TEX(Set_UV0, _Set_2nd_ShadePosition));
Expand Down