Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


How to down/up sample a render target


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 lipsryme   Members   -  Reputation: 1031

Like
0Likes
Like

Posted 03 September 2012 - 01:04 PM

I haven't really found anything basic on how to do this.
I want to speed up my ssao calculation by using a half res depth target.
Now as I understand I have to downsample this target, but I don't really know how to do this.
I've seen some code snippets about averaging pixel but I don't fully understand this.

Can someone explain to me how this works or guide me to some tutorial or easy to understand code ?

I realize it's not as easy as just outputting the sampled value of the original to a rendertarget with half the size or is it ?

Edited by lipsryme, 03 September 2012 - 01:08 PM.


Sponsor:

#2 MJP   Moderators   -  Reputation: 11568

Like
1Likes
Like

Posted 03 September 2012 - 01:42 PM

You can read up on image scaling if you want some background info. The basic idea is that you sample one or more texels from the source render target, apply some sort of filter to those texels, and output the result. You're probably already familar with the "point" and "linear" filtering modes that are built-in to the hardware, which you can use just by taking a single texture sample with the appropriate sampler settings. But you can also implement more complex filters manually in your shader, if you wish.

For downscaling depth, things are a bit more tricky since some of the conventional wisdom used for scaling color images won't necessarily apply. Most people just end up using point filtering to downscale depth, which preserves edges but increases aliasing. To implement that, it really is as easy as you think it is: just use a pixel shader to sample the full-size render target, and output the value to your half-size render target.

#3 lipsryme   Members   -  Reputation: 1031

Like
0Likes
Like

Posted 04 September 2012 - 07:46 AM

For downscaling depth, things are a bit more tricky since some of the conventional wisdom used for scaling color images won't necessarily apply. Most people just end up using point filtering to downscale depth, which preserves edges but increases aliasing. To implement that, it really is as easy as you think it is: just use a pixel shader to sample the full-size render target, and output the value to your half-size render target.


My image seems distorted now though. Do I need to change the viewport while rendering in half res ?

edit: Ah yes that was it :)

Edited by lipsryme, 04 September 2012 - 07:55 AM.


#4 samoth   Crossbones+   -  Reputation: 4911

Like
0Likes
Like

Posted 04 September 2012 - 07:58 AM

Aniso decimation is something that may also be interesting for you.

#5 lipsryme   Members   -  Reputation: 1031

Like
0Likes
Like

Posted 30 September 2012 - 01:02 PM

solved.

Edited by lipsryme, 04 October 2012 - 01:11 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS