- Home /
Transparent Texture
I have Texture A and B. A being an image and B being a solid black texture. I'd like to draw B over A, but have it be transparent enough to still see the image behind it. I'm not sure how to make the solid black be somewhat see-through. Is this something I'd do in Unity or the software I used to make the texture? Thanks!
Answer by Jessy · Dec 20, 2010 at 02:31 PM
Blending solid black over something is the same thing as multiplying all the pixels of an image by a constant. You can write your own shader if that's really all you need, and that will be extra-fast, but you can just use material.color for this, with the built-in shaders, with the same value for R,G, and B.
Answer by HolBol · Dec 20, 2010 at 08:18 PM
Use the built in transparent shaders and set it's alpha to < 100.
Do you have an example? I am working from OnGUI using DrawTexture. Thanks!
Got it going with a Transparent\Diffuse shader and :
mat.color = new Color(0, 0, 0, .5f);
Graphics.DrawTexture(new Rect(10, 10, 64, 64), black, mat);
There is never any reason to alpha blend black in; it's a waste. Write a multiplicative-constant shader.
Your answer
Follow this Question
Related Questions
use Alpha from image in Fragment shader 0 Answers
transparent background with GUI.DrawTexture 0 Answers
Make a gameobject with textures semitransparent 3 Answers
Render texture above something else 1 Answer
Quick GUI Texture Question 0 Answers