- Home /
This question was
closed Oct 25, 2017 at 12:10 AM by
ChrisX930.
Adding Alpha to a Shader?
Hey Guys, I want to add Alpha to this shader but I don't know how :/ Could you edit this shader to add alpha to it?
Shader "N3DS/DoubleSided/VertexLitCullOff"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
Cull Off
LOD 80
// Non-lightmapped
Pass {
Tags { "LightMode" = "Vertex" }
Material
{
Diffuse (1,1,1,1)
Ambient (1,1,1,1)
}
Lighting On
SetTexture [_MainTex] {
constantColor (1,1,1,1)
Combine texture * primary DOUBLE, constant // UNITY_OPAQUE_ALPHA_FFP
}
}
// Lightmapped, encoded as dLDR
Pass
{
Tags { "LightMode" = "VertexLM" }
Cull Off
BindChannels {
Bind "Vertex", vertex
Bind "normal", normal
Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
Bind "texcoord", texcoord1 // main uses 1st uv
}
SetTexture [unity_Lightmap] {
matrix [unity_LightmapMatrix]
combine texture
}
SetTexture [_MainTex] {
constantColor (1,1,1,1)
combine texture * previous DOUBLE, constant // UNITY_OPAQUE_ALPHA_FFP
}
}
// Lightmapped, encoded as RGBM
Pass
{
Tags { "LightMode" = "VertexLMRGBM" }
Cull Off
BindChannels {
Bind "Vertex", vertex
Bind "normal", normal
Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
Bind "texcoord", texcoord1 // main uses 1st uv
}
SetTexture [unity_Lightmap] {
matrix [unity_LightmapMatrix]
combine texture * texture alpha DOUBLE
}
SetTexture [_MainTex] {
constantColor (1,1,1,1)
combine texture * previous QUAD, constant // UNITY_OPAQUE_ALPHA_FFP
}
}
// Pass to render object as a shadow caster
Pass
{
Name "ShadowCaster"
Tags { "LightMode" = "ShadowCaster" }
Cull Off
ZWrite On ZTest LEqual Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_shadowcaster
#include "UnityCG.cginc"
struct v2f {
V2F_SHADOW_CASTER;
};
v2f vert( appdata_base v )
{
v2f o;
TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
return o;
}
float4 frag( v2f i ) : SV_Target
{
SHADOW_CASTER_FRAGMENT(i)
}
ENDCG
}
}
}
normally it should look like this:
but it looks like this:
thank you!
EDIT: I tried to use Alpha Cutout for that but it is not supported by the Hardware I use. Is there another way to add alpha to this shader?
Comment
Have you tried to adjust Rendering $$anonymous$$ode? from Opaque to Cutout?
I tried. But Cutout isn't supported on N3DS unfortunatelly~
Answer by ChrisX930 · Oct 17, 2017 at 09:25 PM
I tried to use Alpha Cutout for that but it is not supported by the Hardware I use. Is there another way to add alpha to this shader?