Advertisement
CODE_BLUE

Untitled

Oct 7th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. Shader "Codeblue/GolfFabric" {
  2. Properties {
  3. _Color ("Color", Color) = (1,1,1,1)
  4. _NormalTex ("Noise Normal", 2D) = "bump" {}
  5. _NoiseScale("Noise Scale", Range(0,2)) = 0.0
  6. _NormalStrength("Normal Strength", Range(0,4)) = 0.0
  7. }
  8. SubShader {
  9. Tags { "RenderType"="Opaque" }
  10. LOD 200
  11.  
  12. CGPROGRAM
  13. // Physically based Standard lighting model, and enable shadows on all light types
  14. #pragma surface surf Standard fullforwardshadows
  15.  
  16. // Use shader model 3.0 target, to get nicer looking lighting
  17. #pragma target 3.0
  18.  
  19.  
  20. struct Input {
  21. float3 worldPos;
  22. };
  23.  
  24. float _NoiseScale;
  25. float _NormalStrength;
  26. float4 _Color;
  27. sampler2D _NoiseTex;
  28. sampler2D _NormalTex;
  29.  
  30. void surf (Input IN, inout SurfaceOutputStandard o) {
  31.  
  32. //Convert world space to texture space, based on scale
  33. float2 texturePos;
  34. texturePos.x = IN.worldPos.x * _NoiseScale;
  35. texturePos.y = IN.worldPos.z * _NoiseScale;
  36.  
  37. fixed4 noiseColor = tex2D (_NoiseTex, texturePos);
  38.  
  39. o.Albedo = _Color.rgb;
  40. float3 _normal = UnpackNormal(tex2D(_NormalTex, texturePos));
  41. _normal.z = _normal.z * (4 - _NormalStrength);
  42.  
  43. o.Normal = normalize(_normal);
  44. }
  45. ENDCG
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement