Announcement

Collapse
No announcement yet.

Shadows is too expensive.

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

    Shadows is too expensive.

    Hi all!

    One question about shadows. I have one directional light in my scene, and it is configured as "stationary". I have many objects, that can cast shadows. Scene is look like this:



    GPU Profiler shows that a lot of time spent in the shadow casting. Every object take 0.1-0.2 ms for casting shadow.



    Is it normal situation? Is there way to optimize shadow casting? I repeat I have only one light source. By the way, I have disabled Preshadows. Don't understand what is this, but it takes too many time too

    Hope for your help!
    [GAME] The Unexpected Quest | [TOOL] Localization UE4

    #2
    Questions: Is this for sunlight? Does the sun move during gameplay? One idea is to include the shadow as a part of the game piece, with a pre-baked, translucent shadow on an alpha-textured "******-like" base around the bottom of the model. One drawback would be this would not cast shadows on neighboring pieces, though if the sunlight were in a more "high-noon" position, this would become less of an issue...

    Comment


      #3
      Originally posted by Jianju View Post
      Questions: Is this for sunlight? Does the sun move during gameplay? One idea is to include the shadow as a part of the game piece, with a pre-baked, translucent shadow on an alpha-textured "******-like" base around the bottom of the model. One drawback would be this would not cast shadows on neighboring pieces, though if the sunlight were in a more "high-noon" position, this would become less of an issue...
      Why would the word, "******" be censored?? Okay, clearly this means something else to someone in charge here, so I'll post a picture of what I'm referring to:
      Click image for larger version

