<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Windows Presentation Foundation-3D Musings</title><link>http://blogs.msdn.com/pantal/default.aspx</link><description /><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How to Draw WPF 3D Wireframe Graphics</title><link>http://blogs.msdn.com/pantal/archive/2008/12/16/how-to-draw-wpf-3d-wireframe-graphics.aspx</link><pubDate>Wed, 17 Dec 2008 02:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9229066</guid><dc:creator>pantal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/pantal/comments/9229066.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=9229066</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;&amp;nbsp;A question I periodically see on forums and discussions with WPF 3D graphics users is, "how do I draw wireframe" content for 3D.&amp;nbsp;This isn't supported out of the box, but&amp;nbsp;couple strategies I would suggest are:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;The out of band 3DTools library from members of the WPF 3D team includes "ScreenSpaceLines" which allows for wireframe rendering of lines. &lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: 'Times New Roman'"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;A href="http://www.codeplex.com/3DTools"&gt;&lt;FONT color=#0000ff&gt;http://www.codeplex.com/3DTools&lt;/FONT&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-fareast-font-family: 'Times New Roman'"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;Charles Petzold has also posted about wireframe rendering with his own implementation.&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;A href="http://www.charlespetzold.com/blog/2007/08/310158.html"&gt;&lt;FONT color=#0000ff&gt;http://www.charlespetzold.com/blog/2007/08/310158.html&lt;/FONT&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9229066" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/pantal/archive/tags/3D/default.aspx">3D</category></item><item><title>Visual Verification Testing Video</title><link>http://blogs.msdn.com/pantal/archive/2008/12/16/visual-verification-testing-video.aspx</link><pubDate>Wed, 17 Dec 2008 02:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9229037</guid><dc:creator>pantal</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/pantal/comments/9229037.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=9229037</wfw:commentRss><description>&lt;P&gt;As some of you may know, the TestApi library includes Visual Verification technologies for testing.&lt;/P&gt;
&lt;P mce_keep="true"&gt;If you are interested in the core patterns of this method of testing, check out this &lt;A class="" href="http://channel9.msdn.com/posts/Charles_Sterling/Graphics-Visual-Verification-with-WPF/" mce_href="http://channel9.msdn.com/posts/Charles_Sterling/Graphics-Visual-Verification-with-WPF/"&gt;video&lt;/A&gt;!&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9229037" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/pantal/archive/tags/TestApi/default.aspx">TestApi</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Visual+Verification/default.aspx">Visual Verification</category></item><item><title>WPF Test API</title><link>http://blogs.msdn.com/pantal/archive/2008/12/09/wpf-test-api.aspx</link><pubDate>Wed, 10 Dec 2008 01:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9188090</guid><dc:creator>pantal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/pantal/comments/9188090.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=9188090</wfw:commentRss><description>&lt;P&gt;I am pleased to announce the the WPF team has embarked to componentize a library of common API's for use by Developers and Testers.&amp;nbsp;This is a complement to the materials on&amp;nbsp;the &lt;A class=externalLink href="http://windowsclient.net/wpf/white-papers/wpf-app-quality-guide.aspx"&gt;WPF Application Quality Guide&lt;SPAN class=externalLinkIcon&gt;&lt;/SPAN&gt;&lt;/A&gt; and the materials available on the &lt;A class=externalLink href="http://blogs.msdn.com/wpftesting"&gt;WPF Testing blog&lt;SPAN class=externalLinkIcon&gt;&lt;/SPAN&gt;&lt;/A&gt;.&amp;nbsp;I encourage you to check it out, and provide feedback or questions.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;The &lt;A class="" title="Test API v0.1 Release Page" href="http://www.codeplex.com/TestApi/Release/ProjectReleases.aspx?ReleaseId=20207" mce_href="http://www.codeplex.com/TestApi/Release/ProjectReleases.aspx?ReleaseId=20207"&gt;Alpha Release&lt;/A&gt; covers:&lt;BR&gt;TestApi v.0.1 provides the following APIs:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Visual Verification&lt;/LI&gt;
&lt;LI&gt;Input Injection&lt;/LI&gt;
&lt;LI&gt;UI Automation Helpers&lt;/LI&gt;
&lt;LI&gt;WPF Dispatcher Helpers&lt;/LI&gt;
&lt;LI&gt;Command-Line Parser &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;BR&gt;The ZIP package contains:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Binaries&lt;/LI&gt;
&lt;LI&gt;Documentation (conceptual documents and API documentation)&lt;/LI&gt;
&lt;LI&gt;Source Code&lt;/LI&gt;
&lt;LI&gt;Samples &lt;BR&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9188090" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/pantal/archive/tags/TestApi/default.aspx">TestApi</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Visual+Verification/default.aspx">Visual Verification</category><category domain="http://blogs.msdn.com/pantal/archive/tags/test/default.aspx">test</category></item><item><title>WPF Application Quality Guide online</title><link>http://blogs.msdn.com/pantal/archive/2008/02/01/wpf-application-quality-guide-online.aspx</link><pubDate>Fri, 01 Feb 2008 04:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7363334</guid><dc:creator>pantal</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/pantal/comments/7363334.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=7363334</wfw:commentRss><description>Give it a &lt;A class="" href="http://windowsclient.net/wpf/white-papers/wpf-app-quality-guide.aspx" mce_href="http://windowsclient.net/wpf/white-papers/wpf-app-quality-guide.aspx"&gt;look &lt;/A&gt;on &lt;A class="" href="http://windowsclient.net/" mce_href="http://windowsclient.net"&gt;WindowsClient.Net&lt;/A&gt;. &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7363334" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category></item><item><title>XAML 3D Tools &amp; Tech</title><link>http://blogs.msdn.com/pantal/archive/2008/01/17/xaml-3d-tools-tech.aspx</link><pubDate>Thu, 17 Jan 2008 04:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7138675</guid><dc:creator>pantal</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/pantal/comments/7138675.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=7138675</wfw:commentRss><description>&lt;P&gt;I periodically run into queries&amp;nbsp;for &amp;nbsp;tools for modelling 3D content for use with XAML. Here are some notable resources to consider:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;A class="" href="http://codeplex.com/xamlexporter" mce_href="http://codeplex.com/xamlexporter"&gt;Xaml Exporter for Blender&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://www.erain.com/Products/ZAM3D/" mce_href="http://www.erain.com/Products/ZAM3D/"&gt;Zam3D Modeller&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://www.highend3d.com/maya/downloads/tools/3d_converters/3782.html" mce_href="http://www.highend3d.com/maya/downloads/tools/3d_converters/3782.html"&gt;Maya to XAML converter&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://www.wpf-graphics.com/Viewer3ds.aspx" mce_href="http://www.wpf-graphics.com/Viewer3ds.aspx"&gt;Viewer 3DS &lt;/A&gt;3DS to XAML Converter&lt;/LI&gt;
&lt;LI&gt;OBJ to XAML support in &lt;A class="" href="http://www.microsoft.com/expression/" mce_href="http://www.microsoft.com/expression/"&gt;Expression Blend&lt;/A&gt;&amp;nbsp;(&lt;A class="" href="http://blogs.msdn.com/expression/archive/2007/12/18/mini-cube-ready-for-developers-can-you-finish-it.aspx" mce_href="http://blogs.msdn.com/expression/archive/2007/12/18/mini-cube-ready-for-developers-can-you-finish-it.aspx"&gt;Mini Cube&lt;/A&gt; Walkthrough)&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;In addition, there are a number of libraries for generating 3D primitive content such as planes, spheres, cubes, etc in circulation on various community sites.&amp;nbsp;Creating a 3D content library is a good way to test your knowledge of 3D, but if re-inventing the wheel isn't your thing,&amp;nbsp;Charles Petzold has scoped out some quality content in this space:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;MSDN &lt;A class="" href="http://msdn.microsoft.com/msdnmag/issues/07/10/Foundations/default.aspx" mce_href="http://msdn.microsoft.com/msdnmag/issues/07/10/Foundations/default.aspx"&gt;3D Text Tutorial&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://www.charlespetzold.com/3D/" mce_href="http://www.charlespetzold.com/3D/"&gt;Petzold.Media3D&lt;/A&gt;&amp;nbsp;library complementing his WPF 3D book&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;I would recommend getting conversant with using both modelling tools and generating content via code. Some cursory considerations to ponder when considering how to represent 3D content:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Ease of Representation -&amp;nbsp;If you&amp;nbsp;want to&amp;nbsp;represent a bunch of cubes/spheres with different textures in each case, you'd probably be crazy to try&amp;nbsp;create and texture those separately in a modelling tool.&amp;nbsp;Likewise, representing shapes from the naturual world, like&amp;nbsp;animals, from primitive 3D shapes could quickly get to be painful.&lt;/LI&gt;
&lt;LI&gt;Binary/Data file size - For instance,&amp;nbsp;a high resolution sphere can be represented on disk much more cheaply with the algorithm, than the corresponding mesh.&lt;/LI&gt;
&lt;LI&gt;Load time - Trade-off of disk time vs potentially non-trivial generating algorithms&lt;/LI&gt;
&lt;LI&gt;Texturing - Which approach allows you to texture your content satisfactorily - Can you&amp;nbsp;represent multiple material "layers" in an effective way,&amp;nbsp;do you want to utilize techniques such as level of detail rendering, etc... Specialized 3D tools are targeted to the work of "skinnning" the texture coordinates complex models.&lt;/LI&gt;
&lt;LI&gt;Flexibility - For instance, if you want to do techniques such as "Level of Detail" rendering, a generated content approach can provide you more flexibility than modelled content. Modellers/Artists *love* it when you ask them to turn their 300k poly masterpiece into 80 triangles. This usually translates to running mesh simplification tools on existing models, or just hack out some workflow tool to perform that work in batches, followed by some fine tuning at the end. In this context, generating the appropriate mesh complexity at run time is preferable to at design time.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;I'm happy to hear from customers working on their WPF apps! Let me know if you have any questions, feedback or comments. Thanks!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7138675" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/pantal/archive/tags/3D/default.aspx">3D</category><category domain="http://blogs.msdn.com/pantal/archive/tags/XAML/default.aspx">XAML</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Modeller/default.aspx">Modeller</category></item><item><title>Handy WPF 3D samples</title><link>http://blogs.msdn.com/pantal/archive/2008/01/03/handy-wpf-3d-samples.aspx</link><pubDate>Thu, 03 Jan 2008 23:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6971592</guid><dc:creator>pantal</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/pantal/comments/6971592.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=6971592</wfw:commentRss><description>&lt;P&gt;An independent&amp;nbsp;dev over in germany prepared some nice WPF 3D tutorials which I thought some folks might find interesting:&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://www.codegod.de/WebAppCodeGod/viewport3d-in-wpf-xbap-application-AID438.aspx" mce_href="http://www.codegod.de/WebAppCodeGod/viewport3d-in-wpf-xbap-application-AID438.aspx"&gt;Viewport3D in XBAP&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://www.codegod.de/WebAppCodeGod/render-3ds-3d-models-with-wpf-and-xaml-AID433.aspx" mce_href="http://www.codegod.de/WebAppCodeGod/render-3ds-3d-models-with-wpf-and-xaml-AID433.aspx"&gt;Rendering 3D Studio Models With WPF&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://www.codegod.de/WebAppCodeGod/wpf-3d-animations-and-textures-AID439.aspx" mce_href="http://www.codegod.de/WebAppCodeGod/wpf-3d-animations-and-textures-AID439.aspx"&gt;Storyboard/Input based animation&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;All his WPF articles are posted at this &lt;A class="" href="http://www.codegod.de/WebAppCodeGod/TheArticles.aspx" mce_href="http://www.codegod.de/WebAppCodeGod/TheArticles.aspx"&gt;location&lt;/A&gt;.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;In addition theWPFBlog has shared a &lt;A class="" href="http://thewpfblog.com/?p=31" mce_href="http://thewpfblog.com/?p=31"&gt;3D carousel sample&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6971592" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF+3D+Tutorials/default.aspx">WPF 3D Tutorials</category></item><item><title>UIElement3D extensibility - 3D Video Carousel</title><link>http://blogs.msdn.com/pantal/archive/2007/08/22/uielement3d-extensibility-dvd-keep-case-player-cylindrical-carousel-layout.aspx</link><pubDate>Wed, 22 Aug 2007 05:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4503093</guid><dc:creator>pantal</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/pantal/comments/4503093.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=4503093</wfw:commentRss><description>&lt;P&gt;Recently I've been working on a screencast, which goes over some advanced aspects of working with Element3D. In the meantime, this sample demonstrates WPF's Orcas Beta 2 UIElement 3D technology, covering the essentials for how you can make your own reusable UIElement3D controls for 3D. I have two in here: &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;A&amp;nbsp;"KeepCaseUIElement3D", a&amp;nbsp;representation of a real world DVD case,&amp;nbsp;with the added twist of&amp;nbsp;playing video on the inside. It's&amp;nbsp;API consumes Uri's for cover images and a media source, rather than traditional models, meshes, and materials in 3D&amp;nbsp;.&lt;/LI&gt;
&lt;LI&gt;A "MovieCarousel" - a simple 3D carousel layout control which re-orients itself to position the object which was last clicked towards the user.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;You will need to operate with the WPF V3.5(Orcas) Beta 2 Bits. You can get the Visual Studio Orcas Beta 2&amp;nbsp;installation with WPF from &lt;A class="" href="http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx" mce_href="http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;IMG title="A set of streaming WPF tutorial Videos " style="WIDTH: 600px; HEIGHT: 500px" height=500 alt="A set of streaming WPF tutorial Videos " src="http://blogs.msdn.com/photos/pantal/images/4502918/original.aspx" width=600 mce_src="http://blogs.msdn.com/photos/pantal/images/4502918/original.aspx"&gt;&lt;/P&gt;
&lt;P&gt;Concepts you&amp;nbsp;can see in practice with this sample include:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Creating interactive 3D controls as interactive containers on non-interactive 3D models (Hint - Leverage existing 3D Xaml with little effort)&lt;/LI&gt;
&lt;LI&gt;Creating a Custom Visual3D container type&lt;/LI&gt;
&lt;LI&gt;Use of StaticResources from Application.Resources to separate mesh details from overall structure&lt;/LI&gt;
&lt;LI&gt;Databinding a mesh texture to consume a local DP exposed as a URI, via a data binding type converter&lt;/LI&gt;
&lt;LI&gt;3D Layout - Cylinder Layout Helper class&lt;/LI&gt;
&lt;LI&gt;Playing Video as a material on 3D&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;If you have any questions on the details of this sample, feel free to send me a message, or leave a relevant comment- odds are fair other folks have similar questions, which could make for interesting future blog postings! &lt;/P&gt;
&lt;P&gt;&amp;nbsp;Thanks!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4503093" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/pantal/attachment/4503093.ashx" length="644001" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/pantal/archive/tags/UIElement3D/default.aspx">UIElement3D</category><category domain="http://blogs.msdn.com/pantal/archive/tags/3D/default.aspx">3D</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Orcas/default.aspx">Orcas</category><category domain="http://blogs.msdn.com/pantal/archive/tags/V3.5/default.aspx">V3.5</category><category domain="http://blogs.msdn.com/pantal/archive/tags/3D+Layout/default.aspx">3D Layout</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Video+on+3D/default.aspx">Video on 3D</category></item><item><title>Details on the 3D Earth Rendering Sample</title><link>http://blogs.msdn.com/pantal/archive/2007/08/03/details-on-the-3d-earth-rendering-sample.aspx</link><pubDate>Fri, 03 Aug 2007 04:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4197228</guid><dc:creator>pantal</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/pantal/comments/4197228.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=4197228</wfw:commentRss><description>&lt;P&gt;Yesterday I posted a some &lt;A class="" href="http://blogs.msdn.com/pantal/archive/2007/08/02/combined-materials-for-interesting-3d-planet-renderings-in-wpf.aspx" mce_href="http://blogs.msdn.com/pantal/archive/2007/08/02/combined-materials-for-interesting-3d-planet-renderings-in-wpf.aspx"&gt;screenshots&lt;/A&gt; of a 3D earth sample involving a mix of materials to achieve interesting visual effects. &lt;/P&gt;
&lt;P&gt;Attached is the sample application(Requires&amp;nbsp;V3.5 to run), and the essential core source code, which can be placed in a new WPF project, in conjunction with a set of suitable textures. It is built to run on WPF V3.5 as it incorporates the new ContainerUIElement3D type, to allow for interactivity over the 3D content such as ModelVisual3D objects. This provides a good opportunity to get a practical understanding of WPF's Material types(described in detail on the post linked &lt;A class="" href="http://blogs.msdn.com/wpf3d/archive/2007/03/08/material-behavior.aspx" mce_href="http://blogs.msdn.com/wpf3d/archive/2007/03/08/material-behavior.aspx"&gt;here&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;This&amp;nbsp;scene was built from a set of 5 images:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Cloud map image with alpha channel or&amp;nbsp;a Cloud Opacity map applied onto the OpacityMask&lt;/LI&gt;
&lt;LI&gt;Earth daytime map &lt;/LI&gt;
&lt;LI&gt;Earth nighttime map &lt;/LI&gt;
&lt;LI&gt;Earth Specular map&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;The Geometry as you may expect was composed of a pair of spheres centered on the same point. The inner sphere model is used for the earth's surface, and has:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A daytime map applied on a diffuse material. This image&amp;nbsp;is set&amp;nbsp;to full opacity, so no blending of objects behind it will occur, and it will be softly illuminated by external lighting.&lt;/LI&gt;
&lt;LI&gt;The nighttime map is applied on an emissive material. This material has an additive effect where it is rendered, with lighting having no impact(emissive materials render at full intensity). To cut the lighting out of the daytime surface, a moving OpacityMask can be applied.&lt;/LI&gt;
&lt;LI&gt;A map of the earth's watery, reflective surfaces applied using a specular material. Specular materials, like emissive materials have an additive rendering effect, providing bright highlights on the ocean surfaces, while having no contribution over land.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;The Cloud Model uses the same geometry as the earth, with a minor scale transform applied to make&amp;nbsp;the clouds slightly&amp;nbsp;extend beyond the radius of the earth. The clouds are rendered as a Diffuse Material, with the clouds applied.&amp;nbsp;When used with the opacity mask, this produces&amp;nbsp;a mixed&amp;nbsp;effect of fully obscured cloud regions and fully transparent areas.&amp;nbsp;This effect could be carried further with a series of low opacity, blueish diffuse materials to represent the Earth's atmosphere. &lt;/P&gt;
&lt;P&gt;Finally, I placed these two models within a ContainerUIElement3D, applied an animated Rotation Transform to represent the Earth's daily spin. You may have heard - with UIElement behavior on 3D, we can now easily develop 3D UI behaviors, without worrying about hit testing and eventing plumbing. Here, I connected mouse event handlers&amp;nbsp;from XAML and prepared corresponding 3D behavior in response to the events.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4197228" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/pantal/attachment/4197228.ashx" length="1526000" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/pantal/archive/tags/3D/default.aspx">3D</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Materials/default.aspx">Materials</category><category domain="http://blogs.msdn.com/pantal/archive/tags/ContainerUIElement3D/default.aspx">ContainerUIElement3D</category></item><item><title>Combined materials for Interesting 3D Planet renderings in WPF</title><link>http://blogs.msdn.com/pantal/archive/2007/08/02/combined-materials-for-interesting-3d-planet-renderings-in-wpf.aspx</link><pubDate>Thu, 02 Aug 2007 07:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4182483</guid><dc:creator>pantal</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/pantal/comments/4182483.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=4182483</wfw:commentRss><description>&lt;P&gt;I have been doing experiments with the&amp;nbsp;materials we provide with WPF to render an interesting facsimile of the surface of the earth. Using a collection from &lt;A href="http://planetpixelemporium.com/earth.html"&gt;http://planetpixelemporium.com/earth.html&lt;/A&gt;, I was able to achieve some nice visual effects:&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/photos/pantal/images/4182404/original.aspx" mce_href="http://blogs.msdn.com/photos/pantal/images/4182404/original.aspx"&gt;&lt;IMG style="WIDTH: 320px; HEIGHT: 230px" height=230 src="http://blogs.msdn.com/photos/pantal/images/4182404/original.aspx" width=320 mce_src="http://blogs.msdn.com/photos/pantal/images/4182404/original.aspx"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/photos/pantal/images/4182406/original.aspx" mce_href="http://blogs.msdn.com/photos/pantal/images/4182406/original.aspx"&gt;&lt;IMG style="WIDTH: 320px; HEIGHT: 230px" height=230 src="http://blogs.msdn.com/photos/pantal/images/4182406/original.aspx" width=320 mce_src="http://blogs.msdn.com/photos/pantal/images/4182406/original.aspx"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/photos/pantal/images/4182409/original.aspx" mce_href="http://blogs.msdn.com/photos/pantal/images/4182409/original.aspx"&gt;&lt;IMG style="WIDTH: 320px; HEIGHT: 230px" height=230 src="http://blogs.msdn.com/photos/pantal/images/4182409/original.aspx" width=320 mce_src="http://blogs.msdn.com/photos/pantal/images/4182409/original.aspx"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Demo and source is available at this &lt;A class="" href="http://blogs.msdn.com/pantal/archive/2007/08/03/details-on-the-3d-earth-rendering-sample.aspx" mce_href="http://blogs.msdn.com/pantal/archive/2007/08/03/details-on-the-3d-earth-rendering-sample.aspx"&gt;post&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4182483" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/pantal/archive/tags/3D/default.aspx">3D</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Materials/default.aspx">Materials</category></item><item><title>WPF V3.5 Beta 2 - Goodies in 3D-land!</title><link>http://blogs.msdn.com/pantal/archive/2007/07/31/wpf-v3-5-beta-2-goodies-in-3d-land.aspx</link><pubDate>Tue, 31 Jul 2007 04:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4139915</guid><dc:creator>pantal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/pantal/comments/4139915.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=4139915</wfw:commentRss><description>&lt;P&gt;Kurt recently put out an overview on&amp;nbsp;the V3.5 &lt;A class="" href="http://blogs.msdn.com/wpf3d/archive/2007/07/30/what-s-new-in-wpf-3-5.aspx" mce_href="http://blogs.msdn.com/wpf3d/archive/2007/07/30/what-s-new-in-wpf-3-5.aspx"&gt;interactive 3D feature additions&lt;/A&gt;&amp;nbsp;(UIElement3D types and Viewport2DVisual3D) which are available in the new &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=D2F74873-C796-4E60-91C8-F0EF809B09EE&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyId=D2F74873-C796-4E60-91C8-F0EF809B09EE&amp;amp;displaylang=en"&gt;WPF V3.5 Beta 2&lt;/A&gt;. Give it a look!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4139915" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Viewport2DVisual3D/default.aspx">Viewport2DVisual3D</category><category domain="http://blogs.msdn.com/pantal/archive/tags/UIElement3D/default.aspx">UIElement3D</category><category domain="http://blogs.msdn.com/pantal/archive/tags/3D/default.aspx">3D</category><category domain="http://blogs.msdn.com/pantal/archive/tags/3.5/default.aspx">3.5</category></item><item><title>WPF input Interop over DirectX Airspace</title><link>http://blogs.msdn.com/pantal/archive/2007/07/31/managed-directx-interop-with-wpf-part-2.aspx</link><pubDate>Tue, 31 Jul 2007 03:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4139454</guid><dc:creator>pantal</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/pantal/comments/4139454.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=4139454</wfw:commentRss><description>&lt;P&gt;I've seen that the Airspace regions constraints have been a concern for some folks interested in using DirectX with their WPF applications. Based on this, here is a follow-up to&amp;nbsp;an earlier sample I posted, this time using Layered windows to intercept input, allowing for the provision of rich WPF context menus, tooltips, and traditional mouse actions over the airspace of an interop region. It is pretty much the same as before, with one major change - the introduction of an "AirspaceOverlay" decorator. &lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://blogs.msdn.com/photos/pantal/images/4139461/original.aspx" mce_src="http://blogs.msdn.com/photos/pantal/images/4139461/original.aspx"&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;This decorator wraps around your interop content, and accepts an "OverlayChild" which is presented in a layered window over the content in the AirspaceOverlay control. In the example below, I used a canvas with a tooltip and some code-behind to also demonstrate a context menu. Here's a code snippet of the usage:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;MDXControl:AirspaceOverlay&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;MDXControl:AirspaceOverlay.OverlayChild&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Canvas&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ToolTip&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; = &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;A tooltip over a DirectX surface&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;Background&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;#01000000&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;Overlay&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;MDXControl:AirspaceOverlay.OverlayChild&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;!--Your Non-WPF Airspace Interop content goes here--&amp;gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;MDXControl:AirspaceOverlay&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Known considerations:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Embedding of&amp;nbsp;AirspaceOverlay&amp;nbsp;in a Viewbox - due to region sizing issues, overlay placeent does not work correctly.&lt;/LI&gt;
&lt;LI&gt;Hit testing within the transparent window will not occur on fully transparent regions, but will continue to propagate down to the interop surface.&amp;nbsp;On the flip side, partially opaque regions will intercept input, preventing it from being recieved on the interop layer.&amp;nbsp;This input handling behavior can be tweaked from the Win32 API's.&lt;/LI&gt;
&lt;LI&gt;Focus will by default switch between the parent and layered child window. I return focus on mouse behavior to the parent in this implementation.&lt;/LI&gt;
&lt;LI&gt;This sample is targeted to rectangular regions. By applying a custom shape consistent with the region below, irregular airspace regions can be overlaid with little additional effort.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;I hope this helps some food for thought for folks looking at similar interop scenarios. Ok, have fun with the code, and feel free to send in questions.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4139454" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/pantal/attachment/4139454.ashx" length="68930" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/pantal/archive/tags/DirectX/default.aspx">DirectX</category><category domain="http://blogs.msdn.com/pantal/archive/tags/3D/default.aspx">3D</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Airspaces/default.aspx">Airspaces</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Interop/default.aspx">Interop</category></item><item><title>WPF 3D Transparency Depth-Order Sorting</title><link>http://blogs.msdn.com/pantal/archive/2007/07/23/sorting-for-wpf-3d-transparency.aspx</link><pubDate>Tue, 24 Jul 2007 01:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4018612</guid><dc:creator>pantal</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/pantal/comments/4018612.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=4018612</wfw:commentRss><description>&lt;P mce_keep="true"&gt;Just a quick post here - When making WPF 3D apps, transparency can make for some powerful visual effects. The trouble is that any re-orientation of your scene or the camera will ruin the rendering order of your transparent content to obscure content which should be visible under a transparent surface. Below, we have a little carousel of partially transparent photos rendered on DiffuseMaterials. As per the &lt;A class="" href="http://blogs.msdn.com/wpf3d/archive/2007/03/08/material-behavior.aspx" mce_href="http://blogs.msdn.com/wpf3d/archive/2007/03/08/material-behavior.aspx"&gt;rendering rules with DiffuseMaterials&lt;/A&gt;, only content which is closer to the camera will be rendered. The area highlighted in red is being rendered prematurely, which obscures the background content from being rendered at all.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG title="Unsorted Scene" style="WIDTH: 473px; HEIGHT: 145px" height=145 alt="Unsorted Scene" src="http://blogs.msdn.com/photos/pantal/images/4019022/original.aspx" width=473 mce_src="http://blogs.msdn.com/photos/pantal/images/4019022/original.aspx"&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;To get over this issue with transparency, we must re-order the sequence of transparent content rendering, such that we progressively go from content most distant to the camera, to content in closest proximity.&lt;/P&gt;
&lt;P mce_keep="true"&gt;To deal with this, I created a simple helper to handle sorting of models to sort in order of distance to camera. Below, we have the helper method interface - it takes the camera position, a collection of models and a World transform to offset the models by(This would be all of the accumulated parent transforms, except for the transforms on the Models themselves), and sorts&amp;nbsp;this collection of Models in order of distance to the camera. Here's the API from the attached Code, followed by a carousel of depth sorted images:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;public static void AlphaSort(Point3D CameraPosition, Model3DCollection Models, Transform3D WorldTransform)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://blogs.msdn.com/photos/pantal/images/4019019/original.aspx" mce_src="http://blogs.msdn.com/photos/pantal/images/4019019/original.aspx"&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Some performance considerations with Depth-Order Sorting favoring transparency:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;Limit the scope of models to be sorted to as small a set as possible. Two reasons exist for this. The first is that additional models will require a&amp;nbsp;linearithmic&amp;nbsp;growth of sort time - the CLR Array.Sort algorithm&amp;nbsp;employed with the&amp;nbsp;attached solution&amp;nbsp;operates&amp;nbsp;with an average complexity of O(n log n) and a worst case of O(n^2). The second issue is about GPU fill rate - by sorting in favour of distant objects, we are maximizing the number pixels to render to screen(We get no&amp;nbsp;hardware culling benefits, because everything is in front of what we have rendered so far).&amp;nbsp;On the flip side, if you have a&amp;nbsp; complex scene with lots of opaque, overlapping content, sorting in favour of objects closest to the camera could potentially&amp;nbsp;get you an improved framerate, if sorting is infrequent. &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;Frequency of sorting - With any kind of scene, the supplied sorting operation is not a cheap call to use&amp;nbsp;for real time rendering. As such, I would caution against using this algorithm via CompositionTarget.Rendering.&amp;nbsp;Instead, you may want to give some thought about an invalidation threshold based sorting mechanism. With a 3D arrangement like a carousel, you can work out&amp;nbsp;a safe "interval" of change, within which the content can move, without requiring a re-sort.&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P mce_keep="true"&gt;This sample is just intended as a quick starting point for folks who want to get some depth sorting on their transparent content. It is not tailored to target 3D tree-walking, and most folks can find optimizations for sorting based on domain specific assumptions about their application in terms of graph representation, caching, and all the other common tricks at an application developer's disposal.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4018612" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/pantal/attachment/4018612.ashx" length="2251" type="text/plain" /><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/pantal/archive/tags/3D/default.aspx">3D</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Transparency/default.aspx">Transparency</category></item><item><title>Resources for getting into WPF 3D</title><link>http://blogs.msdn.com/pantal/archive/2007/06/29/resources-for-getting-into-3d.aspx</link><pubDate>Fri, 29 Jun 2007 03:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3595060</guid><dc:creator>pantal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/pantal/comments/3595060.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=3595060</wfw:commentRss><description>&lt;P&gt;Periodically,&amp;nbsp;I need to refer folks to good resources for ramping up on WPF 3D functionality. Here are the ones I commonly refer to:&lt;/P&gt;
&lt;P mce_keep="true"&gt;Mike Hodnick has a great, succinct&amp;nbsp;&lt;A class="" href="http://www.kindohm.com/technical/WPF3DTutorial.htm" mce_href="http://www.kindohm.com/technical/WPF3DTutorial.htm"&gt;WPF 3D tutorial&lt;/A&gt;, which is an excellent resource to get up and running with the technology. If there is any one tutorial to try- I would say go there.&lt;/P&gt;
&lt;P&gt;Charles Petzold has helped countless Windows UI developers ramp up on the technologies - his 3D book blog&amp;nbsp;has a lot of good insights for developers, without making heavy assumptions about a reader's 3D theory knowledge as other resources sometimes do.&amp;nbsp;He has a lot of interesting nuggets on his &lt;A class="" href="http://wpf.netfx3.com/blogs/wpf_community_bloggers/archive/tags/3D+Book/default.aspx" mce_href="http://wpf.netfx3.com/blogs/wpf_community_bloggers/archive/tags/3D+Book/default.aspx"&gt;3D book blog&lt;/A&gt;, often demonstrating the power of XAML, as well as a 3D samples &lt;A class="" href="http://www.charlespetzold.com/3D/index.html" mce_href="http://www.charlespetzold.com/3D/index.html"&gt;page&lt;/A&gt;. As&amp;nbsp;he is a&amp;nbsp;frequent contributor to MSDN magazine, I periodically&amp;nbsp;encounter his articles introducing users to technology like the &lt;A class="" href="http://msdn.microsoft.com/msdnmag/issues/07/04/Foundations/default.aspx" mce_href="http://msdn.microsoft.com/msdnmag/issues/07/04/Foundations/default.aspx"&gt;MeshGeometry3D&lt;/A&gt; type which can be quite helpful.&lt;/P&gt;
&lt;P&gt;The &lt;A class="" href="http://blogs.msdn.com/wpf3d/" mce_href="http://blogs.msdn.com/wpf3d/"&gt;3D Team&lt;/A&gt; blog and &lt;A class="" href="http://blogs.msdn.com/danlehen/" mce_href="http://blogs.msdn.com/danlehen/"&gt;Daniel Lehenbauer's blog&lt;/A&gt;&amp;nbsp;are more topical resources, with references to a lot of cool new applications, or addressing common questions.&lt;/P&gt;
&lt;P&gt;The &lt;A class="" href="http://www.codeplex.com/3DTools" mce_href="http://www.codeplex.com/3DTools"&gt;3D tools&lt;/A&gt; package isn't a tutorial per-se, but a library of goodies for use with WPF, by the 3D team. Any serious WPF 3D developer should be aware&amp;nbsp;of the cool&amp;nbsp;offerings in this&amp;nbsp;package.&lt;/P&gt;
&lt;P&gt;Depending on your application domain, you may want to see this "casual" game developer's tutorial for WPF3D - "&lt;A class="" href="http://www.dmu.com/link1.html" mce_href="http://www.dmu.com/link1.html"&gt;Creating 3D Webgames using ATMO NQAL 2.0"&lt;/A&gt;. The tilt on this series of tutorials is quite distinctive, and delves into quite a bit of application details. Definitely different from your typical WPF/3D tutorial :)&lt;/P&gt;
&lt;P&gt;Books:&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://www.amazon.com/Windows-Presentation-Foundation-Unleashed-WPF/dp/0672328917" mce_href="http://www.amazon.com/Windows-Presentation-Foundation-Unleashed-WPF/dp/0672328917"&gt;WPF Unleashed&lt;/A&gt;&amp;nbsp;- Adam Nathan brought in Daniel Lehenbauer&amp;nbsp;(3D dev team lead for V1 WPF) to prepare the 3D chapter in this title. An excellent ramp up to 3D.&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://www.amazon.com/3D-Programming-Windows-Pro-Developer/dp/0735623945" mce_href="http://www.amazon.com/3D-Programming-Windows-Pro-Developer/dp/0735623945"&gt;3D Programming for Windows &lt;/A&gt;- Charles Petzold's new book on WPF 3D&amp;nbsp;is now available. I haven't had a chance to get my hands on this one yet, but based on his blog and prior writings, you can expect a detailed coverage of the subject.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3595060" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/pantal/archive/tags/3D/default.aspx">3D</category></item><item><title>WPF - Designing Canvas based 2D Controls</title><link>http://blogs.msdn.com/pantal/archive/2007/06/06/designing-canvas-based-2d-controls-for-3d-use.aspx</link><pubDate>Wed, 06 Jun 2007 04:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3107833</guid><dc:creator>pantal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/pantal/comments/3107833.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=3107833</wfw:commentRss><description>&lt;P&gt;I have been playing with Expression Design a little bit, and am quite excited about the designability options it allows. It's really sweet how quickly one can create vector content in it, which can be turned into interactive controls, with&amp;nbsp;shared&amp;nbsp;code-based behaviors attached to each shape. One process I have been exploring is the ideal way to modify my content as I go along, as I tweak graphics in iterations.&lt;/P&gt;
&lt;P&gt;My favourite approach thus far is to export Designer content as a ResourceDictionary, which can be&amp;nbsp;loaded(or potentially&amp;nbsp;reload without compilation)&amp;nbsp;on the fly, without having to make any changes to the xaml exported by Expression. This means you can painlessly tune 2D designs, export them and they just load up, without any supporting code changes needed once&amp;nbsp;the pipeline is in place.&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Here's how I go at it:&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp;&amp;nbsp; Create shapes, and give each shape object a distinctive name. Sorry about the lame programmer art.&lt;/P&gt;
&lt;P&gt;&lt;IMG title="Expression Designer with Objects" style="WIDTH: 425px; HEIGHT: 266px" height=266 alt="Expression Designer with Objects" src="http://blogs.msdn.com/photos/pantal/images/3108180/425x266.aspx" width=425 mce_src="http://blogs.msdn.com/photos/pantal/images/3108180/425x266.aspx"&gt;&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp;&amp;nbsp; Export XAML to Resource Dictionary Form. Group by Objects, Path output type as drawing brush.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="http://blogs.msdn.com/photos/pantal/images/3108496/original.aspx" mce_src="http://blogs.msdn.com/photos/pantal/images/3108496/original.aspx"&gt;&lt;/P&gt;
&lt;P&gt;3.&amp;nbsp;&amp;nbsp; Reference the Resource Dictionary, and populate each each object into your control by iterating through the dictionary. For flexible, custom layout, I prefer to extract the geometries for use as Paths in a Canvas, and prepare a User control out of that. You may prefer to recieve your content in a more general form, ie - directly as a drawingbrush. Below is&amp;nbsp;the sample app using the canvas with the loaded dictionary content, along with textboxes overlayed with the object names, and mouseover-driven bitmap effects. The source code for use in a standard WPF project is attached.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG src="http://blogs.msdn.com/photos/pantal/images/3108182/original.aspx" mce_src="http://blogs.msdn.com/photos/pantal/images/3108182/original.aspx"&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;4.&amp;nbsp;&amp;nbsp; For extra credit,&amp;nbsp;we apply that canvas onto an interactive 3D surface as per the &lt;A class="" href="http://www.codeplex.com/3DTools" mce_href="http://www.codeplex.com/3DTools"&gt;Codeplex WPF 3D Tools&lt;/A&gt; bits. And here, life gets interesting, as we can have interactive 2D content on a 3D surface, which we can change on the fly in Expression Designer!&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG src="http://blogs.msdn.com/photos/pantal/images/3108489/original.aspx" mce_src="http://blogs.msdn.com/photos/pantal/images/3108489/original.aspx"&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Essential Details from attached code:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;//Load the Resource from your exported xaml - Your uri path will differ&lt;BR&gt;Resources.Source = new Uri("pack://application:,,,/CanvasControl;component/ResourceSet.xaml");&lt;BR&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;...&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Here I produce a canvas&amp;nbsp;generated from our exported resource&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private Canvas MakeCanvas()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Canvas c=new Canvas();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //You can extract the bounds of the individual elements, or operate with a fixed size here&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c.Width = 443;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c.Height = 355;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (DictionaryEntry de in Resources)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DrawingBrush db = (de.Value as DrawingBrush);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (db != null)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DrawingGroup dg = (db.Drawing as DrawingGroup);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (dg != null)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GeometryDrawing gd = (dg.Children[0] as GeometryDrawing);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (gd != null)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Path path = new Path();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path.Name = (string)de.Key;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Directly assign the pertinent properties of interest&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path.Data = gd.Geometry;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path.Stroke = gd.Pen.Brush;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path.StrokeThickness = gd.Pen.Thickness;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; path.Fill = gd.Brush;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c.Children.Add(path);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return c;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3107833" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/pantal/attachment/3107833.ashx" length="4013" type="text/plain" /><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/pantal/archive/tags/2D+on+3D/default.aspx">2D on 3D</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Canvas/default.aspx">Canvas</category></item><item><title>Premiere Post! WPF w/ Direct3D Shader Interop and simple databinding</title><link>http://blogs.msdn.com/pantal/archive/2007/03/29/premiere-post-wpf-direct3d-interop.aspx</link><pubDate>Thu, 29 Mar 2007 06:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1983526</guid><dc:creator>pantal</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/pantal/comments/1983526.aspx</comments><wfw:commentRss>http://blogs.msdn.com/pantal/commentrss.aspx?PostID=1983526</wfw:commentRss><description>&lt;P&gt;Based on some questions I’ve seen on the forums, with regards to WPF on the issue of Shader use and technologies, I have decided to prepare a sample which illustrates one approach by which DirectX content can be embedded in a WPF app.&amp;nbsp;In particular, I render a single Managed DirectX surface containing a&amp;nbsp;simple mesh rendered with shaders,&amp;nbsp;&amp;nbsp;in a control embedded in a WPF app, and databound to a set of sliders to manipulate a color shift implemented via a pixel shader. This form can be helpful for teams that want to incorporate WPF as the overall UI technology(in place of GDI,&amp;nbsp;MFC, winforms, etc)&amp;nbsp;of their 3D heavy applications, for which a fair bit of DirectX code is often present.&lt;/P&gt;
&lt;P&gt;In this example, I used Managed DirectX API for primary language consistency&amp;nbsp;in this sample, but the HwndHost technology for interop can similarly be used to embed unmanaged DX 9/10. For this overview, I assume an working knowledge of Direct3D, in conjunction with some familiarity with WPF.&lt;/P&gt;
&lt;P&gt;&lt;A class=imagelink title=Screenshot.jpg href="http://www.recursim.com/wp-content/uploads/2007/03/Screenshot.jpg" mce_href="http://www.recursim.com/wp-content/uploads/2007/03/Screenshot.jpg"&gt;&lt;IMG id=image743 height=96 alt=Screenshot.jpg src="http://www.recursim.com/wp-content/uploads/2007/03/Screenshot.thumbnail.jpg" mce_src="http://www.recursim.com/wp-content/uploads/2007/03/Screenshot.thumbnail.jpg"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1-The application references&amp;nbsp;a custom control containing the Manged DX Device in the XAML layout(For non XAML junkies, keep in mind, this can just as easily be done in code):&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Custom Namespaces:&lt;BR&gt;&lt;FONT color=#ff0000 size=2&gt;&amp;nbsp; xmlns:local&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt;“&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;clr-namespace:WPF_MDX_Interop_App&lt;/FONT&gt;&lt;FONT size=2&gt;“&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;&amp;nbsp; xmlns:MDXControl&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt;“&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;clr-namespace:WpfNuggets.ManagedDirectX;assembly=WpfNuggets.ManagedDirectX&lt;/FONT&gt;&lt;FONT size=2&gt;“&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;…&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt; &lt;FONT color=#800000 size=2&gt;MDXControl:ManagedDirectXControl&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;MDXControl:ManagedDirectXControl.RenderContent&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt; &amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;local:AdjustableShader&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;x:Name&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt;“&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;AdjustableShader&lt;/FONT&gt;&lt;FONT size=2&gt;“&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;TextureFilename&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt;“&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Content\gradient1.bmp&lt;/FONT&gt;&lt;FONT size=2&gt;“&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;/&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;MDXControl:ManagedDirectXControl.RenderContent&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;MDXControl:ManagedDirectXControl&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;2-Here’s the code for the custom control - this is a WindowsFormsHost which allows us to contain Winforms content&amp;nbsp;in WPF. The Xaml visible RenderContent field is used here for encapsulating the rendering behavior&amp;nbsp;we want to execute in DirectX:&lt;FONT color=#0000ff size=2&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;public&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ManagedDirectXControl&lt;/FONT&gt;&lt;FONT size=2&gt; : &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;WindowsFormsHost&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; ManagedDirectXControl()&lt;BR&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Child = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ManagedDirectXDeviceWrapper&lt;/FONT&gt;&lt;FONT size=2&gt;();&lt;BR&gt;&amp;nbsp; }&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;Renderable&lt;/FONT&gt;&lt;FONT size=2&gt; RenderContent&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; ((&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ManagedDirectXDeviceWrapper&lt;/FONT&gt;&lt;FONT size=2&gt;)Child).RenderContent; }&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;/FONT&gt;&lt;FONT size=2&gt; { ((&lt;/FONT&gt;&lt;FONT color=#008080 size=2&gt;ManagedDirectXDeviceWrapper&lt;/FONT&gt;&lt;FONT size=2&gt;)Child).RenderContent = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;value&lt;/FONT&gt;&lt;FONT size=2&gt;; }&lt;BR&gt;&amp;nbsp; }&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;3-The ManagedDirectXDeviceWrapper code which is contained in the project attached below, is pretty routine DirectX code for initialization and a rendering loop tied to repaint events on the container control. There are many fine tutorials on that subject, so I won't reinvent that&amp;nbsp;wheel of guidance.&amp;nbsp;The wrapper will&amp;nbsp;check&amp;nbsp;for HW PS &amp;amp; VS shaders V1.1, and will silently fall back to software mode. If you would like active notification of the fallback, look at the “&lt;/FONT&gt;&lt;FONT size=2&gt;_alreadyNagged” field in that class. This class contains hooks which depend on the&amp;nbsp;user supplied&amp;nbsp;Renderable object.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;4-Finally, the implementation of “ShaderRender” supplies a generic Quad mesh which gets textured and processed by user supplied shaders. The derived class “AdjustableShader” pre-defines a reference to a particular shader file, and exposes R,G,B properties for data binding use as targets, which provide parameters which are passed on to the pixel shader. Again, the mechanics of this is familiar territory in the DirectX world, so I'm not delving into that aspect here.&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;You can get&amp;nbsp;the&amp;nbsp;VS Solution with projects for the Managed DX wrapper project,&amp;nbsp;and a WPF&amp;nbsp;sample app containing simple data binding to drive the pixel shader inputs for shifting the texture color.&amp;nbsp;That code is available &lt;A class="" id=p744 title="WPF DX Interop" href="http://www.recursim.com/wp-content/uploads/2007/03/WPF%20DX%20Interop.zip" rel=attachment mce_href="http://www.recursim.com/wp-content/uploads/2007/03/WPF%20DX%20Interop.zip"&gt;from here&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;To work on the project you will need the following installed(Combined pre-req's for DX and WPF):&lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT size=2&gt;Visual Studio 2005&amp;nbsp;&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT size=2&gt;DirectX SDK&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT size=2&gt;WPF Runtime or be running on Vista&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT size=2&gt;Orcas CTP for Visual Studio 2005(to support WPF VS project)&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;I would be glad to hear any questions, suggestions or other feedback...&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1983526" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/pantal/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/pantal/archive/tags/DirectX/default.aspx">DirectX</category><category domain="http://blogs.msdn.com/pantal/archive/tags/Shader/default.aspx">Shader</category></item></channel></rss>