amiga.template 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. Shader "BabylonJS/NewShaderProgram" {
  2. Properties {
  3. _Color ("Color", Color) = (1,1,1,1)
  4. [NoScaleOffset] _MainTex ("Albedo (RGB)", 2D) = "white" {}
  5. _Glossiness ("Smoothness", Range(0,1)) = 0.5
  6. _Metallic ("Metallic", Range(0,1)) = 0.0
  7. _ScaleX ("Scale Factor X", Range (0.0, 10.0)) = 1.0
  8. _ScaleY ("Scale Factor Y", Range (0.0, 10.0)) = 1.0
  9. }
  10. SubShader {
  11. Tags { "RenderType"="Opaque" }
  12. LOD 200
  13. CGPROGRAM
  14. //////////////////////////////////////////////////////////
  15. // BABYLON WEBGL RUNTIME SHADER PROGRAM SECTIONS (GLSL) //
  16. //////////////////////////////////////////////////////////
  17. #ifdef BABYLON
  18. attributes: ["position", "normal", "uv"]
  19. uniforms: ["worldViewProjection, _Color, _Glossiness, _Metallic, _ScaleX, _ScaleY"]
  20. samplers: []
  21. defines: []
  22. #endif //BABYLON-END
  23. #ifdef VERTEX
  24. attribute vec3 position;
  25. attribute vec3 normal;
  26. attribute vec2 uv;
  27. uniform mat4 worldViewProjection;
  28. precision highp float;
  29. varying vec2 vUV;
  30. void main(void)
  31. {
  32. gl_Position = worldViewProjection * vec4(position, 1.0);
  33. vUV = uv;
  34. }
  35. #endif //VERTEX-END
  36. #ifdef FRAGMENT
  37. precision highp float;
  38. varying vec2 vUV;
  39. uniform vec4 _Color;
  40. uniform float _Glossiness;
  41. uniform float _Metallic;
  42. uniform float _ScaleX;
  43. uniform float _ScaleY;
  44. uniform sampler2D _MainTex;
  45. void main(void)
  46. {
  47. gl_FragColor = texture2D(_MainTex, vec2(vUV.x * _ScaleX, vUV.y * _ScaleY)) * _Color;
  48. }
  49. #endif //FRAGMENT-END
  50. ////////////////////////////////////////////////////////
  51. // DEFAULT UNITY EDITOR SHADER PROGRAM SECTION (HLSL) //
  52. ////////////////////////////////////////////////////////
  53. #pragma exclude_renderers d3d11 xbox360 gles
  54. #pragma surface surf Standard fullforwardshadows
  55. #pragma target 3.0
  56. sampler2D _MainTex;
  57. struct Input {
  58. float2 uv_MainTex;
  59. };
  60. half _Glossiness;
  61. half _Metallic;
  62. half _ScaleX;
  63. half _ScaleY;
  64. fixed4 _Color;
  65. void surf (Input IN, inout SurfaceOutputStandard o) {
  66. // Albedo comes from a texture tinted by color
  67. float2 vUV = IN.uv_MainTex;
  68. fixed4 c = tex2D (_MainTex, float2(vUV.x * _ScaleX, vUV.y * _ScaleY)) * _Color;
  69. o.Albedo = c.rgb;
  70. // Metallic and smoothness come from slider variables
  71. o.Metallic = _Metallic;
  72. o.Smoothness = _Glossiness;
  73. o.Alpha = c.a;
  74. }
  75. ENDCG
  76. }
  77. FallBack "Diffuse"
  78. }