Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Custom/Water" {
- Properties {
- _MainTex ("Water Texture", 2D) = "white" {}
- _BumpMap ("Normal Map", 2D) = "bump" {}
- _ReflectionTex ("Reflection Texture", 2D) = "white" {}
- _RefractionTex ("Refraction Texture", 2D) = "white" {}
- _WaterColor ("Water Color", Color) = (0.1, 0.3, 0.5, 1.0)
- _Specular ("Specular", Range(0, 1)) = 0.5
- _Shininess ("Shininess", Range(0, 1)) = 0.07
- _WaveSpeed ("Wave Speed", Range(0, 10)) = 1
- _WaveSize ("Wave Size", Range(0, 1)) = 0.03
- }
- SubShader {
- Tags {"Queue"="Transparent"}
- LOD 200
- CGPROGRAM
- #pragma surface surf Lambert
- sampler2D _MainTex;
- sampler2D _BumpMap;
- sampler2D _ReflectionTex;
- sampler2D _RefractionTex;
- fixed4 _WaterColor;
- float _Specular;
- float _Shininess;
- float _WaveSpeed;
- float _WaveSize;
- struct Input {
- float2 uv_MainTex;
- float2 uv_BumpMap;
- float3 viewDir;
- };
- void surf (Input IN, inout SurfaceOutput o) {
- fixed4 tex = tex2D (_MainTex, IN.uv_MainTex);
- o.Albedo = tex.rgb * _WaterColor.rgb;
- o.Alpha = tex.a;
- o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
- o.Specular = _Specular;
- o.Gloss = _Shininess;
- o.Emission = tex.rgb * _WaterColor.rgb;
- o.Reflection = texCUBE(_ReflectionTex, IN.viewDir).rgb;
- o.Refraction = texCUBE(_RefractionTex, IN.viewDir).rgb;
- }
- ENDCG
- }
- FallBack "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment