- Home /
texture alpha with color constant
Hello everyone, i'd like to know if it possible to create a Pass where i multiply the texture alpha with a loaded constant color
SetTexture [_MainTex] {
constantColor [_Ccolor]
combine texture.a * constant
}
does anyone know how this is achievable? thanks!
Answer by Ipsquiggle · Jun 19, 2012 at 03:38 AM
There is a second form of combine
which calculates the alpha separately from the color, like this:
combine color, alpha
So you probably want something like this:
combine texture, texture * constant
Note: untested code! Let me know if that doesn't work, I can investigate further...
Answer by antonipxilo · Jun 19, 2012 at 01:40 PM
Hi Graham, i am not very familiar with the unity shader system, any help is appreciated
if i had to write GLSL it would be something like this
{ float4 color = tex2D(diffuseTextureSampler, in.UV); color.RGB = materialConstantColor.RGB; }
so basically my final pixel will be (texture.ALPHA + constant.RGB) any ideas?
Your answer
Follow this Question
Related Questions
Multiple materials on same object 0 Answers
Texture2D to Texture3D 2 Answers
Tracing in Unity3D 2 Answers
What is wrong with my shader? 1 Answer
Which is the best inbuilt Unity transparent Shader to use for an iphone game. 1 Answer