2
我有一個場景,我真的需要景深。Unity 3D - 具有alpha制動景深的着色器
顯然,Unity的景深不適用於任何處理alpha的內置或自定義着色器。
因此,這種情況發生在透明/散射着色器中。透明/剪切作品。
這是我做的最簡單的自定義着色器觸發此行爲:
Shader "Custom/SimpleAlpha" {
Properties {
_MainTex ("Base (RGBA)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
//Tags { "RenderType"="Opaque" }
LOD 300
ZWrite Off
CGPROGRAM
#pragma surface surf Lambert alpha
#include "UnityCG.cginc"
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
如果您嘗試在項目中的代碼,你會發現,每個對象穿着色器模糊與非常相同量,而不是模糊上Z.
任何幫助非常感謝築底。 在此先感謝。
我張貼在統一的答案同樣的問題:http://answers.unity3d.com/questions/438556/my-shader-brakes-depth-of-field.html