- Home /
Mobile shader: add an emission based on alpha blended texture
Hi all, I found this shaded code on the manual. I need to add an emissive effect to a texture based on his alpha channel so that i added an extra texture slot (BlendTex) and used the lerp command to blend it into my texture. it works great for the blending but my emissive color is very poor and barely visible. i guess i didn't add the emission properly. also i noticed that the color of my emission textures is controlled by _IlluminCol instead of _Emission. what am i missing? can someone help? thanks.
Shader "AAA" {
Properties {
[HDR]_IlluminCol ("Self-Illumination color (RGB)", Color) = (1,1,1,1)
_Color ("Main Color", Color) = (1,1,1,0)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
[HDR]_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" {}
_BlendTex ("Alpha Blended (RGBA) ", 2D) = "white" {}
}
SubShader {
Pass {
// Set up basic vertex lighting
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting On
// Use texture alpha to blend up to white (= full illumination)
SetTexture [_BlendTex] {
constantColor [_IlluminCol]
combine constant lerp(texture) previous
}
// Multiply in texture
SetTexture [_MainTex] {
combine previous * texture
}
}
}
}
Comment