This one does Double Sided Soft Alpha Transparency:
(这是双面显示+透明)
把下面这段代码复制到新建的shader里面,然后把它拖到相关的材质中就可以了.
Shader "Vegetation" {
Properties {
_Color ("Main Color", Color) = (.5, .5, .5, .5)
_MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {}
_Cutoff ("Base Alpha cutoff", Range (0,.9)) = .5
}
SubShader {
// Set up basic lighting
Material {
Diffuse [_Color]
Ambient [_Color]
}
Lighting On
// Render both front and back facing polygons.
Cull Off
// first pass:
// render any pixels that are more than [_Cutoff] opaque
Pass {
AlphaTest Greater [_Cutoff]
SetTexture [_MainTex] {
combine texture * primary, texture
}
}
// Second pass:
// render in the semitransparent details.
Pass {
// Dont write to the depth buffer
ZWrite off
// Don't write pixels we have already written.
ZTest Less
// Only render pixels less or equal to the value
AlphaTest LEqual [_Cutoff]
// Set up alpha blending
Blend SrcAlpha OneMinu***cAlpha
SetTexture [_MainTex] {
combine texture * primary, texture
}
}
}
}
==================分割线=================
And this one does Baked Vertex Lighting:
(这个似乎是烘焙的.还没试过)
Shader "Baked Vertex Lighting/Vertex Lit" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" { }
}
SubShader {
Pass {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting Off
Cull Off
SeperateSpecular On
SetTexture [_MainTex] {
constantColor [_Color]
Combine texture * primary DOUBLE, texture * constant
}
}
Pass {
Blend One One
Lighting Off
Cull Off
BindChannels {
Bind "Vertex", vertex
Bind "TexCoord", texcoord
Bind "Color", color
}
SetTexture [_MainTex] {
Combine primary * texture
}
SetTexture [_MainTex] {
constantColor [_Color]
Combine previous * constant
}
}
}
}
(这是双面显示+透明)
把下面这段代码复制到新建的shader里面,然后把它拖到相关的材质中就可以了.
Shader "Vegetation" {
Properties {
_Color ("Main Color", Color) = (.5, .5, .5, .5)
_MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {}
_Cutoff ("Base Alpha cutoff", Range (0,.9)) = .5
}
SubShader {
// Set up basic lighting
Material {
Diffuse [_Color]
Ambient [_Color]
}
Lighting On
// Render both front and back facing polygons.
Cull Off
// first pass:
// render any pixels that are more than [_Cutoff] opaque
Pass {
AlphaTest Greater [_Cutoff]
SetTexture [_MainTex] {
combine texture * primary, texture
}
}
// Second pass:
// render in the semitransparent details.
Pass {
// Dont write to the depth buffer
ZWrite off
// Don't write pixels we have already written.
ZTest Less
// Only render pixels less or equal to the value
AlphaTest LEqual [_Cutoff]
// Set up alpha blending
Blend SrcAlpha OneMinu***cAlpha
SetTexture [_MainTex] {
combine texture * primary, texture
}
}
}
}
==================分割线=================
And this one does Baked Vertex Lighting:
(这个似乎是烘焙的.还没试过)
Shader "Baked Vertex Lighting/Vertex Lit" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" { }
}
SubShader {
Pass {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting Off
Cull Off
SeperateSpecular On
SetTexture [_MainTex] {
constantColor [_Color]
Combine texture * primary DOUBLE, texture * constant
}
}
Pass {
Blend One One
Lighting Off
Cull Off
BindChannels {
Bind "Vertex", vertex
Bind "TexCoord", texcoord
Bind "Color", color
}
SetTexture [_MainTex] {
Combine primary * texture
}
SetTexture [_MainTex] {
constantColor [_Color]
Combine previous * constant
}
}
}
}