Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question EDIT: Rotating directional light causes massive "other" spikes - HDRP Forward Only

Discussion in 'General Graphics' started by Ne0mega, Jul 27, 2021.

  1. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    745
    I cannot use any sort of baked lighting, so everything is realtime.
    HDRP with one directional light
    I figured, since my shadows are realtime render, per frame, might as well make them move with a day cycle.

    EDIT: the garbage collector and Other use similar colors on the profiler... it was "other", and it appears to be the fault of "editor loop". So I am thinking maybe build and try profiler outside editor. Ive actually never built this project LoL.


    So I made little script that makes the sun rotate over the course of a day.
    Much to my surprise, framerate drops 20 - 40. Garbage collector going crazy.
    I do the same with sun color, not nearly as bad.
    I turn off shadowmapping, not much difference.

    I love the effect, though.
    I thought I already was paying the penalty for real time shadows by using realtime shadows.
    Is there some sort of mechanism in Unity or HDRP that recognizes no light rotation, and therefore optimizes and reuses a shadow draw?
    If that's the case... ..how are my tree shadows swaying in the wind along with the trees?


    The shadowmap has to be re-written every frame anyway, so why would changing the angles of the light cause a garbage freak out?

    This shadows are drawing over a 512 x 512 mesh
     
    Last edited: Jul 28, 2021
  2. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Yes, I have been trying to solve this issue for awhile now, with no success. Moving a directional light through the sky in HDRP causes a massive performance hit for some reason. I'm not sure why this is the case yet.

    I found out that turning down the Reflection Cubemap Size and the Planar Reflection Atlas Size in the HDRP settings helps quite a bit, but it still doesn't eliminate it altogether. And for some reason you can only turn these settings down so far.......like 128 or 64, not sure why they're not allowed to go lower.
     
    Ne0mega likes this.