Search Unity

Resolved What means the "Always draw dynamic" option in update shadows in lights?

Discussion in 'High Definition Render Pipeline' started by NewMagic-Studio, May 19, 2023.

  1. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    454
    Hi,
    Unity says that option makes ignore the update mode and renders shadows every frame, so what is the difference from just update mode to Always?
     
  2. cLick1338

    cLick1338

    Joined:
    Feb 23, 2017
    Posts:
    74
  3. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    454
    i read it but doesn't clarify anything, i already get dynamic objects render shadows without dynamic option. It says renders dynamic object shadows every frame but with ondemand just in moment the user request it, so it is not every frame, it is confusing. OnDemand is supposed just render it ondemand, just renders the shadow when the user request it, so don't undertand always render dynamic.
     
  4. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    703
    It as an option for cached shadows :
    When you use OnDemand + Alawyas render Dynamic, you will actually have two shadowmaps : one for static objects, updated on demand from you script, and one for dynamic objects updated every frame.
    They are then "combined" for the rendering, this allows to reduce the cost of shadowmap rendering, with the tradeof a requiring more memory.
     
    NewMagic-Studio likes this.
  5. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    454
    Ok thanks, what i don't understand is why i still see fps drop when i have shadows enabled on demand without the always render dynamic, shouldn't it be the same as having shadows disabled? as the shadows are already cached, i need to disable the light component or object or i still see fps drop
     
  6. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    703
    Isn't there any script that triggers the shadow update ?

    Else, depending on the settings and the number of lights in the scene, it could be caused by shadow resize in the atlas for example.
     
  7. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    454
    No, i have no other scripts changing it, i just have two spot lights and one directional, one spot light triggers shadows, and is the one which is ondemand, triggers RequestShadowMapRendering once per frame while a door is opening and then is not triggered anymore. In editor there is no fps drop but in the build i use vsync and drops frames from 90 to 45 in VR once i open the door, but doesn't happen in editor
    I have to disable light after opening door completely otherwise frames drop
     
  8. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    703
    And it doesn't happen in VR while in editor, only in a build ?
     
  9. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    454
    In build i see as frames pass from 90 to 45 cause vsync if i don't disable the light, in editor remains in 90fps. The problem of disabling it is that shows a very small change in lighting suddenly just for an instant that doesn't look well
     
  10. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    703
    What I tried to say is that it it also happens in the editor (afaik running VR in the editor should also VSync), you can easily profile to check what is happening.
    Or you can make a development build and profile it also.
     
  11. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    454
    Yes, i was making the same in other light and happened also in editor, in build must be that just drops fps for some reason, but i need to disable the hd additional light data or fps drop, that is the problem i want to solve
     
  12. NewMagic-Studio

    NewMagic-Studio

    Joined:
    Feb 25, 2015
    Posts:
    454
    I solved it disabling the shadows, didn't know i could update with shadows disabled in the light