Is there a way to always force an all white alpha channel on a render texture?
What i need is to fade the texture in an out and for that i need to use a Transparent shader. Using the Transparent/Diffuse shader works fine with the fading, but i dont want the render texture to alpha blend with the background it should just be diffuse.
So come to think of it is it possible to modify the Transparent/Diffuse shader to just overwrite what is in the alpha channel of the texture with the color white. I think that would solve my problem.
I am however new to shader coding and the Transparent/Diffuse shader is rather large.
Hope this clarifies what i really want to do. Any help will be apriciated.
It would be much simpler using Transparent/VertexLit shader (and faster as well; I guess you don’t need per-pixel lighting on your fading-out-thing).
Changing the Combine line near the end of the shader into this:
Combine texture * primary DOUBLE, primary
would do the trick. Here I changed “texture * primary” alpha combine operation to just “primary”, so it does not take alpha channel from texture at all, just from the color.
Thanks you very much Aras! Works a charm.
Btw i set SeparateSpecular Off aswell as it seems to give to much light on the texture giving it a to white’ish glow.
Thanks again!
If you don’t need lighting you could simplify the shader even more.
Its for an 3D in-game menu so i do need some light or the texture will seem dark. Atm. i have one directional light aimed at the texture. There might also be a need for some light effects on the menu later on, so i think this will do just fine for now.
Thanks again!
Hmmm sorry to bother again.
Now i do need a shader that does not react to lightning, but renders the texture as if it was diffuse lit (self illuminating?) and has an alpha channel for fading ofc.
Is that possible?
Something like that (untested):
Shader "Transparent/Plain Texture" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
Category {
ZWrite Off
Alphatest Greater 0
Tags {Queue=Transparent}
Blend SrcAlpha OneMinusSrcAlpha
ColorMask RGB
SubShader {
Pass {
SetTexture [_MainTex] {
constantColor[_Color]
combine texture * primary, primary
}
}
}
}
}
Sweet Thanks!