#PDC08 talk: WPF pixel shaders and WPF graphics future

.NET, PDC, Technical stuff, Work, WPF
See comments

David Teitlebaum.

Why move to a new effect system? Old effect system: BitmapEffects. Talks about what was done with BitmapEffects to render to the screen. Doesn’t play well with remoting, because too slow to render on target machine, go back to display machine, etc… Shows the old syntax for BitmapEffect. Software rendered, very slow, especially blur operations (such a glow, drop shadow, etc…)

Actions: In SP1, they are marked as obsolete. Implemented HW acceleration for BlurBitmapEffect and DropShadowBitmapEffect (only).

In 4.0: BitmapEffects will be removed. They will act as if no bitmap effect was applied (except for the two mentioned above).

Goal: Use GPU for acceleration (eventually for all effects). MSFT wants to create a system that runs on most video cards. WIll base on PixelShader 2.0 which is supported by most video cards, even on rather cheap laptops.

Shows the new hierarchy. Introduces two built in effects (DropShadow and Blur) and a PixelShaderEffect which is customizable.

Strongly discourage the use of BitmapEffects. The new implementation starts with a clean slate.

Effects can be composed.

Shows a cool demo of multiple effects applied to the output of a webcam, really fast and impressive.

What is a PixelShader?

Small program designed for GPU parallelism, runs once for each destination pixel. Were very hard to write before, close to assembly language, but much better and more standardrized now.

HLSL: High Level Shading Language. There are several versions, WPF supports 2.0 currently.

Shows an example of HLSL code. Very fast because parallelized and optimized for GPU. Vector and Matrix operations.

Explains more details about pixel shaders. Shows multiple code examples, such as removing color channels from a picture.

Now shows how to consume the code in WPF.

Note: you can have only one pixelshader effect per UI element. But you can nest UI elements with each one effect if needed.

Codes demos to display various effects.

Direct3D interop

D3DImage element in WPF. Replaces Hwnd hosting. Note that D3D content is rendered on a separate DX device.

NB: Direct3D cannot consume WPF content directly.

Derives from ImageSource.

Mentions the “gotchas”, for example when screen is locekd, remote desktop, etc, the device can be lost. In that case you got to handle the loss, mentions how. Gives other recommendations.

The last 2 slides are about WPF futures. Mentions that they want to improve the rendering of text (yay).

Webcam treated by PixelShader effect

Previous entry | Next blog entry

Comments for #PDC08 talk: WPF pixel shaders and WPF graphics future