Custom alpha channel with BlendStates?

Hey there! There are a few questions similar to this, I just want to get a clear answer because I’m a bit foggy on all this. Using some a custom BlendState and possibly a render target, is this the following mockup possible? The background is arbitrary and could be comprised of many textures. The black and white images could also be made using the alpha channel of a png as demonstrated at the bottom. I’ve also heard about use of a Stencil Buffer, and I’m willing, but using BlendState seems a bit easier.

The precise effect I’m going for could be used for a Genesis / Sega Saturn style dithered transparency effect with, in this case, a solid yellow cone texture with its own transparency for the overall shape, plus a repeating checkerboard texture:
streetsofrage2_rgb_raw

Thanks for your help!

Have you tried applying dithering to the mask, in your image editing app…?

Well yes, but baking the effect in doesn’t allow for the flexibility I’m looking for, such as an animated alpha channel on a static texture or number of textures.

The effect could also be used with a set number of repeating textures representing different levels of dither for “screen door transparency”: Screen-Door Transparency

Not quite sure if it is me, but the effect in Streets of Rage seem like rendering normally and on top you render another sprite with holes which is the light and some semi transparent pixels to add some tinting, nothing fancy.

This type of dithered transparency was done in hardware, not baked into the texture. And just to be clear, that’s just one effect, that first mockup is really what I’m looking for. It seems so simple to me. Two alpha channels added together, that’s all.

Ah sorry, misunderstood the image on top with the 2 alpha channels. You can do it by using render targets first render the first alpha channel and texture into a render target, then use that render target with the new alpha channel and you get what you want.
The other way I can think of is to write a shader to use two textures as alpha channels on top of a texture but you will have to write it, I think I remember I saw some example in the XNA site long ago about sampling from two textures at the same time so it can be modified to use 3 textures, one if you texture and the other 2 the alpha channels. There are some samples here

1 Like

Basically Silk Screen printing… how about a large texture with sets of effects in slices, and you just shift the slices along…

EDIT

Just thinking of the easiest implementation.

1 Like

For this you want to use Shader, blend state takes only two thing (at max, it also can do less actually) content of target surface, and output of pixel shader. Create shader that sample both texture, use one of them as alpha, you get combination you are looking for. As far as dithering shader goes, you can create way more fancy and automatized results.

1 Like