Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Shadows.RenderShadowmap in GPU profile, what does that mean?

Discussion in 'Editor & General Support' started by VipHaLongPro, May 18, 2015.

  1. VipHaLongPro

    VipHaLongPro

    Joined:
    Mar 8, 2015
    Posts:
    49
    Using Lightmap is not suitable for my game. The whole scene is sunny and there are just some trees. They need to have dynamic (or realtime) shadow because I need their shadow to cast on runtime-generated enemies. Also using Lightmap does not improve the performance much so I decided not to use Lightmap.

    However when viewing the GPU profile I saw the call Shadows.RenderShadowmap. I'm not sure if this call is related to Lightmap? If so it must be something strange here because I don't use Lightmap at all.

    I hope someone could explain this to me because goolging did not give me any info about this. Thank you for your help.
     
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Sounds like the runtime is rendering shadows for you into a texture (shadow map) so the shadows can be rendered onto objects.
     
    VipHaLongPro likes this.
  3. VipHaLongPro

    VipHaLongPro

    Joined:
    Mar 8, 2015
    Posts:
    49
    So it's just part of realtime shadow? Looks like shadowing is too far expensive from what I thought. Because beside the so-called RenderForwardOpaque.CollectShadows which consumes about 45% GPU time, the Shadows.RenderShadowmap sometimes can consume up to 30% GPU time. So almost time for shadowing, rendering meshes is just trivial compared to that. Thank you.
     
  4. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Well, how much stuff is being rendered into the shadow map? Maybe rendering trees into the shadow map takes time? If you turn off the shadows, so Unity doesn't have to render them, does the game get up to an acceptable frame rate? If so, it might be worth turning all the trees and stuff off, and then turn them on one at a time and see how that affects performance. If this shows that the shadow rendering is taking time, if might be worth faking the shadows, or using low res tree models for the shadows. (Can't think exactly how you'd do this, but I guess step one is to work out what's taking the time.)
     
    gdp2 likes this.
  5. VipHaLongPro

    VipHaLongPro

    Joined:
    Mar 8, 2015
    Posts:
    49
    I don't think there is much stuff here, I just zoom camera in a tree's shadow casting on an area of grasses (which is fairly dense, but it should be so to create the scene I want - the terrain size is just about 200x200). The framerate varies depending how close the camera is to the shadow area. At a close distance, it can be just 45-50 while at far distance, it jumps to more than 70.

    Some screenshots:

    Near view (scene + the corresponding profile):




    Far view (scene + the corresponding profile):




    At the near view the shadowing consumes more GPU's time (it's obviously that there is more shadow at near view).

    Also if the screen size is small (such as not toggle the Maximize on Play in GameView), the framerate is better.
     
  6. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Maybe when you are close up Unity is rendering the shadows over each of the grass meshes. When the camera is further away, perhaps the grass is rendered as meshes that contain clumps of grass, so there is much fewer triangles to render. (I'm not an expert.)
     
  7. VipHaLongPro

    VipHaLongPro

    Joined:
    Mar 8, 2015
    Posts:
    49
    In fact that's what I thought too. I'm just surprised that it cannot handle a simple scene (as you can see from screenshots) with normal framerate. Of course the profile shows the problem of shadowing. I can have only choice of reducing grasses or using simple meshes of trees for shadowing (as you suggested). I'll try experimenting it more myself. Thank you.