Advertisement
Guest User

Untitled

a guest
May 4th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. Shader "Custom/liquid warp" {
  2. Properties {
  3. _MainTex ("Albedo (RGB)", 2D) = "white" {}
  4.  
  5. }
  6. SubShader {
  7. Tags { "RenderType"="Opaque" }
  8. LOD 200
  9.  
  10. CGPROGRAM
  11. // Physically based Standard lighting model, and enable shadows on all light types
  12. #pragma surface surf Standard fullforwardshadows
  13.  
  14. // Use shader model 3.0 target, to get nicer looking lighting
  15. #pragma target 3.0
  16.  
  17. sampler2D _MainTex;
  18.  
  19. struct Input {
  20. float2 uv_MainTex;
  21. float4 _Time;
  22. };
  23.  
  24. fixed4 _Color;
  25.  
  26.  
  27.  
  28. float warp( float a, float time )
  29. {
  30. float violence = 0.04;
  31. float levelOfExtreme = 6.0;
  32. float timeMod = time + a;
  33. return a + sin( timeMod * levelOfExtreme ) * violence;
  34.  
  35. //return a + sin(time + a) * violence;
  36. }
  37.  
  38. void surf (Input IN, inout SurfaceOutputStandard o) {
  39. float2 wuv = IN.uv_MainTex;
  40.  
  41. wuv.x = warp(wuv.x, _Time.y);
  42. wuv.y = warp(wuv.y, _Time.y);
  43.  
  44. // Albedo comes from a texture tinted by color
  45. fixed4 c = tex2D (_MainTex, wuv);
  46. o.Albedo = c.rgb;
  47. o.Alpha = c.a;
  48. }
  49. ENDCG
  50. }
  51. FallBack "Diffuse"
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement