Skip to content

fix: use _CLUSTER_LIGHT_LOOP keyword for Unity 6.3+#853

Merged
sindharta-tanuwijaya merged 19 commits into
masterfrom
fix-again6.6-2
Jun 24, 2026
Merged

fix: use _CLUSTER_LIGHT_LOOP keyword for Unity 6.3+#853
sindharta-tanuwijaya merged 19 commits into
masterfrom
fix-again6.6-2

Conversation

@sindharta

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the URP Toon shader to use Unity/URP’s newer Cluster Light Loop path (Unity 6.3+) instead of the older Forward+ path, and updates shader variant keywords accordingly.

Changes:

  • Switched URP shader logic guards from USE_FORWARD_PLUS to USE_CLUSTER_LIGHT_LOOP for directional additional-light handling and GI.
  • Added Unity-version-gated shader keywords: _CLUSTER_LIGHT_LOOP for Unity >= 60030000, otherwise _FORWARD_PLUS.
  • Adjusted URP rendering-layer encoding macro usage for Unity >= 60030000.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBodyShadingGradeMap.hlsl Switch directional additional-light loop guard to Cluster Light Loop.
com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBodyDoubleShadeWithFeather.hlsl Switch directional additional-light loop guard and subtractive-light check macro usage to Cluster Light Loop.
com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBody.hlsl Switch GI path guard to Cluster Light Loop; adjust rendering-layer encoding macro; add cluster subtractive-check macro handling.
com.unity.toonshader/Runtime/Shaders/UnityToonTessellation.shader Gate _CLUSTER_LIGHT_LOOP vs _FORWARD_PLUS multi_compile by Unity version; update autogen timestamp.
com.unity.toonshader/Runtime/Shaders/UnityToon.shader Gate _CLUSTER_LIGHT_LOOP vs _FORWARD_PLUS multi_compile by Unity version; update autogen timestamp.
com.unity.toonshader/Runtime/Shaders/Common/Parts/UnityToonTessellation.shadertemplate Template update to gate _CLUSTER_LIGHT_LOOP vs _FORWARD_PLUS.
com.unity.toonshader/Runtime/Shaders/Common/Parts/UnityToon.shadertemplate Template update to gate _CLUSTER_LIGHT_LOOP vs _FORWARD_PLUS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBodyShadingGradeMap.hlsl Outdated
Comment thread com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBodyShadingGradeMap.hlsl Outdated
Comment thread com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBody.hlsl Outdated
Comment thread com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBody.hlsl
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sindharta-tanuwijaya sindharta-tanuwijaya changed the title Fix again6.6 2 fix: use _CLUSTER_LIGHT_LOOP keyword for Unity 6.3+ Jun 24, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBodyShadingGradeMap.hlsl:485

  • This directional-light loop is now guarded only by USE_CLUSTER_LIGHT_LOOP, which can drop directional additional lights on Unity/URP versions that still use Forward+ (USE_FORWARD_PLUS).

Use USE_FORWARD_PLUS || USE_CLUSTER_LIGHT_LOOP here so both paths keep the same lighting behavior.

#if USE_CLUSTER_LIGHT_LOOP
    // directional lights in Forward Plus
    for (uint loopCounter = 0; loopCounter < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); loopCounter++)
    {
        float3 perLightContribution = ProcessAdditionalLightSG(

Comment thread com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBody.hlsl
Comment on lines +402 to +406
#if USE_CLUSTER_LIGHT_LOOP
// directional lights in Forward Plus
for (uint lightIndex = 0; lightIndex < min(URP_FP_DIRECTIONAL_LIGHTS_COUNT, MAX_VISIBLE_LIGHTS); lightIndex++)
{
FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
CLUSTER_LIGHT_LOOP_SUBTRACTIVE_LIGHT_CHECK

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comment thread com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBody.hlsl
Comment thread com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBodyShadingGradeMap.hlsl Outdated
Comment thread com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBodyShadingGradeMap.hlsl Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread com.unity.toonshader/Runtime/Shaders/URP/UniversalToonBody.hlsl
@sindharta-tanuwijaya sindharta-tanuwijaya merged commit b022270 into master Jun 24, 2026
32 checks passed
@sindharta-tanuwijaya sindharta-tanuwijaya deleted the fix-again6.6-2 branch June 24, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants