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. Dismiss Notice

Bug QualitySettings.shadows doesn't work ?

Discussion in 'High Definition Render Pipeline' started by pablobandinopla, Jun 23, 2023.

  1. pablobandinopla

    pablobandinopla

    Joined:
    Jul 2, 2021
    Posts:
    97
    Code (CSharp):
    1. QualitySettings.shadows = ShadowQuality.Disable
    calling that doesn't do anything at least not in my HDRP proyect... em i missing something?
    How can i disable all shadows vía code at runtime?

    I'm using Unity 2022.3
     
  2. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    629
    HDRP has a more granular control over shadows.
    For you need, you can disable the shadow in the frame settings of the current camera, or the default camera frame settings, using this API and the matching shadows fields.
     
  3. pablobandinopla

    pablobandinopla

    Joined:
    Jul 2, 2021
    Posts:
    97
    excuse my ignorance, fine gentlemen, but how may i apply the given information? My monkey brain typed Camera.main. and nothing relevant was suggested for autocompletion... I was, mabe naively, expecting something in the shape of Camera.main.frameSettings.SetEnabled or similar... do i need to modify an asset instead? mabe the DefaultHDRPAsset.asset ?
     
  4. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    242
    Code (CSharp):
    1. HDCamera hdCam = HDCamera.GetOrCreate(Camera.main);
    2. hdCam.frameSettings.xxxxxx
    3.  
     
    pablobandinopla likes this.
  5. pablobandinopla

    pablobandinopla

    Joined:
    Jul 2, 2021
    Posts:
    97
    Thanks! But for some reason this code didn't do nothing:

    Code (CSharp):
    1.         HDCamera hdCam = HDCamera.GetOrCreate(Camera.main);
    2.  
    3.         hdCam.frameSettings.SetEnabled(FrameSettingsField.ShadowMaps, false);
    But this one did:
    Code (CSharp):
    1.         HDAdditionalCameraData hdCameraData = Camera.main.GetComponent<HDAdditionalCameraData>();
    2.  
    3.         hdCameraData.renderingPathCustomFrameSettingsOverrideMask.mask[(int)FrameSettingsField.ShadowMaps] = true;
    4.  
    5.         hdCameraData.renderingPathCustomFrameSettings.SetEnabled(FrameSettingsField.ShadowMaps, false);
    any idea why the HDCam example you provided didn't had this "mask" setting thing?