Welcome to Windows Presentation Foundation (WPF)
Top Tasks :

WPF Community Bloggers

Real-Time Cell-Shading in WPF 3D

Of course I couldn't mention a technique of possible real-time cell-shading yesterday without actually trying it out. No, I didn't attempt to derive from BitmapEffect . (I'd love to take a crack at BitmapEffect but I simply cannot justify the expenditure of time.) Instead, I tried the RenderTargetBitmap approach. Here's a rough outline: Lay out your Page or Window normally but instead of defining a Viewport3D element, use a Border instead. The Border is perhaps the simplest FrameworkElement derivative that has a Background property. Give the Background property an object of type ImageBrush . Whatever you would have put into your Viewport3D put into a Viewport3DVisual instead. Set the Viewport property of the Viewport3DVisual to the actual size of the Border element. You'll need a handler for the SizeChanged event of the Border to keep this Viewport property updated when the Border size changes. In that same SizeChanged event handler for the Border , create an object of type RenderTargetBitmap Read More...
Published Thursday, September 06, 2007 12:16 PM by Charles Petzold
Filed under:

Comments

No Comments
Anonymous comments are disabled

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us