Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question m_PrefilteringModeAdditionalLight keeps changing between iOS and Android

Discussion in 'Universal Render Pipeline' started by luvcraft, Mar 1, 2024.

  1. luvcraft

    luvcraft

    Joined:
    Aug 22, 2011
    Posts:
    79
    I have a project that I'm building for both iOS and Android in Unity 2022.3.19 with URP 14.0.10

    When I build for iOS,
    m_PrefilteringModeAdditionalLight
    in my
    Universal Render Pipeline Asset.asset
    gets set to 3. When I build for Android, that gets set to 4. This doesn't seem to cause any problems with the build, but is annoying for source control.

    Is there a way to fix that? I've poked through my
    Universal Render Pipeline Asset.asset
    in the editor and don't see an exposed variable for
    m_PrefilteringModeAdditionalLight
    , and before I try to go poking through the source I thought I'd ask here.

    I have numerous projects that I build for both platforms, and I haven't noticed this behavior in any of the rest of them.
     
    eugeneloza likes this.
  2. larryPlayablStudios

    larryPlayablStudios

    Joined:
    May 15, 2018
    Posts:
    33
    I've been seeing the same behavior. Any luck finding the cause?
     
  3. fleity

    fleity

    Joined:
    Oct 13, 2015
    Posts:
    406
    This has troubled me without knowing about it for months now and this is the only thread that comes up when searching for the keyword (but with ForwardPlus keywords instead of additional lights).

    Based on what I read in URP documentation and the file where these are defined. Unity does try to figure out the tightest combination of shader keywords in order to reduce the necessary compiled shader variations.
    The difference between m_PrefilteringModeAdditionalLight 3 and 4 is:
    PrefilteringModeAdditionalLights.SelectPixel,
    PrefilteringModeAdditionalLights.SelectPixelAndOff (which includes per pixel shadows and the no shadows variant)

    So either this system has some faults and detects the actual used lights incorrectly OR in the urp assets you use for those plattforms you defined different shadow setting and/or you have scenes which use lights differently. The switch from 3 to 4 would be due to a scene containing an additional light with "No Shadows" selected.

    Is one of these cases a possibility?
     
    luvcraft likes this.
  4. luvcraft

    luvcraft

    Joined:
    Aug 22, 2011
    Posts:
    79
    So I tried messing with the soft shadow settings and turned on soft shadows, and now even more variables are changing between ios and Android!

    upload_2024-6-5_18-51-16.png

    On the same machine -- with no other changes to the project than switching build platform --
    m_PrefilteringModeAdditionalLight
    ,
    m_PrefilterSoftShadowsQualityMedium
    , and
    m_PrefilterSoftShadows
    all change. And note that
    m_PrefilterSoftShadowsQualityMedium
    and
    m_PrefilterSoftShadows
    swap their values; I suspect that they're the same variable but unintentionally serialized differently between Android and iOS.

    upload_2024-6-5_18-50-43.png