@Razputin wrote:
Hi,
I am trying to render a bunch of flares as additive, if I draw them directly in graphics device it works as intended, but if I draw to a render target first I get full black.
I made a separate project to try and isolate this, this is the code I'm using
Render target creationrenderTarget = new RenderTarget2D(GraphicsDevice, 300, 300, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);
Draw code
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null);
spriteBatch.Draw(jiro, new Vector2(150, 100), new Rectangle(0, 0, jiro.Width, jiro.Height), Color.White, 0, Vector2.Zero, Vector2.One, SpriteEffects.None, 0);
spriteBatch.End();GraphicsDevice.SetRenderTarget(renderTarget);
GraphicsDevice.Clear(Color.Transparent);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive);
spriteBatch.Draw(sphere, new Vector2(100, 60), new Rectangle(0, 0, sphere.Width, sphere.Height), Color.White, 0, Vector2.Zero, Vector2.One, SpriteEffects.None, 0);
spriteBatch.End();GraphicsDevice.SetRenderTarget(null);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null);
spriteBatch.Draw(renderTarget, Vector2.Zero, renderTargetSourceRect, Color.White, 0, Vector2.Zero, Vector2.One, SpriteEffects.None, 0);
spriteBatch.End();No clue where things are going wrong
Thanks
Posts: 3
Participants: 2