Search Unity

Could the variants in Post Porcess Stack to be reduced?

Discussion in 'Image Effects' started by jayatubi, May 16, 2019.

  1. jayatubi

    jayatubi

    Joined:
    Dec 9, 2013
    Posts:
    143
    Hi,

    I just found the Uber shader within the Post Process Stack uses about 3.74k variants which cause an extreme long time to build the shader.

    I'm going to build a mobile game and I think lots of them would not be necessary. Could this variant count to be reduced?

    upload_2019-5-16_11-42-5.png
     
  2. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Yep, just get rid of some of the MULTI_COMPILE lines in the Uber shader and replace with #define's that you need:
    Code (CSharp):
    1.         #pragma multi_compile __ DISTORT
    2.         #pragma multi_compile __ CHROMATIC_ABERRATION CHROMATIC_ABERRATION_LOW
    3.         #pragma multi_compile __ BLOOM BLOOM_LOW
    4.         #pragma multi_compile __ VIGNETTE
    5.         #pragma multi_compile __ GRAIN
    6.         #pragma multi_compile __ FINALPASS
    IE. get rid of BLOOM, CHROMATIC_ABERRATION and you've just saved a bunch of variants.
     
  3. DankalApps

    DankalApps

    Joined:
    Mar 8, 2023
    Posts:
    17
    Found this file in `Packages/Post Processing/Post Processing/Shaders/Builtins` folder. I can edit it, but during build it gets reversed to its original contents.

    Maybe something has changed during those 4 years. How can I get rid of all those not used variants today (version 2021.3.20)?
     
  4. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,054
    Unless there is an override option for the shader in PlayerSettings somewhere, I can’t remember, but don’t think there is one, you’ll need to embed the package into the actual packages folder ( I’m assuming you’ve imported the package from PackageManager or asset store or GitHub ). See this page in the manual.

    once embedded you should be able to edit the shader without Unity restoring the contents.