C++ Direct3D纹理后处理/复制
因此,我尝试实现一些Direct3D后处理,但在渲染纹理时遇到了问题。基本上,我的程序如下所示:C++ Direct3D纹理后处理/复制,c++,directx,direct3d,direct3d9,C++,Directx,Direct3d,Direct3d9,因此,我尝试实现一些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
// 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部分,其中有相当多的代码(我只是想了解一下大意)。不幸的是,上面的结果是一个空白屏幕。以下是我希望发生的事情:
device->SetTexture(0, brightpass_texture);
到
然后一切都开始了。请注意,我已尝试跳过brightpass着色器并简单地通过像素,但这也不起作用。您是否确保创建了带有“渲染到纹理”标志的brightpass\u纹理?问题是多重采样。在
D3DPRESENT_PARAMS
结构中,我启用了多重采样。启用多重采样时,无法使用“全屏四元”技术从一个浮点纹理渲染到另一个浮点纹理
相反,我在HDR场景渲染目标(
scene\u texture
)中启用了多重采样,并在PRESENT\u PARAMS
结构中禁用了它。这很好,因为我只需要对场景渲染进行多重采样。调试运行时是否会抛出任何错误?如何获得ldr_曲面
如果将场景直接渲染到ldr_曲面并绕过所有HDR内容,会发生什么?这东西看起来可能有点饱和,但它应该会给你一个想法…如果我直接渲染到LDR曲面(如你所建议的那样,使用饱和),它会工作。嗯。。。调试喷出的内容是什么?
device->SetTexture(0, scene_texture);