Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.6 KiB

  1. /************************************************************************************
  2. Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
  3. See SampleFramework license.txt for license terms. Unless required by applicable law
  4. or agreed to in writing, the sample code is provided “AS IS” WITHOUT WARRANTIES OR
  5. CONDITIONS OF ANY KIND, either express or implied. See the license for specific
  6. language governing permissions and limitations under the license.
  7. ************************************************************************************/
  8. Shader "Oculus Sample/Button Glow" {
  9. Properties{
  10. _ColorMask("Texture", 2D) = "white" {}
  11. _Color("Color", Color) = (0.5, 0.5, 0.5, 0.5)
  12. }
  13. SubShader {
  14. Tags{"Queue" = "Transparent" "RenderType" = "Transparent"
  15. "IgnoreProjector" = "True" "PreviewType" = "Plane"}
  16. LOD 100 Blend SrcAlpha OneMinusSrcAlpha Cull Off Lighting Off ZWrite Off
  17. Pass {
  18. CGPROGRAM
  19. #pragma vertex vert
  20. #pragma fragment frag
  21. #include "UnityCG.cginc"
  22. struct appdata {
  23. float4 vertex : POSITION;
  24. float2 uv : TEXCOORD0;
  25. };
  26. struct v2f {
  27. float2 uv : TEXCOORD0;
  28. float4 vertex : SV_POSITION;
  29. };
  30. sampler2D _ColorMask;
  31. float4 _ColorMask_ST;
  32. fixed4 _Color;
  33. v2f vert(appdata v) {
  34. v2f o;
  35. o.vertex = UnityObjectToClipPos(v.vertex);
  36. o.uv = TRANSFORM_TEX(v.uv, _ColorMask);
  37. return o;
  38. }
  39. fixed4 frag(v2f i) : SV_Target {
  40. fixed4 colMask = tex2D(_ColorMask, i.uv);
  41. return fixed4(_Color.rgb, colMask.r * 1.0);
  42. }
  43. ENDCG
  44. }
  45. }
  46. }