Name:	Weld-Neck-Flange.jpg
Views:	1
Size:	73.5 KB
ID:	1081509

      Btw, "Pre-Shadows" refers, I believe, to the process of computing shadows ahead of time & baking them into the textures, which is usually only helpful for environments. It's much akin to what I'm suggesting. So, to expand, here's some tips about how to implement what I suggest:

      In your model viewer, position the model as though you're looking down on it from the direction of the sun. (Tip: Do this using repeatable keyboard commands for the sake of consistency!) Turn off the material, & dhow the model with flat shading, (white on black, for example.) Take a screen-shot, & bring it into GIMP or Photoshop. Edit this image into your texture map for the model's material, being sure to include it as the alpha-channel.

      Next, add a flat square faces around the bottom of your model, sitting just above the ground. Add the texture you just created to this square.

      That's the basic idea. Instead of computing these shadows every frame, you've got a pre-baked shadow for that piece all ready to go.

      If any of this isn't clear, just ask.
      Last edited by Jianju; 07-10-2015, 01:14 PM.

      Comment


        #4
        Originally posted by Jianju View Post
        Questions: Is this for sunlight? Does the sun move during gameplay? One idea is to include the shadow as a part of the game piece, with a pre-baked, translucent shadow on an alpha-textured "******-like" base around the bottom of the model. One drawback would be this would not cast shadows on neighboring pieces, though if the sunlight were in a more "high-noon" position, this would become less of an issue...
        Thanks for answer! But yes, sun can move. It is static only on level, but between levels direction can change. For example, one level is sunny day, next level is cloudy evening. So I can't use prerender shadows. I can use prerender decal shadows only for characters

        Is there way to change shadow's technics? Or disable receiving shadows for some objects? Or I do something wrong? Just I look on StarCraft 2, and there are hundreds objects and they all cast dynamic shadows and all looks fine and fast.
        [GAME] The Unexpected Quest | [TOOL] Localization UE4

        Comment


          #5
          By the way. There is great difference between on/off shadows. But no difference between shadows quality. And this is strange too.

          r.ShadowQuality 0


          r.ShadowQuality 1


          r.ShadowQuality 3
          [GAME] The Unexpected Quest | [TOOL] Localization UE4

          Comment


            #6
            Originally posted by Jianju View Post
            Why would the word, "******" be censored?? Okay, clearly this means something else to someone in charge here, so I'll post a picture of what I'm referring to:
            Weird... No idea what the word is since when I try to view it, it won't show me. Can you PM me the word and I'll bring it up with Epic Staff so somebody can look into it? Just separate the letters if you have to.

            Comment


              #7
              Have you thought about using Static lighting and then faking the shadows for each moveable mesh (As it seems you have a lot of moving parts in your scene)?
              KITATUS
              "Information shouldn't be behind a paywall, It should be free for all!"

              Comment


                #8
                Use a movable directional light with cascaded shadow maps. That way it only renders one shadow map (or few, depending on the number of cascades) which in turn means you don't get the overhead of per object shadows as you see in your GPU profiler.

                Comment


                  #9
                  Originally posted by KitatusStudios View Post
                  Have you thought about using Static lighting and then faking the shadows for each moveable mesh (As it seems you have a lot of moving parts in your scene)?
                  Thanks for the advice, but I think this is bad solution. Since I have some big movable objects (like an old windmill), and fake shadows will be too expensive to implement.
                  [GAME] The Unexpected Quest | [TOOL] Localization UE4

                  Comment


                    #10
                    Originally posted by jonimake View Post
                    Use a movable directional light with cascaded shadow maps. That way it only renders one shadow map (or few, depending on the number of cascades) which in turn means you don't get the overhead of per object shadows as you see in your GPU profiler.
                    Big thanks for the great solution! I made some test. And they are very encouraging. On the test scene got a 10 fps increase.

                    "Dynamic Shadow Distance MovableLight" set to 5000.


                    "Dynamic Shadow Distance MovableLight" set to 20000.


                    Perhaps some light settings can increase FPS much more.
                    [GAME] The Unexpected Quest | [TOOL] Localization UE4

                    Comment


                      #11
                      Originally posted by mdeni View Post
                      Thanks for the advice, but I think this is bad solution. Since I have some big movable objects (like an old windmill), and fake shadows will be too expensive to implement.
                      A translucent plane would cost nothing compared to dynamic lights :>
                      KITATUS
                      "Information shouldn't be behind a paywall, It should be free for all!"

                      Comment


                        #12
                        Originally posted by mdeni View Post
                        Big thanks for the great solution! I made some test. And they are very encouraging. On the test scene got a 10 fps increase.

                        "Dynamic Shadow Distance MovableLight" set to 5000.


                        "Dynamic Shadow Distance MovableLight" set to 20000.


                        Perhaps some light settings can increase FPS much more.
                        Try setting the cascade count to 1 to see if it helps resolution. Since you have a top down camera it doesn't make any sense to use cascaded shadow maps that vary the cascade resolution based on scene depth. If the camera is far enough away, using the most high-res cascade for basically nothing.

                        Comment


                          #13
                          I've taken "Flange" out of the censored words filter. It was in there by default (we made our list with a lot of pre-built stuff) and it is considered an insult in some places. It's unfortunate that there is not an "intent" or "context" filter for so many of these common words that are also used as insults.
                          Twitch /unrealalexander| Twitter @UnrealAlexander
                          How to report a bug? | Installation & Setup issues?
                          Call me to a thread by posting this: [MENTION]Alexander Paschall[/MENTION]

                          Comment


                            #14
                            Originally posted by TheJamsh View Post
                            Weird... No idea what the word is since when I try to view it, it won't show me. Can you PM me the word and I'll bring it up with Epic Staff so somebody can look into it? Just separate the letters if you have to.
                            I know why, it is a rude colloquial/slang term in some parts of the UK and Vbulletin has/had 2 major coders from the UK so the base rude word filter may include it.
                            Last edited by Ghiest; 07-13-2015, 10:14 AM.

                            Comment


                              #15
                              Lol about the flange, here ppl are using the word shoe to insult each other - so please add it to the filter ))))

                              Comment

                              Working...
                              X