fix: use _CLUSTER_LIGHT_LOOP keyword for Unity 6.3+#853
Merged
Conversation
Closed
There was a problem hiding this comment.
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_PLUStoUSE_CLUSTER_LIGHT_LOOPfor directional additional-light handling and GI. - Added Unity-version-gated shader keywords:
_CLUSTER_LIGHT_LOOPfor 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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 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 |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.