Skip to main content
gamedev.net
🔒 Locked

Down sampling shader

Started by Programmer101 1 reply 1.8k views
Original Post
Programmer101
Programmer101
I have been working on a down-sampling pass for a bloom effect lately but I have a consistent problem. When I down-sample the image it comes out all pixelated and jagged which causes the bloom to flicker badly. It is as if I were not combining near pixels from the original render and rather just picking every fourth pixel. I think the way to solve the problem is a better method for rendering to a texture smaller than the screen. As of yet I have not been able to render the down sampled scene to a texture that is one fourth of the view size. Instead I have down-sampled the image and then repeated it across the normal size of the viewport in order for it to be smaller. I think this might be the problem because the texture filter is pixelating it. I don't know any way around this. Can I render to a smaller texture or is there another way to repeat the scene on a large texture that won't pixelate it? Thanks!
Zipster
Zipster
It sounds like you're using point filtering. If you render a texture to a viewport of smaller size, then the texture filtering will determine how it samples the texture. In the case of down-sampling, the minification filter will kick in. Set it to linear and it shouldn't look so bad.

The other way to do this would be to render a full-screen quad to the smaller viewport and use a pixel shader to blend a group of texels from the original scene texture. This is typically down for effects such as Gaussian blur.
Programmer101
Programmer101
Alright, thanks for the reply. I have tried rendering to a texture that is smaller than the viewport size but it does not seem to work. It always seems to keep the texture at the size of the viewport. My viewport is 1024x768, and when I create a render target that is .25 that size it seems to still be rendering to 1024x768.

The pixelating problem I am getting is when I tile the scene over the quad that is 1024x768 in order to make it smaller because I cannot seem to render to a texture smaller than the viewport. Even with the linear filtering it seems to pixelate this.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.