CalmWater - SingleSided.shader 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. Shader "CalmWater/Calm Water [Single Sided]"{
  2. Properties {
  3. _Color("Shallow Color",Color) = (1,1,1,1)
  4. _DepthColor("Depth Color",Color) = (0,0.5,0.5,1)
  5. _DepthStart("Depth Start",float) = 0
  6. _DepthEnd("Depth End",float) = 10
  7. [Toggle(_DEPTHFOG_ON)] _EnableFog ("Enable Depth Fog", Float) = 0
  8. _EdgeFade("Edge Fade",float) = 1
  9. //Scatter
  10. [Toggle(_SCATTER_ON)] _Scatter("Enable Scatter", Float) = 0
  11. _ScatterColor("Scatter Color", color) = (0,1,1,1)
  12. _ScatterParams("Scatter Parameters", vector) = (1,1,1,1)
  13. //Spec
  14. _SpecColor ("SpecularColor",Color) = (1,1,1,1)
  15. _Smoothness ("Smoothness",Range(0.1,2)) = 1
  16. //Second Spec
  17. _specFresnel("Fresnel", Range(0.1,4)) = 2
  18. _specIntensity("Intensity", float) = 1
  19. //Normal Map
  20. [KeywordEnum(Single,Dual,FlowMap)]
  21. _BumpMode("Bump Mode",Float) = 0
  22. _BumpMap("Micro Detail", 2D) = "bump" {}
  23. _BumpStrength ("Bump Strength",Range(0,1)) = 1
  24. _BumpMapLarge("Large Detail", 2D) = "bump" {}
  25. _BumpLargeStrength ("Bump Large Strength",Range(0,1)) = 1
  26. //FlowMap
  27. _FlowMap("FlowMap", 2D) = "grey"{}
  28. _FlowSpeed("Flow Speed", float) = 1
  29. _FlowIntensity ("FlowIntensity",float) = 1
  30. //Animation
  31. [Toggle(_WORLDSPACE_ON)] _WorldSpace ("World UV", Float) = 0
  32. _Speeds ("Speeds",vector) = (0.5,0.5,0.5,0.5)
  33. _SpeedsLarge ("Speeds Large",vector) = (0.5,0.5,0,0)
  34. //[Header(Distortion)]
  35. //Distortion
  36. _Distortion("Distortion", Range(0,100) ) = 50.0
  37. [KeywordEnum(High,Low)]
  38. _DistortionQuality("Distortion Quality",Float) = 0
  39. //[Header(Reflection)]
  40. //Reflection
  41. [KeywordEnum(None,Mixed,RealTime,CubeMap)]
  42. _ReflectionType("ReflectionType", Float) = 0
  43. _CubeColor("CubeMap Color [RGB] Intensity [A]",Color) = (1,1,1,1)
  44. [NoScaleOffset]
  45. _Cube("CubeMap", Cube) = "black" {}
  46. [NoScaleOffset]
  47. _ReflectionTex ("Internal reflection", 2D) = "white" {}
  48. _CubeDist("Cube Distortion",Range(0,1)) = 0.05
  49. _Reflection("Reflection", Range(0,1) ) = 1
  50. _RimPower("Fresnel Angle", Range(0,1) ) = 0.5
  51. _ReflectionNormals("Normals", Range(0,1)) = 1
  52. //[Header(Foam)]
  53. //Foam
  54. [Toggle(_FOAM_ON)] _FOAM ("Enable Foam", Float) = 0
  55. _FoamColor("FoamColor",Color) = (1,1,1,1)
  56. _FoamTex("Foam Texture", 2D) = "white" {}
  57. _FoamSize("Fade Size",float) = 0.5
  58. [Toggle(_WHITECAPS_ON)] _WhiteCaps ("Enable White Caps", Float) = 0
  59. _CapsIntensity("Intensity",Range(0,4)) = 1
  60. _CapsMask("Mask",2D) = "white" {}
  61. _CapsSpeed("Speed",float) = 1
  62. _CapsSize("Size",float) = 1
  63. // Caustics
  64. [Toggle(_CAUSTICS_ON)] _Caustics("Enable Caustics", Float) = 0
  65. _CausticsTex("Caustics Texture", 2D) = "black" {}
  66. _CausticsIntensity("Intensity", float) = 4
  67. _CausticsStart("Start", float) = 0
  68. _CausticsEnd("End", float) = 10
  69. _CausticsSpeed("Speed", float) = 1
  70. //[Header(Displacement)]
  71. //Displacement
  72. [KeywordEnum(Off,Wave,Gerstner,Texture)]
  73. _DisplacementMode("Mode", Float) = 0
  74. //WaveMode
  75. _Amplitude("Amplitude", float) = 0.05
  76. _Frequency("Frequency",float) = 1
  77. _Speed("Wave Speed", float) = 1
  78. //GerstnerMode
  79. _Steepness ("Wave Steepness",float) = 1
  80. _WSpeed ("Wave Speed", Vector) = (1.2, 1.375, 1.1, 1.5)
  81. _WDirectionAB ("Wave1 Direction", Vector) = (0.3 ,0.85, 0.85, 0.25)
  82. _WDirectionCD ("Wave2 Direction", Vector) = (0.1 ,0.9, 0.5, 0.5)
  83. //Texture Mode
  84. _DisplacementTex("Displacement Texture", 2D) = "black" {}
  85. _DisplacementSpeed("Speed Params", vector) = (1,1,1,1)
  86. //Normal Smoothing
  87. _Smoothing("Smoothing",range(0,1)) = 1
  88. }
  89. Category {
  90. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Opaque" "PreviewType"="Sphere" }
  91. ZWrite On
  92. SubShader {
  93. GrabPass
  94. {
  95. "_GrabTexture"
  96. Name "BASE"
  97. Tags {
  98. "LightMode" = "Always"
  99. }
  100. }
  101. Pass {
  102. Tags {"LightMode" = "ForwardBase"}
  103. Name "FORWARD"
  104. Cull Back
  105. CGPROGRAM
  106. #pragma vertex vert
  107. #pragma fragment frag
  108. #pragma multi_compile_fwdbase
  109. #pragma multi_compile_fog
  110. #pragma fragmentoption ARB_precision_hint_fastest
  111. #pragma target 3.0
  112. #ifndef UNITY_PASS_FORWARDBASE
  113. #define UNITY_PASS_FORWARDBASE
  114. #endif
  115. #include "UnityCG.cginc"
  116. #include "AutoLight.cginc"
  117. #include "Includes/CalmWater.cginc"
  118. #pragma shader_feature _ _BUMPMODE_SINGLE _BUMPMODE_DUAL _BUMPMODE_FLOWMAP
  119. #pragma shader_feature _REFLECTIONTYPE_MIXED _REFLECTIONTYPE_CUBEMAP _REFLECTIONTYPE_REALTIME
  120. #pragma shader_feature _DISTORTIONQUALITY_HIGH
  121. #pragma shader_feature _ _FOAM_ON
  122. #pragma shader_feature _ _CAUSTICS_ON
  123. #pragma shader_feature _ _WHITECAPS_ON
  124. #pragma shader_feature _ _SCATTER_ON
  125. #pragma shader_feature _ _DEPTHFOG_ON
  126. #pragma shader_feature _ _DISPLACEMENTMODE_WAVE _DISPLACEMENTMODE_GERSTNER _DISPLACEMENTMODE_TEXTURE
  127. #pragma shader_feature _ _WORLDSPACE_ON
  128. ENDCG
  129. }
  130. Pass {
  131. Tags {"LightMode" = "ForwardAdd"}
  132. Name "FORWARDADD"
  133. Blend One One
  134. Cull Back
  135. CGPROGRAM
  136. #pragma vertex vert
  137. #pragma fragment frag
  138. #pragma multi_compile_fwdadd_fullshadows
  139. #pragma fragmentoption ARB_precision_hint_fastest
  140. #pragma target 3.0
  141. #ifndef UNITY_PASS_FORWARDADD
  142. #define UNITY_PASS_FORWARDADD
  143. #endif
  144. #include "UnityCG.cginc"
  145. #include "AutoLight.cginc"
  146. #include "Includes/CalmWater.cginc"
  147. #pragma shader_feature _ _BUMPMODE_SINGLE _BUMPMODE_DUAL _BUMPMODE_FLOWMAP
  148. #pragma shader_feature _REFLECTIONTYPE_MIXED _REFLECTIONTYPE_CUBEMAP _REFLECTIONTYPE_REALTIME
  149. #pragma shader_feature _DISTORTIONQUALITY_HIGH
  150. #pragma shader_feature _ _FOAM_ON
  151. #pragma shader_feature _ _DEPTHFOG_ON
  152. #pragma shader_feature _ _DISPLACEMENTMODE_WAVE _DISPLACEMENTMODE_GERSTNER _DISPLACEMENTMODE_TEXTURE
  153. #pragma shader_feature _ _WORLDSPACE_ON
  154. ENDCG
  155. }
  156. }
  157. }
  158. CustomEditor "CalmWaterInspector"
  159. FallBack Off
  160. }