BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / Oculus / VR / Resources / Underlay Impostor.shader

Underlay Impostor.shader

Project Import
timfa Tim Falken · pushed by timfa · 6 years ago
b77834a1 History
Underlay Impostor.shader 1.7 KiB Download Raw
1/*
2This shader is used to render the impostor while clearing out the alpha of the eye buffer
3The important details here are:
4- the use of the Geometry+1 queue to make sure the impostor is drawn after all other opaque objects but before alpha
5- the keepalpha parameter that allow unity to actually write the alpha we return at the end of the shader.
6*/
7
8Shader "Oculus/Underlay Impostor" {
9 Properties{
10 _Color("Color", Color) = (1,1,1,1)
11 _MainTex("Albedo (RGB)", 2D) = "white" {}
12 _Glossiness("Smoothness", Range(0,1)) = 0.5
13 _Metallic("Metallic", Range(0,1)) = 0.0
14 }
15 SubShader{
16 Tags { "Queue" = "Geometry+1" "RenderType" = "Opaque" }
17 LOD 200
18
19 CGPROGRAM
20 // Physically based Standard lighting model, and enable shadows on all light types
21 #pragma surface surf Standard fullforwardshadows keepalpha
22
23 // Use shader model 3.0 target, to get nicer looking lighting
24 #pragma target 3.0
25
26 sampler2D _MainTex;
27
28 struct Input {
29 float2 uv_MainTex;
30 };
31
32 half _Glossiness;
33 half _Metallic;
34 fixed4 _Color;
35
36 void surf(Input IN, inout SurfaceOutputStandard o) {
37 // Albedo comes from a texture tinted by color
38 fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
39 o.Albedo = c.rgb;
40 // Metallic and smoothness come from slider variables
41 o.Metallic = _Metallic;
42 o.Smoothness = _Glossiness;
43 o.Alpha = 0.f;
44 }
45 ENDCG
46 }
47 FallBack "Diffuse"
48}