Search Unity

MirrorReflection4 (unifyCommunity) Shader - Version with bump/normal map

Discussion in 'Shaders' started by Zyntherius, Nov 30, 2015.

  1. Zyntherius

    Zyntherius

    Joined:
    Nov 3, 2012
    Posts:
    6
    Hello, I need the MirrorReflection4 shader from Unify with normal map (preferably with spec map) but i can't write HLSL/Shader.

    http://wiki.unity3d.com/index.php/MirrorReflection4

    Can anyone help me to enhance the mirror shader with those attributes?

    Thanks!


    Code (csharp):
    1.  
    2. Shader "FX/MirrorReflection"
    3. {
    4. Properties
    5. {
    6. _MainTex ("Base (RGB)", 2D) = "white" {}
    7. [HideInInspector] _ReflectionTex ("", 2D) = "white" {}
    8. }
    9. SubShader
    10. {
    11. Tags { "RenderType"="Opaque" }
    12. LOD 100
    13.  
    14. Pass {
    15. CGPROGRAM
    16. #pragma vertex vert
    17. #pragma fragment frag
    18. #include "UnityCG.cginc"
    19. struct v2f
    20. {
    21. float2 uv : TEXCOORD0;
    22. float4 refl : TEXCOORD1;
    23. float4 pos : SV_POSITION;
    24. };
    25. float4 _MainTex_ST;
    26. v2f vert(float4 pos : POSITION, float2 uv : TEXCOORD0)
    27. {
    28. v2f o;
    29. o.pos = mul (UNITY_MATRIX_MVP, pos);
    30. o.uv = TRANSFORM_TEX(uv, _MainTex);
    31. o.refl = ComputeScreenPos (o.pos);
    32. return o;
    33. }
    34. sampler2D _MainTex;
    35. sampler2D _ReflectionTex;
    36. fixed4 frag(v2f i) : SV_Target
    37. {
    38. fixed4 tex = tex2D(_MainTex, i.uv);
    39. fixed4 refl = tex2Dproj(_ReflectionTex, UNITY_PROJ_COORD(i.refl));
    40. return tex * refl;
    41. }
    42. ENDCG
    43. }
    44. }
    45. }
    46.  
     
    Last edited: Nov 30, 2015