Intersection Region Color
i have drawn two semitransparent circles which intersect each other开发者_JAVA百科. I have found that the intersection region is deeper in color than other regions. is there any way to make the whole shape as one semitransparent color (color shouldn't be deeper in one area than others)?
is it possible to send me any sample code to solve the problem?
right now in the draw method, i am using the following code:
spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
spriteBatch.Draw(textureCircle1, spritePositionCircle1, new Color(255, 255, 255, (int)(150)));
spriteBatch.Draw(textureCircle2, spritePositionCircle2, new Color(255, 255, 255, (int)(150)));
spriteBatch.End();
base.Draw(gameTime);
I'm not an XNA guy, so you might have to do some translation.
Could you perhaps render them off screen on as white on black monochrome, and take the resulting image, make the white the transparent color you want and the black completely transparent?
I'm not sure how you'd code that up, but that's the approach I'd research.
Check the alpha values of the pixels which you think are less transparent (you're drawing these onto their own surface, not directly to the backbuffer, right?). They may just seem less transparent because their combined color is darker.
If they truly are less transparent, change the transparency of every pixel on the surface to the same value (I'm afraid I don't know how to do this in XNA).
If they only seem less transparent, try drawing your sprites onto the surface completely opaquely (so one will completely overwrite the other), then again change the transparency of the surface as a whole.
精彩评论