i created a 3D scene (an earth with a space skybox) and now i would like to add some 2D overlays (text and a view images). I planned to do this by using a SpriteBatch and its Draw() and DrawString() Methods. Now either i get the 2D overlay icons and text transparent (and the 3D scene apears blueish) or i get the scene how it should be but the 2D overlay doesn´t have a transparent background anymore.
That is the code i use to display the 2D overlay:
spritebatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.AnisotropicWrap, DepthStencilState.Default, RasterizerState.CullCounterClockwise);
That is the result i get (click for bigger view):
spritebatch.DrawString(calibri, currentInstance.GetType().Name, new Vector2(80, 150), Color.Green);
spritebatch.DrawString(calibri, currentInstance.getSceneDescription(), new Vector2(80, 200), Color.Green);
spritebatch.Draw(previousScene, new Rectangle(80, SceneFactory.Graphics.GraphicsDevice.Viewport.Height - 120, 80, 80), Color.White);
spritebatch.DrawString(calibri, "Next Scene", new Vector2(170, SceneFactory.Graphics.GraphicsDevice.Viewport.Height - 90), Color.Green);
spritebatch.Draw(nextScene, new Rectangle(280, SceneFactory.Graphics.GraphicsDevice.Viewport.Height - 120, 80, 80), Color.White);
no transparent images with BlendState.Opaque:
does anyone know, what settings i need to get transparent 2D elements and a proper 3D scene, or how i can set the "background" of the SpriteBatch totally to alpha - 0?
thank you so far!