SHARE
TWEET

Untitled

a guest May 19th, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Debug/Espejo"
  2.  
  3. {
  4.     Properties
  5.     {
  6.         _MainTex ("", 2D) = "white" {}
  7.         _colorBase ("color Base", Color) = (1,1,1,1)
  8.         _colorEspejo ("color Espejo", Color) = (1,1,1,1)
  9.  
  10.         [HideInInspector] _ReflectionTex ("", 2D) = "white" {}
  11.     }
  12.     SubShader
  13.     {
  14.         Tags { "RenderType"="Opaque" }
  15.         LOD 100
  16.  
  17.         Pass {
  18.             CGPROGRAM
  19.             #pragma vertex vert
  20.             #pragma fragment frag
  21.             #include "UnityCG.cginc"
  22.  
  23.             struct v2f
  24.             {
  25.                 float2 uv : TEXCOORD0;
  26.                 float4 espejo : TEXCOORD1;
  27.                 float4 pos : SV_POSITION;
  28.             };
  29.  
  30.             float4 _MainTex_ST;
  31.             fixed4 _colorBase;
  32.             fixed4 _colorEspejo;
  33.  
  34.             v2f vert(float4 pos : POSITION, float2 uv : TEXCOORD0)
  35.             {
  36.                 v2f o;
  37.                 o.pos = UnityObjectToClipPos (pos);
  38.                 o.uv = TRANSFORM_TEX(uv, _MainTex);
  39.                 o.espejo = ComputeScreenPos (o.pos);
  40.                 return o;
  41.             }
  42.  
  43.             sampler2D _MainTex;
  44.             sampler2D _ReflectionTex;
  45.  
  46.             fixed4 frag(v2f i) : SV_Target
  47.             {
  48.                 return (tex2D(_MainTex, i.uv) * _colorBase * _colorBase.a) + (tex2Dproj(_ReflectionTex, UNITY_PROJ_COORD(i.espejo)) * _colorEspejo * _colorEspejo.a);
  49.             }
  50.  
  51.             ENDCG
  52.         }
  53.     }
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top