Shader "Unlit/NewUnlitShader" { Properties { _MainTex ("Texture", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } LOD 100 Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag // make fog work #pragma multi_compile_fog #include "UnityCG.cginc" struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; }; struct v2f { float2 uv : TEXCOORD0; UNITY_FOG_COORDS(1) float4 vertex : SV_POSITION; }; sampler2D _MainTex; float4 _MainTex_ST; v2f vert (appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); UNITY_TRANSFER_FOG(o,o.vertex); return o; } fixed4 blur(float2 uv, sampler2D tex, float blurAmount, int iterations) { fixed4 color = tex2D(tex, uv); fixed2 offsets[4] = { float2(-blurAmount, 0), float2(blurAmount, 0), float2(0, -blurAmount), float2(0, blurAmount) }; for (int iter = 0; iter < iterations; iter++) { for (int i = 0; i < 4; i++) { color += tex2D(tex, uv + offsets[i] * (iter + 1)); } } return color / (1.0 + 4.0 * iterations); } fixed luminance(fixed4 color) { return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b; } fixed4 bloom(fixed4 col, float threshold, float intensity) { // fixed4 col = tex2D(tex, uv); fixed lum = luminance(col); fixed val = clamp(lum - threshold, 0.0, 1.0); return col * (val * intensity); // Apply bloom effect by multiplying color with intensity // } } float2 fisheyeWarp(float2 uv, float strength) { float2 center = float2(0.5, 0.5); float2 delta = uv - center; float dist = length(delta); float theta = atan2(delta.y, delta.x); float warpedDist = pow(dist, strength); float2 warpedDelta = float2(cos(theta), sin(theta)) * warpedDist; return center + warpedDelta; } fixed4 frag (v2f i) : SV_Target { // sample the texture v2f o; o.uv = fisheyeWarp(i.uv, 1.1); // Apply fisheye warp effect fixed4 col_raw = tex2D(_MainTex, o.uv); fixed4 col_blur = blur(o.uv, _MainTex, 0.01, 2); // Apply blur with a small amount fixed4 col_bloom = bloom(col_blur, 0.25, 5.0); // Apply bloom with threshold and intensity fixed4 col = col_raw+col_blur * col_bloom; // Combine raw color with blurred and bloom effects // apply fog UNITY_APPLY_FOG(i.fogCoord, col); return col; } ENDCG } } }