2013-09-05 2 views
0

을 흐리게 원인, 내가받을 모델은 일반적으로 그려 :

GraphicsDevice.Clear(Color.Black); 
GraphicsDevice.BlendState = BlendState.Opaque; 
GraphicsDevice.DepthStencilState = DepthStencilState.Default; 
DrawModel(model, modelMatrix, transforms); 

그러나, 나는 심지어 적용없이 효과, 대상 렌더링 사용하려고하면, 결과는 놀랍지 않게 흐린 :

GraphicsDevice.SetRenderTarget(scene); 
GraphicsDevice.Clear(Color.Black); 
GraphicsDevice.BlendState = BlendState.Opaque; 
GraphicsDevice.DepthStencilState = DepthStencilState.Default; 
DrawModel(model, modelMatrix, transforms); 
GraphicsDevice.SetRenderTarget(null); 

spriteBatch.Begin(); 
spriteBatch.Draw(scene, new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height), Color.White); 
spriteBatch.End(); 

유일한 차이점은 렌더링 대상을 사용하는 것입니다. Here is a picture 왼쪽에는 일반 그림이 있고 오른쪽에는 렌더링 대상 그림이 있습니다.

scene = new RenderTarget2D(device, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, false, device.DisplayMode.Format, DepthFormat.Depth24, 0, RenderTargetUsage.PlatformContents); 

내가 여기에 잘못 했나요 :

scene = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.None); 

나는 또한이 방법을 정의하는 시도했다 : 이것은 렌더 타겟을 정의하는 방법인가?

+0

당신이 당신의 스프라이트에 필터링을 해제 시도? 이 작업은 Begin 메서드가 오버로드되어 SamplerState.PointClamp를 적절한 인수에 제공하여 수행 할 수 있습니다. – dowhilefor

+0

방금 ​​쐈어. 나는 그것이 실제로 악화 될지도 모른다라고 생각한다 - 그것은 흐리게하게되는 것뿐만 아니라 무겁게 pixelated하게된다. – Fibericon

+1

RenderTarget이 BackBuffer와 정확히 같은 크기인지 확인 했습니까? 둘 다 크기가 같으면 PointClamp가 실제로이를 수정해야합니다. 또한, [XNA/D3D9 절반 텍셀 오프셋] 알고 계십니까 (http://drilian.com/2008/11/25/understanding-half-pixel-and-half-texel-offsets/)? 그것은 긴 샷이지만, [보상] (http://gamedev.stackexchange.com/questions/28836/pixel-perfect-rendering-to-a-rendertarget-with-a-fullscreen-quad)을보고 if 뭔가 바뀐다. – Lucius

답변

1

BackBuffer와 동일한 설정을 사용하고 있는지 확인하십시오.

알고 있어야 할 옵션이 많이 있지만 RenderTarget2D를 사용할 때 문제가 발생했다는 것을 기억하지 못합니다. 사용

보십시오이 (그 I를 사용하고 나를 위해 잘 작동 것) :

new RenderTarget2D(GraphicsDevice, pixelWidth, pixelHeight, false, SurfaceFormat.Bgr565, DepthFormat.Depth24Stencil8);