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

Performance problems with basic bloom and custom shader (Mac Build)

Discussion in 'General Graphics' started by leondelagarza, Mar 23, 2021.

  1. leondelagarza

    leondelagarza

    Joined:
    Aug 10, 2018
    Posts:
    3
    Hello!
    I need help with bloom.

    I'm having poor performance on the mac build of my game, and I've concluded it's because of Bloom. If I turn off the bloom effect, performance issues go away.

    I'm using unity's post processing stack v2 (version 3.0.3).

    Strangely, this game performs well on ios devices, (some android phones seem to heat up quite a bit) and I'm only having performance issues on the mac build. I'm using a custom shader in my project, and I don't know if this somehow could be affecting performance.

    Here's the shader code:
    Shader "Custom/MasterShader"
    {
    Properties
    {
    _AlbedoTex ("Albedo Map", 2D) = "white" {}
    _NormTex ("Normal Map", 2D) = "bump" {}
    _MetallicTex ("Metallic Map", 2D) = "white" {}
    _RoughnessTex ("Roughness Map", 2D) = "white" {}
    _EmissiveTex ("Emission Map", 2D) = "white" {}
    }
    SubShader
    {
    CGPROGRAM
    #pragma surface surf Standard fullforwardshadows
    #pragma target 3.0
    sampler2D _AlbedoTex;
    sampler2D _NormTex;
    sampler2D _MetallicTex;
    sampler2D _RoughnessTex;
    sampler2D _EmissiveTex;
    struct Input
    {
    float2 uv_AlbedoTex;
    float2 uv_NormTex;
    float2 uv_MetallicTex;
    float2 uv_RoughnessTex;
    float2 uv_EmissiveTex;
    float4 color : COLOR;
    //float3 worldRefl;
    };

    void surf (Input IN, inout SurfaceOutputStandard o)
    {
    // Albedo comes from vertex colors
    o.Albedo = tex2D (_AlbedoTex, IN.uv_AlbedoTex).rgb * IN.color.rgb;
    o.Normal = UnpackNormal(tex2D (_NormTex, IN.uv_NormTex));
    o.Metallic = tex2D (_MetallicTex, IN.uv_MetallicTex).r;
    o.Smoothness = 1 - tex2D (_RoughnessTex, IN.uv_RoughnessTex).r;
    o.Emission = (tex2D (_EmissiveTex, IN.uv_EmissiveTex).r * o.Albedo) * 1.5;
    }
    ENDCG
    }
    FallBack "Diffuse"
    }


    It's pretty basic.

    Here's the post process volume in my scene:


    Here's the post-process layer on the camera:


    I guess i'd like some help in figuring out why it's slow on the mac. It also isn't slow all the time, it becomes slow about 2-3 minutes into the game.

    Let me know if I need to provide more information.

    Thanks in advance.
     
    Last edited: Mar 23, 2021