多重混合的透明度

时间:2015-04-13 21:08:50

标签: c# graphics xna color-blending

我正在尝试多次混合一些图形,但无法使它工作!!

以下是代码:

        blendmultiply = new BlendState();
        blendmultiply.ColorBlendFunction = BlendFunction.Add;
        blendmultiply.ColorSourceBlend = Blend.DestinationColor;
        blendmultiply.ColorDestinationBlend = Blend.SourceColor;

 //BackGround
        spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam.get_transformation(GestionEcran.GraphicsDevice));

          BackGround.Draw(spriteBatch, gameTime, 255);

        spriteBatch.End();

 //Character
        spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam.get_transformation(GestionEcran.GraphicsDevice));

          Character.Draw(spriteBatch, gameTime, 255);

        spriteBatch.End();

 //MULTIPLY PROBLEM
        spriteBatch.Begin(SpriteSortMode.Immediate, blendmultiply, null, null, null, null, cam.get_transformation(GestionEcran.GraphicsDevice));

          multipliedeffecrs.Draw(spriteBatch, gameTime, 255);

        spriteBatch.End();

 //Foreground
        spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam.get_transformation(GestionEcran.GraphicsDevice));

          ForeGround.Draw(spriteBatch, gameTime, 255);

        spriteBatch.End();

但它只在我的png的透明部分上给出了黑色:

enter image description here

你知道为什么吗?感谢。

0 个答案:

没有答案