Hello people, Here is a simple bloom effect, sort of faking it as cheap as possible. I would appreciate if anyone with ios or android capabilities to test it and tell me if it works on mobile platforms. By the way, you can get 34 more post process effects for your games in the AssetStore following this Forum Post. This is the effect file itself, save it as PP_BloomSimple.cs file. Code (csharp): using UnityEngine; [ExecuteInEditMode] [AddComponentMenu("Image Effects/Aubergine/BloomSimple")] public class PP_BloomSimple : MonoBehaviour { //Color public float strength = 0.5f; public Shader shader; private Material m_Material; //Properties protected Material material { get { if (m_Material == null) { m_Material = new Material(shader); m_Material.hideFlags = HideFlags.HideAndDontSave; } return m_Material; } } //Methods protected void Start () { // Disable if we don't support image effects if (!SystemInfo.supportsImageEffects) { enabled = false; return; } // Disable the image effect if the shader can't run on the users graphics card if (!shader || !shader.isSupported) enabled = false; } protected void OnDisable () { if( m_Material ) { DestroyImmediate(m_Material); } } void Awake () { material.SetFloat("_Strength", strength); } void OnEnable () { shader = Shader.Find("Hidden/Aubergine/BloomSimple"); } // Called by camera to apply image effect void OnRenderImage (RenderTexture source, RenderTexture destination) { material.SetFloat("_Strength", strength); Graphics.Blit (source, destination, material); } } This is the shader file. Code (csharp): Shader "Hidden/Aubergine/BloomSimple" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _Strength ("Bloom Strength", Float) = 0.5 } SubShader { Pass { ZTest Always Cull Off ZWrite Off Lighting Off Fog { Mode off } CGPROGRAM #pragma vertex vert_img #pragma fragment frag #pragma fragmentoption ARB_precision_hint_fastest #include "UnityCG.cginc" sampler2D _MainTex; float _Strength; float4 frag (v2f_img i) : COLOR { float4 col = tex2D(_MainTex, i.uv); float4 bloom = col; col.rgb = pow(bloom.rgb, _Strength); col.rgb *= bloom; col.rgb += bloom; return col; } ENDCG } } Fallback off }
hello, afaik, pow() per pixel quickly destroys performance on iOS. a lookup texture encoding the strength could probably help. "fixed4" instead of "float4" for all colors (which results to lowp vec4 in glsl) will speed up things as well.