add culling option and fix cursor problem on transparent material.

This commit is contained in:
hecomi
2016-11-02 11:25:43 +09:00
parent 6531fe1dd6
commit 3e90889266
7 changed files with 17 additions and 5 deletions
@@ -4,15 +4,17 @@
Properties
{
_MainTex ("Texture", 2D) = "white" {}
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
}
SubShader
{
Tags { "RenderType"="Opaque" }
Tags { "RenderType"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "Queue" = "Transparent+1" }
Cull [_Cull]
ZWrite Off
Offset -1, -1
Offset -0.01, -0.01
CGINCLUDE
@@ -18,7 +18,7 @@ inline void uddInvertUV(inout float2 uv)
#endif
}
inline void uddToLinearIfNeeded(inout float3 rgb)
inline void uddToLinearIfNeeded(inout fixed3 rgb)
{
if (!IsGammaSpace()) {
rgb = GammaToLinearSpace(rgb);
@@ -7,11 +7,14 @@ Properties
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0, 1)) = 0.5
_Metallic ("Metallic", Range(0, 1)) = 0.0
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
}
SubShader
{
Tags { "RenderType"="Opaque" }
Cull [_Cull]
CGPROGRAM
@@ -5,6 +5,7 @@ Properties
{
_Color ("Color", Color) = (1, 1, 1, 1)
_MainTex ("Texture", 2D) = "white" {}
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
}
SubShader
@@ -12,6 +13,8 @@ SubShader
Tags { "RenderType"="Opaque" }
Cull [_Cull]
CGINCLUDE
#include "UnityCG.cginc"
@@ -6,6 +6,7 @@ Properties
_Color ("Color", Color) = (1, 1, 1, 1)
_MainTex ("Texture", 2D) = "white" {}
_Mask ("Mask", Range(0, 1)) = 0.1
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
}
SubShader
@@ -13,7 +14,8 @@ SubShader
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
ZWrite Off
Cull [_Cull]
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
CGINCLUDE
@@ -5,6 +5,7 @@ Properties
{
_Color ("Color", Color) = (1, 1, 1, 1)
_MainTex ("Texture", 2D) = "white" {}
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
}
SubShader
@@ -12,7 +13,8 @@ SubShader
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
ZWrite Off
Cull [_Cull]
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
CGINCLUDE