Direct3D texture after processing / copying
So I am trying to implement some Direct3D post processing and I am having problems with texture processing. Basically my program looks like this:
// 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...
I left some parts of b / c, there is a fair amount of code in there (I'm just trying to get the general idea). Unfortunately, the above results are on a blank screen. This is what I want:
- Display scene in texture (HDR)
- Repair this texture to the second texture THROUGH THE Brightpass PATTERN
- Map the second texture to the visible LDR surface.
Note that if I change the last line above from
device->SetTexture(0, brightpass_texture);
to
device->SetTexture(0, scene_texture);
Then everything works. Note that I've tried skipping the shader label and just skipping the pixels, but that doesn't work either.
source to share
The problem was multisampling. In the structure, D3DPRESENT_PARAMS
I have enabled multisampling. You cannot map from one floating point texture to another floating point texture using the "full screen square" technique while multisampling is enabled.
Instead, I enabled multisampling in the scene's target render HDR ( scene_texture
) and disabled it in the frame PRESENT_PARAMS
. This is good because I only need multisampling to render the scene.
source to share