Jump to content
  • Advertisement
Sign in to follow this  
Husbj

Downsampling texture size importance

This topic is 969 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I find myself in a situation where I need to downsample a bunch of textures (render targets from previous passes) in every frame.

Now my textures are 2048x2048 pixels in size and I wish to downsample these to 1024x1024. I also happen to have a "spare" 2048x2048 render target at this point in my loop. Is there any disadvantage to rendering my downsampled texture to this by simply drawing a screen quad from (-1, 1) .. (0, 0) (ie. the top left quadrant) onto here as opposed to setting up another render target that is of the desired downsampled size?

I noticed I got some borders drawn to the upsampled image again when I tried using this approach but maybe this can be worked around using backdrop clear colours and proper sampler states? (I'm writing this just before bed and haven't yet tried figuring out such states).

 

In the grand scheme of things it would probably be better to create a smaller render target to downsample to when it's just a half size thing like this, however I would like for my implementation to easily be able to work with other scale factors and then preferably without having to provide uniquely dimensioned render targets for each different downsampling.

 

Thanks for any pointers. 

Share this post


Link to post
Share on other sites
Advertisement

To render to part of a render target, what you usually want to do is to adjust the viewport. This allows you to render anything you want - it will handle the scaling and clipping for you.

 

The only downside is that when sampling from the render target, you can't clamp or wrap at the edge of the viewport, so it's easy to read outside of the viewport that you wrote to.

Share this post


Link to post
Share on other sites

Ah yes, I didn't think of using the viewport for this; that's useful!

The edge sampling is hopefully not an issue assuming my target images will be some power of 2 both before and after the "scaling", or am I wrong? (It will of course be upsampled back to the original resolution again before being used in any other process).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!