Notes how not to fail with WPF performance when you do 3D with it.


I just got asked for some performance recommendations regarding advanced WPF techniques in context of 3D programming with WPF/Xaml.
I remember that I had some notes for it and local research has outputed in below suggestions, feel free to comment:


1) Meterial behavior

Consider various behaviors of the meterial in context of Depth write and blending capacities

2) Transparency

Z order matters and WPF does not do sorting for you If you want to see it clearly as you wanted you have to take care on smart sorting routinue included somewhere.


3) Static camera 


Another thing to remember is not to forget your camera. In WPF moving "camera" means transforming whole scene to fit your criteria.


4) Vertex sharing or duplicating (with normals for lighting)

Sharing is good for spherical objects but can be really bad for cubical objects


5) Antyaliasing


Remember, it's only supported on Vista, don't kill your app only because of that.

6) Texture size limits

Sometimes it's really better to split your texture into smaller chunks and map it accordingly than to use a huge image to map on a single UV metric


7) Model3d vs Visual3D

It's just a design consideration but worth checking the major differences between both above


8) Immediate Mode thinking failure

If you swich from DirectX alike APIs to WPF you risk the very big failure of IMM thinking in your code. Try to use least models count possible (as for objects).
Below is some sample benchmark when IMM fails while WPF's approach wins for an object with 10k triangles within:

IMM | WPF
60 vertexes | 6 vertexes (nodes)
3 FPS | FULL FPS
10k Models | One Model

9) UV coords

WPF doesn't precalculate it. You have to take care on it either be aware of relative and absolute coordinate measures differences

10) Just some general note on coding habits while playing with WPF.



  • Test often and early. Nothing worse than to find a bottleneck at the level of making decision to rewrite everything from the scratch.

  • Be aware of GPU/CPU bottlenecks

  • Know your limits!

Comments (0)

Skip to main content