Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Custom BlendState Advice

$
0
0

@HietpasGames wrote:

Hey,

I've been bashing my head against a wall trying to get custom blendstates working. Google the crap out of it, tried almost all possibilities, wrote out the math... I just can't get it working.

Details--
- Doing shadows and lights (also have fx running)
- The textures are circle gradient light textures, png, white to transparent
- Trying to draw one light texture and another one light texture on top of it but smaller and have it subtract the alpha.

BlendState.Additive, increases the light strength, great! Now I need something that is the opposite. I've been trying to get opposite of BlendState.Additive working but only on the Alpha channel. Essentially BlendState.AlphaSubtractive.

For the life of me I can't get it to work. Does anyone have a BlendState.Subtractive or BlendState.AlphaSubtractive working?

This is closest I could get to it working but it isn't.

public readonly static BlendState AlphaSubtractive = new BlendState
{
    ColorSourceBlend = Blend.InverseSourceAlpha,
    AlphaSourceBlend = Blend.InverseSourceAlpha,
    AlphaBlendFunction = BlendFunction.Subtract,
    ColorDestinationBlend = Blend.One,
    AlphaDestinationBlend = Blend.One
};

Edit:
If that was confusing, here is another way to understand what I am trying to do. Essentially, there is a solid white rectangle, I'm trying to subtract the alpha from that rectangle from what the texture drawn over it has as alpha.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles