読者です 読者をやめる 読者になる 読者になる

WPF に HLSL がやってくる

.NET DirectX Vista

WPF Performance Improvements

.NET 3.5 SP1 includes several significant performance optimizations and improvements to WPF. Some of the specific graphics improvements include:

  • Smoother animations
  • Hardware accelerated rendering of Blur and DropShadow Bitmap Effects
  • Text Rendering speed improvements - especially with VisualBrish and 3D scenes
  • 2D graphics improvements - especially with z-index scenarios
  • A new WriteableBitmap class that enables real-time and tear-free bitmap updates. This enables custom "paint"-style applications, data visualizations, charts and graphs that optionally bypass the default WPF 2D graphics APIs.
  • Layered window performance improvements

SP1 also adds support for better data scalability in WPF. The ListView, ListBox and TreeView controls now support "item container recycling" and "virtualization" support which allows you to easily achieve a 40% performance improvement with scrolling scenarios. These controls also now optionally support a "deferred scrolling" feature which allows you to avoid scrolling in real time and instead wait until a user releases the scroll thumb (the default scrolling mode in Outlook). This can be useful when scrolling over very large data sets quickly.

やっと「GPU の機能を活用」とか言えるようになってきた! 今までの WPF って VRAM が大きいだけの Direct3D RM だったのは公然の秘密だよね!

WPF Extensible Shader Effects

.NET 3.5 SP1 adds support in WPF for a new shader effects architecture and API that allows extremely expressive visual effects to be created and applied to any control or element within WPF. These shader effects support blending multiple input compositions together. What makes them particularly powerful is that WPF executes effects (including custom effects you build yourself) using the GPU - giving you fully hardware accelerated graphics performance. Like almost everything in WPF, you can also use WPF databinding and animation on the properties of an effect (allowing them to be fully integrated into an experience).

HLSL で拡張可能!
HLSL は良い言語だよ!*1 コンパイル時に階乗計算とかできちゃうし! 属性使った宣言型プログラミングもできちゃうもんね! (でも WPF であのすばらしい D3DX Effect System と相互運用できるのかまだちゃんと調べてない) Reactive Programming と Shader はきっとおもしろいよ!マンデルブロ集合も計算できちゃう!
続きは『A Series on GPU-based Effects for WPF - Greg Schechter's Blog』で!
WPF 向け Shader 本のチャンス! (主に今給黎さん?)

WPF Interoperability with Direct3D

.NET 3.5 SP1 adds support to efficiently integrate Direct3D directly into WPF. This gives you more direct access to the hardware and to take full advantage of the Direct3D API within WPF applications. You will be able to treat Direct3D content just like an image within an application, as well as use Direct3D content as textures on WPF controls.

For example, below are three samples from the Direct3D SDK:

We could either load them in as image surfaces within a WPF application, or map them as textures on WPF controls.  Below is an example of mapping them as textures onto cubes in a WPF 3D application:

Note: the Direct3D integration isn't today's SP1 beta release.  It will appear in the final SP1 release.

そして極めつけ. Direct3D WPF 登場時からずっと期待され続けてきていたことがついに実現.
ハードウェア環境もようやく普及期に入った感じですし,いよいよですね.Democratizing the GPU!

追記

川西さんのところにも簡単な紹介が.

頂点シェーダは使えないっぽい(でもまあ Direct3D サーフェイス流し込めるならなんとでも).
あと,Channel 9 のこのムービーも面白いっぽい.

http://mschnlnine.wmod.llnwd.net/a1809/d1/ch9/0/WPF35SP1Graphics_s_ch9.wmv

*1:そういえば HLSL の出自についておもしろい話を MVP Summit かどこかで聞いたような.あれはひげねこさん経由とかだったかなぁ?