Announcement

Collapse
No announcement yet.

Shadows disappear with increased camera distance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Shadows disappear with increased camera distance

    I was playing with a pseudo-isometric camera style (low camera Field of View) with a larger camera distance to give it a 2.5D feeling but still maintain some perspective.

    Anyhow, I'm not sure if this is a bug or if I need to change the way my lighting is being handled in the scene. When the camera distance (being driven by the SpringArm in the Blueprint) exceeds about 6500+ units all of the cast shadows seem to completely disappear or are not being rendered or registered. However, by just lowering the camera distance back down below 6000 units, they pop right back in. This can be seen in real-time while playing the game demo.

    Click image for larger version

Name:	cameraDistance_Shadows.jpg
Views:	1
Size:	268.8 KB
ID:	1134821

    Click image for larger version

Name:	cameraDistance_noShadows.jpg
Views:	1
Size:	268.3 KB
ID:	1134822

    Would love to hear any suggestions on how to make this work without having to have a closer camera distance.

    Thanks!

    EDIT - RESOLVED

    Some gathered notes that help me solved this problem (thanks everyone!):

    When using Stationary or Movable Lights on a movable mesh (not static) the shadow visibility of that movable mesh is dependent upon the size of the mesh and its distance from the camera.

    Command Line Values to Tweak:

    r.Shadow.FadeResolution - controls how big the light has to be on the screen before it *starts* to fade out.
    - Default Value: 64
    - Can lower this value to keep shadows from fading out at further distances

    r.Shadow.MinResolution - controls how big the light has to be on the screen before it *finishes* fading out, at which point it no longer has cost.
    - Default Value: 32
    - Lower values seem to increase shadow visibility.

    r.Shadow.TexelsPerPixel - Causes a higher resolution to be assigned and then it should fade out less aggressively
    - Default Value: 1.27324
    - Can increase this value to improve shadow rendering visibility & quality

    r.Shadow.RadiusThreshold
    - Default Value: 0.03
    - A lower value of 0.02 or 0.01 greatly increases shadow visibility at far camera distances (seems to have the most impact of all the console commands).

    Useful Link: https://docs.unrealengine.com/latest...nce/index.html
    Last edited by jwfitt; 05-31-2014, 04:34 PM. Reason: Resolved

    #2
    Just increase the max cascaded shadow distance on your directional light If I am right...the max supportet value on a movable light should be 20000 units...however you will sacrifice cascade resolution as well so its a trade off.
    Check out UNREAL 4 Lighting Academy
    https://forums.unrealengine.com/show...ng-like-that-)

    Comment


      #3
      Originally posted by Daedalus51 View Post
      Just increase the max cascaded shadow distance on your directional light If I am right...the max supportet value on a movable light should be 20000 units...however you will sacrifice cascade resolution as well so its a trade off.
      Appreciate the reply.

      I've tinkered with all of the cascaded shadow settings for the light (with the light set to both Movable and Stationary), and the results are always the same. Any shadows being cast from my movable character object (the ball) completely cease to be displayed once the camera distance passes 6900.

      Comment


        #4
        Then its probably tied to some ini size setting. That means the ball gets so small compared to what you see on screen over distance that even if the shadows would cover it, the ball just doesnt cast one anymore because its too small on screen. I would ask Epic if there is some ini tweak to tweak the object size to screen ratio for small stuff so it can still cast shadows. (if I remeber correctly we had that issue with the stationary light once in the office as well, one of our coders did something and after that it worked xD)
        Check out UNREAL 4 Lighting Academy
        https://forums.unrealengine.com/show...ng-like-that-)

        Comment


          #5
          Hmm, yeah hoping to get some official word on this as to whether or not it's just a limitation of camera distance or if there's a setting that can be adjusted.

          Comment


            #6
            If that's a stationary directional light, the movable object is using per-object shadows and they get faded out when small. The console variables controlling it are

            r.Shadow.FadeResolution - controls how big the light has to be on the screen before it *starts* to fade out.
            r.Shadow.MinResolution - controls how big the light has to be on the screen before it *finishes* fading out, at which point it no longer has cost.

            You can setup these console overrides for your game to whatever you want.

            Comment


              #7
              Thanks Daniel,

              I wasn't aware of all the shadow controls in the console commands.

              In one scene where the camera isn't too far those values do help bring some shadow visibility back. However, in my main project where the camera is a bit further (7000+ units on the SpringArm), no combination of values for those two variables seems to restore shadow visibility.

              Obviously, for now, we are bringing the camera in closer and pumping the camera's FOV back up, but I would really like to know if this is an engine limitation or if I'm just not approaching the problem properly (lighting isn't my strongest suit!).
              Last edited by jwfitt; 05-20-2014, 11:48 PM.

              Comment


                #8
                However, in my main project where the camera is a bit further (7000+ units on the SpringArm), no combination of values for those two variables seems to restore shadow visibility.
                Even when both of those settings are 1? Another one you can use is r.Shadow.TexelsPerPixel, to cause a higher resolution to be assigned and then it should fade out less aggressively.

                Comment


                  #9
                  Originally posted by DanielW View Post
                  Even when both of those settings are 1? Another one you can use is r.Shadow.TexelsPerPixel, to cause a higher resolution to be assigned and then it should fade out less aggressively.
                  Yeah, even at a value of 1. Could you, if you get some time, try opening something like the Rolling Blueprint project template and increasing the springarm distance on the ball blueprint to something really high, like 7000?

                  I've tinkered with the extreme values of pretty much everything I can think of at this point.

                  Comment


                    #10
                    Bumping.

                    I've seen a couple of other AnswerHub and Forum posts with similar issues.

                    It all seems to be related to size of object and distance of that object from the camera. If the camera distance is great enough the dynamic shadows just won't display.

                    Comment


                      #11
                      I have the same problem. For me, changing r.Shadow.RadiusThreshold=0.03 to 0.01 fix it.
                      ____________________________________________________________
                      https://twitter.com/Koola_UE4

                      Comment


                        #12
                        Originally posted by koola View Post
                        I have the same problem. For me, changing r.Shadow.RadiusThreshold=0.03 to 0.01 fix it.

                        Thanks!

                        It looks like the RadiusThreshold value change in conjunction with r.Shadow.TexelsPerPixel being set higher OR setting r.Shadow.FadeResolution to a lower value does the trick.

                        Comment


                          #13
                          Some gathered notes that help me solved this problem (thanks everyone!):

                          When using Stationary or Movable Lights on a movable mesh (not static) the shadow visibility of that movable mesh is dependent upon the size of the mesh and its distance from the camera.

                          Command Line Values to Tweak:

                          r.Shadow.FadeResolution - controls how big the light has to be on the screen before it *starts* to fade out.
                          - Default Value: 64
                          - Can lower this value to keep shadows from fading out at further distances

                          r.Shadow.MinResolution - controls how big the light has to be on the screen before it *finishes* fading out, at which point it no longer has cost.
                          - Default Value: 32
                          - Lower values seem to increase shadow visibility.

                          r.Shadow.TexelsPerPixel - Causes a higher resolution to be assigned and then it should fade out less aggressively
                          - Default Value: 1.27324
                          - Can increase this value to improve shadow rendering visibility & quality

                          r.Shadow.RadiusThreshold
                          - Default Value: 0.03
                          - A lower value of 0.02 or 0.01 greatly increases shadow visibility at far camera distances (seems to have the most impact of all the console commands).

                          Useful Link: https://docs.unrealengine.com/latest...nce/index.html
                          Last edited by jwfitt; 05-31-2014, 04:33 PM.

                          Comment


                            #14
                            Hi! How to keep these settings for the project?

                            Comment


                              #15
                              Hello everyone. Thanks for the advice, problem solved. Compilation is successful, it works in the finished project.

                              Comment

                              Working...
                              X