纳金网

标题: 纯可控 alpha 透贴shader [打印本页]

作者: 王者再临    时间: 2014-8-31 23:18
标题: 纯可控 alpha 透贴shader
unity默认提供透明shader,但可能有的同学已经发现,不管设置成默认的哪一种,它都和你使用原贴图有很大的色差,这是因为这些shader都包含光照计算,使你的贴图看起来走色了~~

纯的alpha shader可以完全还原你贴图的颜色,但你却无法控制它变亮或变暗,所以我们需要一个极简单的,尽量少的消耗系统资源的shader,如下

Shader "AdamChen/Simple Alpha" {

Properties {

_Color ("Main Color", Color) = (1,1,1,0)

_MainTex ("Base (RGB) Transparency (A)", 2D) = "" {}

}
SubShader {

Material {

Diffuse [_Color]

Ambient [_Color]

}

Lighting On

SeperateSpecular Off

Blend SrcAlpha OneMinusSrcAlpha

Pass {

Cull Front

SetTexture [_MainTex] {

Combine Primary * Texture

}

}

Pass {

Cull Back

SetTexture [_MainTex] {

Combine Primary * Texture

}

}

}

}


作者: hyui    时间: 2014-9-1 04:44
感谢分享!
作者: kiskil    时间: 2014-9-24 10:55
感谢分享。
作者: bitgold    时间: 2014-9-24 18:49
感谢分享




欢迎光临 纳金网 (http://c-www.narkii.com/club/) Powered by Discuz! X2.5