开发者

realtime rendering postprocessing effects

i have a question about real time rendering post processing effects.

how do they work i开发者_开发技巧n general? i.e. how do you access the final picture so that you can make changes to it?

do you render it to a texture? if so, how do you make sure the texture fits your screen size?

thanks!


Basic workflow:

  • Render the scene to a render target / texture (screen-size, usually same format)
  • Reset render target - either to another render target / texture or the actual backbuffer
  • Set the pixel shader for post-processing, bind the scene texture to a sampler
  • Draw a full-screen quad over the scene using a dummy vertex shader

Within the postprocessing pixel shader, access to individual scene pixels is dead simple if you know the normalized x,y position of the current texel (which is given by the texture coordinates of the fullscreen quad interpolated to pixel shader stage).

Many post-processing effects require multiple passes to temporary render targets. An example is the infamous 'bloom' effect: you take the scene texture, subtract out the dark parts, blur and scale the remaining image down (usually done in multiple passes using a ping-pong logic to re-use render targets). The final composition step just adds the bloom texture and the original scene.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