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 Properties
{ {
_MainTex ("Texture", 2D) = "white" {} _MainTex ("Texture", 2D) = "white" {}
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
} }
SubShader SubShader
{ {
Tags { "RenderType"="Opaque" } Tags { "RenderType"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "Queue" = "Transparent+1" }
Cull [_Cull]
ZWrite Off ZWrite Off
Offset -1, -1 Offset -0.01, -0.01
CGINCLUDE CGINCLUDE
@@ -18,7 +18,7 @@ inline void uddInvertUV(inout float2 uv)
#endif #endif
} }
inline void uddToLinearIfNeeded(inout float3 rgb) inline void uddToLinearIfNeeded(inout fixed3 rgb)
{ {
if (!IsGammaSpace()) { if (!IsGammaSpace()) {
rgb = GammaToLinearSpace(rgb); rgb = GammaToLinearSpace(rgb);
@@ -7,12 +7,15 @@ Properties
_MainTex ("Albedo (RGB)", 2D) = "white" {} _MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0, 1)) = 0.5 _Glossiness ("Smoothness", Range(0, 1)) = 0.5
_Metallic ("Metallic", Range(0, 1)) = 0.0 _Metallic ("Metallic", Range(0, 1)) = 0.0
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
} }
SubShader SubShader
{ {
Tags { "RenderType"="Opaque" } Tags { "RenderType"="Opaque" }
Cull [_Cull]
CGPROGRAM CGPROGRAM
#pragma target 3.0 #pragma target 3.0
@@ -5,6 +5,7 @@ Properties
{ {
_Color ("Color", Color) = (1, 1, 1, 1) _Color ("Color", Color) = (1, 1, 1, 1)
_MainTex ("Texture", 2D) = "white" {} _MainTex ("Texture", 2D) = "white" {}
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
} }
SubShader SubShader
@@ -12,6 +13,8 @@ SubShader
Tags { "RenderType"="Opaque" } Tags { "RenderType"="Opaque" }
Cull [_Cull]
CGINCLUDE CGINCLUDE
#include "UnityCG.cginc" #include "UnityCG.cginc"
@@ -6,6 +6,7 @@ Properties
_Color ("Color", Color) = (1, 1, 1, 1) _Color ("Color", Color) = (1, 1, 1, 1)
_MainTex ("Texture", 2D) = "white" {} _MainTex ("Texture", 2D) = "white" {}
_Mask ("Mask", Range(0, 1)) = 0.1 _Mask ("Mask", Range(0, 1)) = 0.1
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
} }
SubShader SubShader
@@ -13,7 +14,8 @@ SubShader
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
ZWrite Off Cull [_Cull]
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha Blend SrcAlpha OneMinusSrcAlpha
CGINCLUDE CGINCLUDE
@@ -5,6 +5,7 @@ Properties
{ {
_Color ("Color", Color) = (1, 1, 1, 1) _Color ("Color", Color) = (1, 1, 1, 1)
_MainTex ("Texture", 2D) = "white" {} _MainTex ("Texture", 2D) = "white" {}
[KeywordEnum(Off, Front, Back)] _Cull("Culling", Int) = 2
} }
SubShader SubShader
@@ -12,7 +13,8 @@ SubShader
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
ZWrite Off Cull [_Cull]
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha Blend SrcAlpha OneMinusSrcAlpha
CGINCLUDE CGINCLUDE