Search Unity

Shadow Distance

Discussion in 'High Definition Render Pipeline' started by Ne0mega, Jan 29, 2020.

  1. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    755
    It seems no matter what settings I monkey with, I can not get the shadow cull distance to change, ie, when my camera is a certain distance away, shadows cease.
    This is using realtime lighting only, no baked lights or shadows.

    I have tried adjusting:
    Shadows -> MaxDistance in scene settings. still the same.

    I have tried adjusting HDRP assets maximum shadows on screen, pump it up to a million. Same result. Shadows quickly cull away as if I did nothing.

    I have tried near plane in the directional light settings. Shadows still cull away quickly.

    This is a larger strategy map with fairly large dimensions (about 2048 x 2048 units aka meters), but not enormous.

    I am also get this constantly in my console, even though I have very little at all in my scene:
    (a light, a camera, two empty objects that generate meshes during runtime, but these errors are constantly repeating in the editor, not during runtime)
    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.LightLoopUpdateCullingParameters (UnityEngine.Rendering.ScriptableCullingParameters& cullingParams) (at Library/PackageCache/com.unity.render-pipelines.high-definition@6.9.0-preview/Runtime/Lighting/LightLoop/LightLoop.cs:1717)
    UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.TryCalculateFrameParameters (UnityEngine.Camera camera, UnityEngine.Experimental.Rendering.HDPipeline.XRPass xrPass, UnityEngine.Experimental.Rendering.HDPipeline.HDAdditionalCameraData& additionalCameraData, UnityEngine.Experimental.Rendering.HDPipeline.HDCamera& hdCamera, UnityEngine.Rendering.ScriptableCullingParameters& cullingParams) (at Library/PackageCache/com.unity.render-pipelines.high-definition@6.9.0-preview/Runtime/RenderPipeline/HDRenderPipeline.cs:2259)
    UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, UnityEngine.Camera[] cameras) (at Library/PackageCache/com.unity.render-pipelines.high-definition@6.9.0-preview/Runtime/RenderPipeline/HDRenderPipeline.cs:1043)
    UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera[] cameras) (at C:/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipeline.cs:72)
    UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, UnityEngine.Camera[] cameras, System.IntPtr loopPtr, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at C:/buildslave/unity/build/Runtime/Export/RenderPipeline/RenderPipelineManager.cs:67)


    and this


    XRSystem.ReleaseFrame() was not called!
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

    2019.2.16f

    from
    https://docs.unity3d.com/Packages/c...h-definition@7.1/manual/Override-Shadows.html

    "In the Inspector, navigate to Add Override > Shadowing and click on Shadows. You can now use the Shadows override to alter shadow settings for this Volume."

    There is no plain "shadows", "Micro Shadows" and "Contact Shadows" are the only two options.
     
    Last edited: Jan 29, 2020
  2. laurent-h

    laurent-h

    Joined:
    Sep 29, 2016
    Posts:
    78
    Hi,
    The documentation page you're linking is indeed the correct way to set the maximum shadow distance in HDRP.
    Could you possibly already have a Shadow override in your Volume profile ?
    If you do, you would indeed not be able to add another Shadows override ( so shadows wouldn't be in the Add Override list).


     
  3. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    755
    So I removed the shadows, and then re-added, and was able to get shadows as an option to add... but the distance modifier still isnt doing anything.

    I also set volume priority to 1000000... you know, just in case.

    I know I am messing with the right controls, because they will turn off shadows with a quickness with some modifications.

    The only other thing I can think is that my generated Mesh I am using as terrain is using a shadergraph. But that doesnt make sense because if I turn on Cascades and monkey with the cascade splits, it does make changes to the shadow culling.... within the area I can never seem to expand beyond. I have also turned off fog, and virtually everything else. I only have one light, a directional light.

    and there is still this error that repeats itself, even in editor:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.Experimental.Rendering.HDPipeline.HDRenderPipeline.LightLoopUpdateCullingParameters (UnityEngine.Rendering.ScriptableCullingParameters& cullingParams)
     
    Last edited: Jan 29, 2020
  4. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    755
    Now Ive noticed that unchecking all the cascade boxes, including count, border 1, border2 etc, doesn't do anything. They are all grayed out, but it still uses the settings entered before they were all disabled.
     
  5. laurent-h

    laurent-h

    Joined:
    Sep 29, 2016
    Posts:
    78
    Is your Volume profile assigned to a global or local volume ?
    Is the Volume on the default layer or on another layer ?
    On the camera there is a field "Volume layer mask" which filters which layers it will search for volumes.
     
  6. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    755
    global, default, default.
    Tried everything and nothing on the camera's volume layer mask, no difference. Nothing changed.

    I have also methodically gone through and messed with about 30 other tweaks.

    I can see the sphere on my map, where the shadow is being cut off. Its not just the trees and map details that stop projecting shadow, it is also the terrain whose features stop casting shadow.

    Also, when viewing stats, Shadow Casters ALWAYS shows 0, even though there is clearly shadows being cast.

    the LightloopUpdateCullingParameters error and the XRSystemreleaseFrame error continuously adds up in the console when my cursor is over the scene view window or the game view window, or any action is taken, so it is related to the Editor, and does not happen when in game state. It feels like the project is forever stuck in the original maximum shadow render distance. I can turn it down to nothing, so no shadows render, or they only render very close, but never turn it up, so shadows will be rendered beyond a certain point.

    If I extend the far clipping plane of the camera, eventually, no shadows will show up. If I bring it back into normal ranges (for me 200 - 1200), then it shows shadows as normal, (normal messed up limit).
     
    Last edited: Jan 30, 2020