Hi All,
I am trying to create a hud element which is a curved healthbar with small bars. I have created an image of the bar with a gradient alpha on it. I plan on using the alpha cutout to mask part of the radial.
The image:
The problem is, that this does not what it is supposed to do. It dissolves part of each block as well as the alpha cutout changes. It does not cut off a solid block. I think the problem is that each block is not a solid color, but I have no idea how to fix this in photoshop. If I fill each block by hand, it completely screws it up. Does anyone have any suggestions on how to handle this problem?
It looks like you’re using anti-aliasing for the texture. Each block should be 100% a single solid color with no anti-aliasing, and no compression that might introduce artifacts.
–Eric
That’s what I think too. The blocks have smooth antialiased edges, this is definitely a problem.
I would split it into two textures. One texture that represents the RGBA and a second Alpha8 texture that represents the mask only. This allows to draw the main texture with all its encoded alpha information to have smooth edges and the mask textures’ purpose is to clip pixels only. Each block in the mask texture must have exactly one color if you want to clip a block at once. Antialised edges must not appear in the mask or you have this dissolve behaviour again. The mask texture should use “Format=Alpha8”, “FilterMode=Point” and “Bypass sRGB=true”.
Here is a shader that can be used to achieve it:
http://forum.unity3d.com/threads/247533-Moving-an-alpha-mask-or-changing-the-values-within-it
I am sorry, but I am not sure what you mean. Could you elaborate? Isn’t the texture I have what you call the Alpha8?
I am using Photoshop. How can I prevent it from doing that? I made the circle by transforming a line of blocks to polar coordinates.
I was referring to the texture importer settings, here is a screenshot:
I’m not an artist, but maybe the setting in Photoshop under “Edit > Preferences > General > Image Interpolation” affects the feature you were using too. You want to set it to “Nearest Neighbor (preserve hard edges)”. But this is a global setting and you most likely don’t want to use it for anything else
It helped somewhat, but the blocks still aren’t a solid color. I am afraid I just have to go and adjust them all by hand.
Thanks for the help!