---
title: "BilateralFilter&MixedResolutionRendering"
author: "tulunta"
date: "2012-07-21T14:30:00Z"
tags: []
slug: "bilateralfilter-mixedresolutionrendering"
draft: false
lastmod: "2012-07-21T23:39:21Z"
id: 1603207
url: "https://tulunta.iteye.com/blog/1603207"
---

MixedResolutonRendering, gdc09的一个paper：

http://developer.amd.com/gpu\_assets/ShopfMixedResolutionRendering.pdf

里面需要的一个基础知识：bilateral filter（upsampling）

[http://research.microsoft.com/pubs/78272/FinalPaper\_0185.pdf](http://research.microsoft.com/pubs/78272/FinalPaper_0185.pdf)

[http://blog.csdn.net/bugrunner/article/details/7170471](http://blog.csdn.net/bugrunner/article/details/7170471)

**bilateral filter**

[http://blog.csdn.net/bugrunner/article/details/7170471](http://blog.csdn.net/bugrunner/article/details/7170471)这里解释的比较清楚，理论，细节和图片。

bilateral filter在应用的时候常常是在低精度渲染贴回到高精度buffer时候做的。

像ssao，shadow，particle，indirect lighting都属于低频图像数据（效果）所以在低精度不buffer上渲染也不太看出来，然后贴回就好，这也是有10余载历史的技术（思路）了。

问题是如果直接apply回高精度buffer时候，还是会有少量的地方由于精度不同导致的比较明显的视觉bug，比如常见的particle低精buffer应用到高精buffer上的边缘有白边的问题，这个时候就借助一些其他的信息（depth，normal等）来在这里辅助filter，有些地方很连续，那么其实就是一个线性插值，有些地方从depth中判断不连续，那么在不同的像素上有不同的策略这种。

具体的filter算法也是根据需要自己来调整。

**MixedResolutonRendering**

particle:最典型的了，对于低精度的particle render，这些地方容易出问题：

![](http://my.csdn.net/uploads/201207/21/1342851447_4629.jpg)

处理办法是使用depth+normal的bilateral filter：

![](http://my.csdn.net/uploads/201207/21/1342851514_2449.jpg)

![](http://my.csdn.net/uploads/201207/21/1342851527_6082.jpg)

![](http://my.csdn.net/uploads/201207/21/1342851538_3285.jpg)

**PullPushUpSampling：**

一个典型使用的地方是标出shadow mask，进而根据是否在半影区来做昂贵计算的情况。

使用一个低精度的，记录shadow depth min/max的buffer来估计shadow半影区，文中写到对shadow depth的min/max有多层，一个金字塔。。。

这种情况下overhead就比较高了。

**IndirectLighting:**

使用vpl（virtual point light）来实现，由于会涉及到大量的计算，所以也使用低resolution的方式来做。

基本算法：

![](http://my.csdn.net/uploads/201207/21/1342852567_3585.jpg)

识别不连续的方法是：

- 建立一个类似mipmap的depth和normal buffer，但是每一层包含min/max，而不是平均值
- 如果max-min大于一个阀值，那么就认为是不连续

使用mix resolution render之后，indirect lighting是效率原来的将近3倍，cool。