Hi all,
Hope someone can help me with this one! Because of performance, i want to render a reflection map/texture without antialiasing while rendering the whole scene (which draws a plane with the reflectiontexture) to the screen with antialiasing.
My application, that includes a reflection plane, worked fine without antialiasing. Than I added this code to turn on antialiasing:
| GraphicsDevice.PresentationParameters.MultiSampleType = MultiSampleType.FourSamples; |
| |
| GraphicsDevice.RenderState.MultiSampleAntiAlias = true; |
| |
| graphics.PreferMultiSampling = true; |
| |
| graphics.ApplyChanges(); |
| |
|
| |
But now i get message: "The active render target and depth stencil surface must have the same pixel size and multisampling type".
This is how my reflextion target is declaired:
| reflectionRenderTarg = new RenderTarget2D(graphics.GraphicsDevice, |
| graphics.PreferredBackBufferWidth, |
| graphics.PreferredBackBufferHeight, |
| 1, SurfaceFormat.Color); |
When i change it to reflectiontarget to multisampling like this:
| reflectionRenderTarg = new RenderTarget2D(graphics.GraphicsDevice, |
| graphics.PreferredBackBufferWidth, |
| graphics.PreferredBackBufferHeight, |
| 1, SurfaceFormat.Color, graphics.GraphicsDevice.PresentationParameters.MultiSampleType, |
| graphics.GraphicsDevice.PresentationParameters.MultiSampleQuality); |
my application runs to slow!
Than i tried to draw the reflectiontarget whithout multisampling like this in the draw method:
| graphics.PreferMultiSampling = false; |
| graphics.ApplyChanges(); |
| |
| //HERE I DRAW REFLECTION TO REFLECTIONTARGET |
| |
| graphics.PreferMultiSampling = true; |
| graphics.ApplyChanges(); |
| |
| // HERE I DRAW WHOLE SCENE INCLUDING THE REFLECTION PLANE THAT USES THE REFLECTION TEXTURE. |
| |
| |
| |
But now I end up with 2 FPS :-(
What is an efficient way to draw a reflection low quality (without multisampling antialiasing) and than draw everything to the screen(with multisampling antialisating)?