Mixed Resolution Rendering
Here are the slides for my presentation ‘Mixed Resolution Rendering’ at GDC’09.
Here are a few relevant previous blog entries:
Here are the slides for my presentation ‘Mixed Resolution Rendering’ at GDC’09.
Here are a few relevant previous blog entries:
March 26th, 2009 at 11:10 pm
Hello,
I figured I’d post a bit about how we did it way back on Call Of Duty 3, just for a laugh.
The basic idea was to assume that the pixel from the low-res particles was correctly rendered. So we start the shader something like this -
float4 lowrescolor = tex2D(lowrescolorTex, UV); //<– point sampled texture
float lowresdepth = tex2D(lowresdepthTex, UV); //<– point sampled texture
float highresdepth = tex2D(highresdepthTex, UV); // threshold )
{
// slow stuff
}
The principle is that we assume most things were rendered with a similar matching depth, and are therefore correct. This allows us to do a dynamic jump/skip for 90%+ of the pixels, and get a big performance boost.
So the question is, what do we do for the slower stuff?
I wrote this stuff before I’d ever heard of bilateral upsamping, so it’s not quite the standard thing you’d expect. But here goes.
The idea was to assume that the pixel we tested first is wrong. So we have to find a pixel that’s less wrong. We read in the 3 neighbouring pixels from the surrounding block, and test them to find the one that’s most-different from this one.
if ( abs( lowresdepth – highresdepth ) > threshold )
{
// slow stuff
float4 col1 = tex2D(lowrescolorTex+float4(0.5,0), UV); //<– point sampled texture
float4 col2 = tex2D(lowrescolorTex+float4(0,0.5), UV); //<– point sampled texture
float4 col3 = tex2D(lowrescolorTex+float4(0.5,0.5), UV); //<– point sampled texture
Now we check these to find the most different. We assume the most different one is the one with the differentest alpha value. Actually, that’s not quite true, as additive particles throw that off a little. So we add A+G, then check for that. The principle is to assume that whatever we had to start with is Wrong, and therefore anything that is as far away as possible is probably fine
Lastly we do some magic to add up the A+G components of each col1/2/3, and do a max() check to find the best one to use.
The critical thing to remember here is that we’re doing an exact 2:1 resample, so rather than trying to use the built-in bilinear filtering, we can just use point filtering, assume everything is either 0%/100% or 50%, and do it ourselves by simply adjusting the UVs cleverly (i.e. remember that by just adding tex(X,Y) and tex(X+0.5, Y), you’ll get the equivalent to bilinear filtering when using point-sampled textures, assuming 2:1 ratio).
We (me@Treyarch, and Jon Menzies@Shaba) managed to jointly implement this in optimized Xbox 360 and RSX assembler, and managed to ship the game at 60Hz.
Hooray!
March 27th, 2009 at 12:55 am
[...] Shopf (ATI): “Mixed Resolution Rendering” Bookmark [...]
April 8th, 2009 at 3:15 pm
Hi, I attended your GDC talk and found it very informative, but I’m unable to download the slides — the download stops after a second or two and then times out. Am I the only one experiencing this?
April 9th, 2009 at 4:55 am
You’re not the only one having problems. Some people are able to download it fine, while others are not. I’m not totally sure what the problem is yet
April 11th, 2009 at 7:37 am
I put up a mirror link through Mediafire for anyone who is having problems
April 13th, 2009 at 7:12 pm
[...] of OpenGL and OpenCL stuff is available on the Khronos web site, and Jeremy Shopf and Jim Tilander have their respective slides up as well. A Google Search for ‘”GDC [...]