Pixel Shader - apply a mask (XNA)

Posted by Michal Bozydar Pawlowski on Game Development See other posts from Game Development or by Michal Bozydar Pawlowski
Published on 2013-04-04T09:19:19Z Indexed on 2013/07/03 11:20 UTC
Read the original article Hit count: 740

Filed under:
|
|

I'd like to apply a simple few masks to few images.

The first mask I'd like to implement is mask like:

XXXOOO

I mean, that on the right everything is masked (to black), and on the left everything is stayed without changes.

The second mask I'd like to implement is glow mask. I mean something like this:

    O
  O***O
 O**X**O
  O***O
    O

What I mean, is a circle mask, which in the center everything is saved without changes, and going outside the circle everything is starting to be black

The last mask is irregular mask. For example like this:

  OOO*
 O**X**O
  OO**OO**O
    OO*X*O
      O*O
       O

Where:
O - to black
* - to gray
X - without changes

I've read, how to apply distortion pixel shader in XNA: msdn

Could you explain me how to apply mute mask on an image? (mask will be grayscale)

© Game Development or respective owner

Related posts about c#

Related posts about xna-4.0