Skip to content

Commit b68ce13

Browse files
FrancescoC-unityadrien-de-tocquevillesebastienlagardepmavridisjohnpars
authored
Avoid issues causing faulty transitions in shadows (resulting in no shadows with unconventional aspect ratio) (#2776)
* Fixed volume component tooltips using the same parameter name (#2754) * Use the proper history info for Bicubic resampling in TAA (#2759) * Use proper info for previous buffer info * changelog * Fixed lookdev movement (#2757) Co-authored-by: sebastienlagarde <sebastien@unity3d.com> * [HDRP] Fix issue with saving some quality settings in volume overrides (#2758) * Fix issue with saving some quality settings volume overrides * Fix typo in changelog Co-authored-by: sebastienlagarde <sebastien@unity3d.com> * [HDRP] Fixed NullReferenceException in HDRenderPipeline.UpgradeResourcesIfNeeded (case 1292524) (#2765) * fix issue with confusing text (#2766) * Fix * Fix white dots * Changelog * Rename the sunrise icon to fix typo, causing issue with 2x resolution loading. (#2809) * [HDRP] Rename HDRP to HD Render Pipeline in menu item (#2819) * [HDRP] Update HDRP menu in shader graph * Update CHANGELOG.md * HDRP/Fix package version showing package after the last "verified" package (#2783) * Fix typo * Remove last version checker from wizard and add link to package manager instead * Update CHANGELOG.md * Update documentation * Update Render-Pipeline-Wizard.md Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com> * Revert bad changelog merge * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Adrien de Tocqueville <adrien.tocqueville@unity3d.com> Co-authored-by: sebastienlagarde <sebastien@unity3d.com> Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com> Co-authored-by: John Parsaie <johnpa@unity3d.com> Co-authored-by: Remi Slysz <40034005+RSlysz@users.noreply.github.com>
1 parent e5e7c25 commit b68ce13

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1717
- Fixed probe volumes debug views.
1818
- Fixed ShaderGraph Decal material not showing exposed properties.
1919
- Fixed wrong coat normal space in shader graph
20+
- Fixed issue with faulty shadow transition when view is close to an object under some aspect ratio conditions
2021

2122
### Changed
2223
- Removed the material pass probe volumes evaluation mode.

com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAlgorithms.hlsl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,15 @@ int EvalShadow_GetSplitIndex(HDShadowContext shadowContext, int index, float3 po
206206

207207
// The above code will generate transitions on the whole cascade sphere boundary.
208208
// It means that depending on the light and camera direction, sometimes the transition appears on the wrong side of the cascade
209-
// To avoid that we attenuate the effect (lerp to 0.0) when view direction and cascade center to pixel vector face opposite directions.
209+
// To avoid that we attenuate the effect (lerp very sharply to 0.0) when view direction and cascade center to pixel vector face opposite directions.
210210
// This way you only get fade out on the right side of the cascade.
211211
float3 viewDir = GetWorldSpaceViewDir(positionWS);
212-
float cascDot = dot(viewDir, wposDir);
213-
alpha = lerp(alpha, 0.0, saturate(cascDot * 4.0));
214212

213+
float cascDot = dot(viewDir, wposDir);
214+
// At high border sizes the sharp lerp is noticeable, hence we need to lerp how sharpenss factor
215+
// if we are below 80% we keep the very sharp transition.
216+
float lerpSharpness = 8.0f + 512.0f * smoothstep(1.0f, 0.7f, border);// lerp(1024.0f, 8.0f, saturate(border - 0.8) / 0.2f);
217+
alpha = lerp(alpha, 0.0, saturate(cascDot * lerpSharpness));
215218
return shadowSplitIndex;
216219
}
217220

@@ -298,7 +301,7 @@ float EvalShadow_CascadedDepth_Dither_SplitIndex(HDShadowContext shadowContext,
298301

299302
/* We select what split we need to sample from */
300303
float nextSplit = min(shadowSplitIndex + 1, cascadeCount - 1);
301-
bool evalNextCascade = nextSplit != shadowSplitIndex && step(InterleavedGradientNoise(positionSS.xy, _TaaFrameInfo.z), alpha);
304+
bool evalNextCascade = nextSplit != shadowSplitIndex && alpha > 0 && step(InterleavedGradientNoise(positionSS.xy, _TaaFrameInfo.z), alpha);
302305

303306
if (evalNextCascade)
304307
{

0 commit comments

Comments
 (0)