Direct3D纹理后处理/复制
题
因此,我正在尝试实施一些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着色器并简单地将像素通过,但这也不起来。
解决方案
问题是多样采样。在里面 D3DPRESENT_PARAMS
结构,我启用了多样化。在启用多换采样时,您不能使用“全屏四边形”技术从一个浮点纹理渲染到另一个浮点纹理。
相反,我在HDR场景渲染目标中启用了多样采样(scene_texture
)并将其禁用在 PRESENT_PARAMS
结构体。这很好,因为我只需要用于场景渲染的多样采样。
其他提示
您是否确保用呈现到文本标志创建BrightPass_Texture?
调试运行时会出现任何错误吗?您如何获得ldr_surface?
如果您将场景直接渲染到ldr_surface并绕过所有HDR的东西,会发生什么?事情看起来可能有点饱和,但应该给您一个想法...
不隶属于 StackOverflow