所以我正在尝试实现一些 Direct3D 后处理,但在渲染纹理时遇到了问题。基本上,我的程序如下所示:
// Render scene to "scene_texture" (an HDR texture)...
...
device->SetRenderTarget(0, brightpass_surface);
device->SetTexture(0, scene_texture);
// Render "scene_texture" to "brightpass_texture" using full-screen quad.
// This involves passing the quad geometry through a brightpass shader.
...
device->SetRenderTarget(0, ldr_surface);
device->SetTexture(0, brightpass_texture);
// Render "brightpass_texture" to "ldr_surface" using full-screen quad...
我遗漏了一些部分 b/c 有相当多的代码(我只是想理解一般的想法)。不幸的是,上面的结果是一个空白屏幕。这是我想要发生的事情:
- 将场景渲染为纹理 (HDR)
- 通过 Brightpass 着色器将该纹理渲染到第二个纹理
- 将第二个纹理渲染到可见的 LDR 表面
请注意,如果我将上面的最后一行从
device->SetTexture(0, brightpass_texture);
到
device->SetTexture(0, scene_texture);
然后一切正常。请注意,我已经尝试跳过 Brightpass 着色器并简单地传递像素,但这也不起作用。