views:

472

answers:

3

I'm considering integrating some D3D code I have with WPF via the new D3DImage as described here:

My question is this: Do pixel shader's work on offscreen surfaces?

+1  A: 

I don't know if there's anything special about it with WPF, but in general yes, pixel shaders work on offscreen surfaces.

Gerald
+5  A: 

Rendering to an offscreen surface is generally less constrained than rendering directly to a back buffer. The only constraints that come with using an offscreen surface with D3DImage is that it must be in a 32-bit RGB/ARGB format (depending on your platform). Other than that, all that the hardware has to offer is at your disposal.

In fact, tons of shader effects take advantage of offscreen surfaces for multipass, or full screen post-processing.

Matt Rudder
A: 

For some effects rendering to a different surface is required - glass refraction in front of a shader-rendered scene for example. Pixel shaders cannot access the current screen contents and so the view has to be first rendered to a buffer and then used as a texture in the refraction shader pass so that it can take the background colour from a pixel other than the one being calculated.

Dan Brown