Hi Unity folk, Does anyone know if there is reflective alpha-cutout shader somewhere available? I need to do growing puddles with reflective cube maps. I was thinking using the alpha cutout for this effect. Sadly I personally have little experience with shaders. Thanks, - J
Not tested, but here's a combination of Cutout/Diffuse and Reflect/Diffuse: Code (csharp): Shader "Transparent/Cutout/Reflective" { Properties { _Color ("Main Color", Color) = (1,1,1,1) _ReflectColor ("Reflection Color", Color) = (1,1,1,0.5) _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {} _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5 _Cube ("Reflection Cubemap", Cube) = "_Skybox" { TexGen CubeReflect } } SubShader { Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"} LOD 200 CGPROGRAM #pragma surface surf Lambert alphatest:_Cutoff sampler2D _MainTex; samplerCUBE _Cube; fixed4 _Color; fixed4 _ReflectColor; struct Input { float2 uv_MainTex; float3 worldRefl; }; void surf (Input IN, inout SurfaceOutput o) { fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); fixed4 c = tex * _Color; o.Albedo = c.rgb; o.Alpha = c.a; fixed4 reflcol = texCUBE (_Cube, IN.worldRefl); reflcol *= tex.a; o.Emission = reflcol.rgb * _ReflectColor.rgb; } ENDCG } Fallback "Transparent/Cutout/VertexLit" }
Wow! Thank you so much jvo3dc! It works and it looks gorgeous when I animate the alpha cutout with my baked enviroment map. This community is a ultimate win! : )