Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm making a game and I want the end graphics to look chunky and pixellated, so I'm drawing from the spritebatch onto a RenderTarget2D which is 1/4th the size of the actual backbuffer, and then drawing from that to the backbuffer.

At first the sprites were blurred by antialiasing and I read that using SamplerState.PointWrap in the spritebatch Begin call would ease this a bit so I made that change. Everything seemed better, however the final on-screen image is still blurry and I think this is because of how it draws from the rendertarget2D to the backbuffer.

The image here is a comparison - On the left is how the output looks now and the right is how I want it to look.

share|improve this question
1  
I guess you have to change your scaleing system from linear to nearest neighbor, but I don't any idea how to do so. –  Ali.S Sep 21 '11 at 22:51
add comment

2 Answers 2

up vote 2 down vote accepted

Since you already mentioned Point filtering yourself... Make sure you don't draw at fractional positions, also don't scale or rotate. See if that helps. Also try to save your render target to a imagefile to see where the blur effect occurs during the rendering. At last make sure you set PointClamp / PointWarp everywhere. In the last renderstep where the rt gets drawn to the backbuffer this might be important too.

share|improve this answer
    
I agree; it looks like you're getting bilinear filtering in the step where you copy the 1/4 size render target to the back buffer. That should have point filtering as well. –  Nathan Reed Sep 22 '11 at 1:20
    
Thanks, you're both right: Somehow I'd missed the second Begin call didn't have the right filtering on. Thanks again! –  Kieran Sep 22 '11 at 21:34
add comment

When you render your RenderTarget2D onto the actual backbuffer, make sure you have your TextureFilter set to TextureFilter.Point.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.