<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Virtual Earth 3D team blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/virtualearth3d/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/virtualearth3d/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:43:22 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>How to Make Virtual Earth 3D Live Forever</title>
      <link>https://docs.microsoft.com/archive/blogs/virtualearth3d/how-to-make-virtual-earth-3d-live-forever</link>
      <pubDate>Sat, 13 Aug 2011 17:45:00 GMT</pubDate>
      <dc:creator><![CDATA[NikolaiF]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/virtualearth3d/2011/08/13/how-to-make-virtual-earth-3d-live-forever/</guid>
      <description><![CDATA[Hello all,
When we announced that we're "discontinuing investment" in VE3D earlier this year,...]]></description>
      <content:encoded><![CDATA[<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/89/4682.freddy.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-89/4682.freddy.jpg"><img style="margin-right: auto; margin-left: auto; display: block;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/89/4682.freddy.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-89/4682.freddy.jpg" alt="" width="189" height="243" border="0" /></a></p>
<p>Hello all,</p>
<p>When we announced that we're "discontinuing investment" in VE3D earlier this year, many of you expressed concern that this would mean you can't use VE3D anymore.&nbsp; I deal with technical issues, so let me address those.&nbsp; There's certainly nothing time-bomby in the code, so it'll keep right on functioning as it always did.&nbsp; The obvious concern is that VE3D is very much a web-connected bit of code, and what happens if the servers we run get turned off?</p>
<p>Well, the first thing to say is that we really have no reason to turn them off.&nbsp; Most of the data VE3D uses is also used in our other products, and that which isn't doesn't represent a significant cost in server capacity.&nbsp; But that's not a technical thing to say, is it?&nbsp; And I said I deal with technical issues, so what DOES happen if the servers get turned off?</p>
<p>If you're using the built-in default data sources, VE3D stops working.&nbsp; It won't crash or anything, but it'll be pretty boring:&nbsp; no data, nothing to see.&nbsp; But, as you know, you can replace those data sources quite readily.&nbsp; So it should be easy to just point it somewhere else, right?</p>
<p>Well, slight complications, then good news and bad news.&nbsp; The complications stem from the fact that we never designed the system from the ground up to be completely separated from the mothership.&nbsp; So, the system does make some assumptions about what servers it can see.&nbsp; Fortunately, using Reflection you can do just about anything, and I've put together a Windows Forms sample that controls (or removes) those assumptions on a flag-by-flag basis.</p>
<p>The good news is that by using the right combination of flags, you can have the code run only against servers you control, or even against no servers at all, using only locally stored/generated data.&nbsp; In these configurations you no longer care if our servers are on or off, and the code is easily copy/pastable into your own projects (just pay attention to where each flag is implemented in the startup process).</p>
<p>The bad news is that Weather, DEM, and Model data&nbsp;is a bit tricky.&nbsp; I haven't spelled out precisely how to supply your own data, because unlike web mapping imagery data there really isn't a standard, even a de facto one.&nbsp; So I provide pointers in the code to where you need to look to write your own sources, but you'll need to do the lifting on your own.</p>
<p><a title="VE3D_Unchained.zip" href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/00/89/6622.VE3D_Unchained.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-00-89/6622.VE3D_5F00_Unchained.zip">Here's where you can find the code.</a></p>
<p>Have fun, and please contact me with questions and comments.&nbsp; Thanks, it's been great!</p>]]></content:encoded>
    </item>
    <item>
      <title>Discontinuing Investment is Such Sweet Sorrow</title>
      <link>https://docs.microsoft.com/archive/blogs/virtualearth3d/discontinuing-investment-is-such-sweet-sorrow</link>
      <pubDate>Wed, 03 Nov 2010 14:10:57 GMT</pubDate>
      <dc:creator><![CDATA[NikolaiF]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/virtualearth3d/2010/11/03/discontinuing-investment-is-such-sweet-sorrow/</guid>
      <description><![CDATA[Hello all,
We have just announced that we will be discontinuing investment in VE3D.&nbsp; In the...]]></description>
      <content:encoded><![CDATA[<p>Hello all,</p>
<p>We have just announced that we will be discontinuing investment in <a target="_blank" href="https://msdn.microsoft.com/en-us/library/bb429547.aspx">VE3D</a>.&nbsp; In the short term, the 3D view will be removed from bing.com/maps.&nbsp; The 3D control itself will continue to function, and data will continue to be served to it.&nbsp; The support will continue until December 2011, and during that time it will still be in the AJAX map control (version 6.3) for 3rd party use.&nbsp; I will personally continue to monitor the comments sections and the contact link, so you can keep sending me questions.</p>
<p>Thanks for all the great comments, feedback, and questions over the last two years.&nbsp; It&rsquo;s been a lot of fun and I&rsquo;ve really enjoyed working with you all.</p>
<p>Here is the announcement:</p>
<p><a href="https://www.bing.com/community/site_blogs/b/maps/archive/2010/11/02/changes-to-bird-s-eye-and-3d-maps.aspx">https://www.bing.com/community/site_blogs/b/maps/archive/2010/11/02/changes-to-bird-s-eye-and-3d-maps.aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Bing Maps 3D fix for Firefox 3.6 released</title>
      <link>https://docs.microsoft.com/archive/blogs/virtualearth3d/bing-maps-3d-fix-for-firefox-3-6-released</link>
      <pubDate>Mon, 29 Mar 2010 14:30:00 GMT</pubDate>
      <dc:creator><![CDATA[Kristoffer]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/virtualearth3d/2010/03/29/bing-maps-3d-fix-for-firefox-3-6-released/</guid>
      <description><![CDATA[With the 3.6 release Firefox changed the plugin API which broke Virtual Earth 3D temporarily. To...]]></description>
      <content:encoded><![CDATA[With the 3.6 release Firefox changed the plugin API which broke Virtual Earth 3D temporarily. To allow people to upgrade Firefox and continue to use Bing Maps 3D we have released a new version which will work with this Firefox version as well as older versions. To install the fix uninstall the existing copy of Bing Maps 3D and re-install from existing links or <a href="https://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=e9298080-50c4-4f2e-9fc4-4009074996ba" mce_href="https://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=e9298080-50c4-4f2e-9fc4-4009074996ba">directly from the download center</a>.<br>]]></content:encoded>
    </item>
    <item>
      <title>Custom Clouds</title>
      <link>https://docs.microsoft.com/archive/blogs/virtualearth3d/custom-clouds</link>
      <pubDate>Sun, 24 Jan 2010 10:37:00 GMT</pubDate>
      <dc:creator><![CDATA[NikolaiF]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/virtualearth3d/2010/01/24/custom-clouds/</guid>
      <description><![CDATA[It is possible (and pretty easy)&nbsp;to add your own weather data (based on your own data sources,...]]></description>
      <content:encoded><![CDATA[<P>It is possible (and pretty easy)&nbsp;to add your own weather data (based on your own data sources, or just for fun) to VE3D using WorldEngine.Environment.Weather.&nbsp; For example, to add some nice fluffy clouds all over:</P>
<P>&nbsp;Host.WorldEngine.Environment.Weather.Clear();</P>
<P>// specify the type of clouds you want, their density (0 to 1), and their altitude in meters<BR>CloudLayer cloud = new CloudLayer(CloudType.CumulusHumilis, 0.3f, 2000);</P>
<P>// specify the layer you want, its level (strictly speaking the altitude does not have to be in order<BR>// of the layers, but it helps to keep them organized), and a timestamp for when the data is<BR>// relevant -- for automatically generated data like this Now is sufficient.<BR>// Wind and rain are not implemented.<BR>WeatherLayer layer = new WeatherLayer(cloud, CloudLayerLevel.Low, DateTime.Now);</P>
<P>// To add weather evenly everywhere, use LatLon.Empty.&nbsp; To add a specific location, specify that location.<BR>// The closest points to the camera's position will be used to determine actual weather.<BR>WeatherPoint weather = new WeatherPoint(LatLon.Empty, layer);<BR>Host.WorldEngine.Environment.Weather.AddPoint(weather);</P>
<P>Here's a view of a two-layer cloud system:</P>
<P><IMG style="WIDTH: 789px; HEIGHT: 607px" title="Clouds in Seattle" alt="Clouds in Seattle" src="https://www.veteam.members.winisp.net/Spaceland/blog/clouds.jpg" width=789 height=607 mce_src="https://www.veteam.members.winisp.net/Spaceland/blog/clouds.jpg"></P>
<P>You can find some sample code <A title="Custom weather sample" href="https://www.veteam.members.winisp.net/Spaceland/blog/CustomWeather.zip" target=_blank mce_href="https://www.veteam.members.winisp.net/Spaceland/blog/CustomWeather.zip">here</A>.</P>]]></content:encoded>
    </item>
    <item>
      <title>New version of InfoStrat.VE: VE3D in WPF</title>
      <link>https://docs.microsoft.com/archive/blogs/virtualearth3d/new-version-of-infostrat-ve-ve3d-in-wpf</link>
      <pubDate>Tue, 05 Jan 2010 10:48:00 GMT</pubDate>
      <dc:creator><![CDATA[NikolaiF]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/virtualearth3d/2010/01/05/new-version-of-infostrat-ve-ve3d-in-wpf/</guid>
      <description><![CDATA[Goodness for the new year:&nbsp;

Have you seen the Microsoft Surface Globe application in the...]]></description>
      <content:encoded><![CDATA[<P>Goodness for the new year:&nbsp;</P>
<P><IMG alt="Globe Screenshot" src="https://www.microsoft.com/surface/images/touch-pack/GlobeScreen_full.jpg"></P>
<P>Have you seen the <A href="https://www.microsoft.com/surface/touch-pack/en-US/Touch-Pack-Globe.aspx"><FONT color=#f4bf33>Microsoft Surface Globe</FONT></A> application in the <A href="https://www.microsoft.com/surface/touch-pack/en-US/touch-pack.aspx"><FONT color=#f4bf33>Microsoft Touch Pack for Windows 7</FONT></A>?&nbsp; There are plenty of videos of the app in action on YouTube: <A href="https://tinyurl.com/YouTubeSurfaceGlobe"><FONT color=#f4bf33>https://tinyurl.com/YouTubeSurfaceGlobe</FONT></A>.</P>
<P>Would you like to build an app like this yourself?&nbsp; Thanks to <A href="https://virtualearthwpf.codeplex.com/"><FONT color=#f4bf33>InfoStrat.VE</FONT></A>, you can! Josh Blake just announced the R2 release of <A href="https://virtualearthwpf.codeplex.com/"><FONT color=#f4bf33>InfoStrat.VE</FONT></A>.&nbsp; Amongst other improvements, it includes support for the same touch interaction on Windows 7 you have available in the <A href="https://www.microsoft.com/surface/touch-pack/en-US/Touch-Pack-Globe.aspx"><FONT color=#f4bf33>Microsoft Surface Globe</FONT></A> app.&nbsp; Full details on Josh’s blog:</P>
<P><A title=https://nui.joshland.org/2010/01/infostratve-release-2-is-now-up.html href="https://nui.joshland.org/2010/01/infostratve-release-2-is-now-up.html"><FONT color=#f4bf33>https://nui.joshland.org/2010/01/infostratve-release-2-is-now-up.html</FONT></A></P>
<P>&nbsp;Via <A href="https://blogs.msdn.com/devkeydet/archive/2010/01/04/bing-maps-3d-wpf-and-windows-7-multitouch.aspx" target=_blank mce_href="https://blogs.msdn.com/devkeydet/archive/2010/01/04/bing-maps-3d-wpf-and-windows-7-multitouch.aspx">Marc</A></P>]]></content:encoded>
    </item>
    <item>
      <title>Two good questions</title>
      <link>https://docs.microsoft.com/archive/blogs/virtualearth3d/two-good-questions</link>
      <pubDate>Tue, 08 Dec 2009 10:52:00 GMT</pubDate>
      <dc:creator><![CDATA[NikolaiF]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/virtualearth3d/2009/12/08/two-good-questions/</guid>
      <description><![CDATA[Posting some answers to questions I've gotten recently.
Bug in the samples:
Kind of silly that I...]]></description>
      <content:encoded><![CDATA[<P>Posting some answers to questions I've gotten recently.</P>
<P><U>Bug in the samples:</U></P>
<P>Kind of silly that I hadn't noticed this until now, but there's an error in the sample html for most of the samples.&nbsp; The name of the functions used for plug-in load and activate conflict with an internal name used in the AJAX code.&nbsp; Change "On3DPlugInLoaded" and "On3DPlugInActivated" to any other name, for example "PlugInLoaded" and "PlugInActivated".&nbsp; Remember to change both your function name and the string passed to AttachEvent.</P>
<P><U>Zoom or Rotate around a point:</U></P>
<P>There have been several requests about how to allow people to zoom or rotate around a particular point on the screen, rather than the center.&nbsp; The <A title="Rotate/Zoom code" href="https://www.veteam.members.winisp.net/Spaceland/blog/PointZoomRotatePlugIn.zip" mce_href="https://www.veteam.members.winisp.net/Spaceland/blog/PointZoomRotatePlugIn.zip">code</A>&nbsp;here isn't as cleaned up as I normally like it, but it illustrates the ideas.&nbsp; You can do the rotate by purely calling built-in VE3D functions via the bindings system, but zoom requires a bit more work.&nbsp; To run the code, replace files in the Multitouch <A title=Samples href="https://blogs.msdn.com/virtualearth3d/archive/2008/09/25/current-samples.aspx" target=_blank mce_href="https://blogs.msdn.com/virtualearth3d/archive/2008/09/25/current-samples.aspx">sample</A> with the files in the zip.&nbsp; You will want to call or adapt the calls to GestureEventSource to be in response to your inputs, rather than the worker thread I created.</P>
<P>Remember you can contact me any time via the contact form, or if you prefer via comments.&nbsp; Even if it looks like I haven't posted recently :)</P>]]></content:encoded>
    </item>
    <item>
      <title>Installing VE3D without the setup package</title>
      <link>https://docs.microsoft.com/archive/blogs/virtualearth3d/installing-ve3d-without-the-setup-package</link>
      <pubDate>Sun, 27 Sep 2009 15:53:00 GMT</pubDate>
      <dc:creator><![CDATA[NikolaiF]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/virtualearth3d/2009/09/27/installing-ve3d-without-the-setup-package/</guid>
      <description><![CDATA[In some scenarios it may be desirable to install the VE3D engine without visiting the...]]></description>
      <content:encoded><![CDATA[<P>In some scenarios it may be desirable to install the VE3D engine without visiting the <A href="https://www.bing.com/maps">www.bing.com/maps</A> site, and/or to avoid the individual downloads that the setup package performs (eg offline or enterprise installations).</P>
<P>The main installation msi files are available at:</P>
<P><A href="https://go.microsoft.com/fwlink/?LinkID=117319">https://go.microsoft.com/fwlink/?LinkID=117319</A> for x86</P>
<P><A href="https://go.microsoft.com/fwlink/?LinkID=117320">https://go.microsoft.com/fwlink/?LinkID=117320</A> for x64 systems</P>
<P>If installed this way, the pre-requisites must already be installed:&nbsp; the .NET 2.0 Framework and Windows Imaging Components.&nbsp; Vista and Windows 7 already have both of these by default, for XP the latest versions are available by searching for them on the <A title="MS Download Center" href="https://www.microsoft.com/downloads/en/default.aspx" target=_blank mce_href="https://www.microsoft.com/downloads/en/default.aspx">Microsoft Download Center</A>.</P>
<P>For convenience, here are some links to the&nbsp;prerequisites:</P>
<P><A href="https://go.microsoft.com/fwlink/?LinkID=106132">https://go.microsoft.com/fwlink/?LinkID=106132</A>&nbsp;.NET 2.0 x86</P>
<P><A href="https://go.microsoft.com/fwlink/?LinkID=106134">https://go.microsoft.com/fwlink/?LinkID=106134</A> .NET 2.0 x64</P>
<P><A href="https://go.microsoft.com/fwlink/?LinkID=101060">https://go.microsoft.com/fwlink/?LinkID=101060</A> WIC x86</P>
<P><A href="https://go.microsoft.com/fwlink/?LinkID=101061">https://go.microsoft.com/fwlink/?LinkID=101061</A> WIC x64&nbsp;<BR></P>
<P><SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt; mso-bidi-language: HE; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US"></SPAN>&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>Hosting VE3D in native code</title>
      <link>https://docs.microsoft.com/archive/blogs/virtualearth3d/hosting-ve3d-in-native-code</link>
      <pubDate>Thu, 24 Sep 2009 14:54:00 GMT</pubDate>
      <dc:creator><![CDATA[NikolaiF]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/virtualearth3d/2009/09/24/hosting-ve3d-in-native-code/</guid>
      <description><![CDATA[Sorry for the glut of posts this week.&nbsp; I hadn't been able to write much, but there were still...]]></description>
      <content:encoded><![CDATA[<P>Sorry for the glut of posts this week.&nbsp; I hadn't been able to write much, but there were still interesting topics and questions coming up and I'm trying to address that backlog now.&nbsp; So, without further ado:</P>
<P>It is possible to host VE3D in a variety of contexts, and so far we've seen WinForms, WPF, and the browser.&nbsp; It is also possible to host in straight native code.&nbsp; In this sample, I address the COM interactions needed to host VE3D, and use OpenGL as an example hosting environment.</P>
<P>Download the <A title="Sample Code" href="https://www.veteam.members.winisp.net/Spaceland/blog/VE3DOpenGL.zip" mce_href="https://www.veteam.members.winisp.net/Spaceland/blog/VE3DOpenGL.zip">code here.</A></P>
<P><IMG style="WIDTH: 640px; HEIGHT: 490px" title="VE3D on an OpenGL cube" alt="VE3D on an OpenGL cube" src="https://www.veteam.members.winisp.net/Spaceland/blog/ve3dCube.jpg" width=640 height=490 mce_src="https://www.veteam.members.winisp.net/Spaceland/blog/ve3dCube.jpg"></P>
<P>This sample demonstrates four concepts:</P>
<P>Interaction with native code.<BR>Back buffer retrieval.<BR>Direct camera control.<BR>OpenGL integration.</P>
<P><STRONG>Native code:</STRONG></P>
<P>Managed code provides easy and convenient methods for exposing your code to COM, and hence to native callers.<BR>From the managed side, check "Register for COM interop" in your project's Build tab.&nbsp; Decorate an interface<BR>with ComVisible(true) and provide a guid, and the backing class with the interface type as shown.&nbsp; Your types<BR>are now visible and callable.</P>
<P>On the native side, you can now instantiate your managed code using typical COM calls, as shown.&nbsp; It can then<BR>be called similarly to any other object.</P>
<P>To add a new function to the interface, simply add it to the interface file and the backing .cs file, then <BR>recompile.&nbsp; By designing your interface in appropriately, you can then decide whether to do most of your logic<BR>in native or managed code, depending on where you feel more comfortable.</P>
<P><STRONG>Backbuffer retrieval:</STRONG></P>
<P>The Render function provides the most efficient way of pulling VE3D's back buffer into main memory.&nbsp; In general<BR>it is better to not do this, rather let the hardware render to the screen directly, but some situations demand<BR>using the scene in some other fashion.&nbsp; Here, we get the memory as a direct pointer.&nbsp; Note that this approach<BR>assumes that you are handling any format and stride issues yourself.</P>
<P>It is also possible to get a graphics object from systemMemorySurface, an HDC from that, and then use functions<BR>like BitBlt to copy out data and handle some of these issues for you.</P>
<P><STRONG>Direct camera control:</STRONG></P>
<P>Most samples thus far have demonstrated use of bindings and actions, or deriving camera controller.&nbsp; The<BR>CameraController class here shows how to write a controller that can react directly to user input, modifying<BR>camera values directly.&nbsp; The "best practices" method is to wrap your input device in a EventSource, and use<BR>bindings and actions to communicate the information to your controller.&nbsp; These structures provide simple <BR>remapping of inputs, if necessary, and handle any threading or marshalling issues.&nbsp; </P>
<P>However, it is also possible and sometimes appropriate to take the simpler approach used here.</P>
<P><STRONG>OpenGL integration:</STRONG></P>
<P>It is possible to integrate VE3D into an existing OpenGL application.&nbsp; Using the Render method described above,<BR>the pointer produced is suitable for direct consumption by OpenGL.&nbsp; There are differences in how textures are<BR>handled by the two APIs, but these are fairly simple to overcome, and are described in DrawOpenGLWindow().</P>
<P>Note that there is nothing that limits this sample to OpenGL, anything that can consume the buffer as provided <BR>can host VE3D in the exact same manner.</P>
<P><U>Note on debugging:</U></P>
<P>The Visual Studio debugger requires some direction on how to deal with mixed native and managed code.<BR>In the VE3DOpenGL properties page, expand Configuration Properties, click Debugging, then choose Debugger <BR>Type.&nbsp; You can elect to only attach to native, only to managed, or to both ("mixed").&nbsp; "Auto" in this case <BR>will be native-only.&nbsp; If you find your breakpoints are not hitting, it is likely this setting.</P>
<P><U>Note on glut.h:</U></P>
<P>For some reason, in the release version only, I managed to get it thinking that it needed glut and I haven't<BR>been able to figure out why.&nbsp; If you encounter problems while compiling due to glut, just run in debug mode.<BR>This is a problem that is specific to the sample app, not the methodology used.</P>
<P>Enjoy, and as usual please let me know about any questions or problems you may have.</P>]]></content:encoded>
    </item>
    <item>
      <title>GraphicsProxy RenderState</title>
      <link>https://docs.microsoft.com/archive/blogs/virtualearth3d/graphicsproxy-renderstate</link>
      <pubDate>Tue, 22 Sep 2009 16:03:00 GMT</pubDate>
      <dc:creator><![CDATA[NikolaiF]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/virtualearth3d/2009/09/22/graphicsproxy-renderstate/</guid>
      <description><![CDATA[I've gotten a few questions lately about how to do some alpha effects using models, specifically...]]></description>
      <content:encoded><![CDATA[<P>I've gotten a few questions lately about how to do some alpha effects using models, specifically MeshGraphicsObject.&nbsp; After you create the GraphicsObject, it has a RenderState object available on it.&nbsp; The fields on this object will be familiar to those experienced with DirectX, but here's a rundown of a few especially useful ones:</P>
<P><U>Allow your model to cast shadows on the ground.</U></P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Lighting.CastShadows = true;</P>
<P><U>Allow your model to have directional shading</U> (you can adjust the direction of the light using Host.WorldEngine.Environment.SunPosition).</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Lighting.DirectionalLightEnabled = true;</P>
<P><U>Allow your model to use transparency</U>, whether from vertex colors, textures, or TextureFactor (see below).</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Alpha.Enabled = true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Alpha.SourceBlend = Blend.SourceAlpha;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Alpha.DestinationBlend = Blend.InvSourceAlpha;</P>
<P><U>Allow use of TextureFactor to control the overall color of the model</U>.&nbsp; For example, you can create a model that has a texture with a white patch, and then create two models, one red and one blue, both using the same texture but differing on the value of TextureFactor.</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Stages[0].Blending.ColorArgument1 = TextureArgument.TextureColor;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Stages[0].Blending.ColorArgument2 = TextureArgument.TFactor;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Stages[0].Blending.ColorOperation = TextureOperation.Modulate;</P>
<P><U>Allow use of TextureFactor to control the overall opacity of the model</U>.&nbsp; This is great for fading effects, as changing the TextureFactor per-frame is cheap.</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Stages[0].Blending.AlphaArgument1 = TextureArgument.TextureColor;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Stages[0].Blending.AlphaArgument2 = TextureArgument.TFactor;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Stages[0].Blending.AlphaOperation = TextureOperation.Modulate;</P>
<P><U>Change the filtering used for textures</U>.&nbsp; For example, in the XFile sample, if you zoom in close to the model the texture gets blocky.&nbsp; Dropping this code in improves the situation.</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Stages[0].Sampler.MagnificationFilter = TextureFilter.Linear;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.Stages[0].Sampler.MinificationFilter = TextureFilter.Linear;</P>
<P><U>The TextureFactor value mentioned above</U>.&nbsp; This value would make the model ghostly transparent and red-tinged.&nbsp; This (and other values in RenderState) can be cheaply changed every frame.</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newMesh.RenderState.TextureFactor.Value = Color.FromArgb(128, Color.Red);</P>
<P>One additional note:&nbsp; to use alpha, you must also call AddAlphaRenderable in your actor's Render function instead of just AddRenderable.&nbsp; The distance is a sorting function that lets the renderer know what order to draw the alpha in (affects blending).&nbsp; A constant value works in some situations, but if you find things look wrong, especially when one of your models occludes another, try using a value based on the distance between the model and the camera.</P>
<P>Here's a few shots to demonstrate the effects of these switches:</P>
<P><IMG style="WIDTH: 591px; HEIGHT: 533px" title="XFile Model" alt="XFile Model" src="https://www.veteam.members.winisp.net/Spaceland/blog/ModelOrig.jpg" width=591 height=533 mce_src="https://www.veteam.members.winisp.net/Spaceland/blog/ModelOrig.jpg"></P>
<P>Everyone's favorite XFile sample model.</P>
<P><IMG style="WIDTH: 602px; HEIGHT: 544px" title="XFile Model, lit" alt="XFile Model, lit" src="https://www.veteam.members.winisp.net/Spaceland/blog/ModelLight.jpg" width=602 height=544 mce_src="https://www.veteam.members.winisp.net/Spaceland/blog/ModelLight.jpg"></P>
<P>The same model, with shadows and directional lighting (the sun is above and a bit behind, if you move it the shading and shadows move appropriately).</P>
<P><IMG style="WIDTH: 612px; HEIGHT: 543px" title="XFile Model, alternate texture" alt="XFile Model, alternate texture" src="https://www.veteam.members.winisp.net/Spaceland/blog/ModelTex.jpg" width=612 height=543 mce_src="https://www.veteam.members.winisp.net/Spaceland/blog/ModelTex.jpg"></P>
<P>The same again, with an alternate texture that contains transparency and the various alpha switches on.&nbsp; Note one detail:&nbsp; the shadow casting code does not account for transparency.</P>
<P><IMG style="WIDTH: 657px; HEIGHT: 631px" title="XFile model, all switches" alt="XFile model, all switches" src="https://www.veteam.members.winisp.net/Spaceland/blog/ModelAll.jpg" width=657 height=631 mce_src="https://www.veteam.members.winisp.net/Spaceland/blog/ModelAll.jpg"></P>
<P>Same again, with all switches described above turned on.&nbsp; The texture filtering is improved (look for blockiness in the center of the body in the previous shot), the color is shifted red, and the whole model is somewhat transparent, even parts where the texture is opaque.</P>]]></content:encoded>
    </item>
    <item>
      <title>X File bulk display</title>
      <link>https://docs.microsoft.com/archive/blogs/virtualearth3d/x-file-bulk-display</link>
      <pubDate>Sun, 20 Sep 2009 17:42:00 GMT</pubDate>
      <dc:creator><![CDATA[NikolaiF]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/virtualearth3d/2009/09/20/x-file-bulk-display/</guid>
      <description><![CDATA[I was asked the other day about how to load multiple x file -based models into VE3D without having...]]></description>
      <content:encoded><![CDATA[<P>I was asked the other day about how to load multiple x file -based models into VE3D without having to place each one manually.&nbsp; I've written up a <A title="X File DataSource sample" href="https://www.veteam.members.winisp.net/Spaceland/blog/XFileDataSource.zip" mce_href="https://www.veteam.members.winisp.net/Spaceland/blog/XFileDataSource.zip">sample here</A>.&nbsp; The idea is more or less a fusion of the existing ActorDataSource and XFile samples, using the actor from the XFile sample rather than the bunnies.&nbsp; I've also mocked up a very simple data file that contains placement information, rather than generating data on the fly as for the bunnies.</P>
<P>The way I've done this, the parsing code for the x files is done in the actor.&nbsp; In this way, swapping out file formats should be straightforward so long as you have parsing code for it (sorry, only x files are directly implemented in the engine, but the results of any parse should still be easily convertible into VE3D graphics objects).</P>
<P>For the sake of simplicitly I did do one thing wrong.&nbsp; The flow of the code is like this:&nbsp; multiple background threads all execute QueryPrimitivesInternal at the same time, and when they are finished, they move through a lock into ActorBuilder.&nbsp; They are still on background threads, but they now execute serially.&nbsp; So, really the data retrieval (in this case, loading from resources, but probably a network request) and the parsing, as appropriate, should happen in QueryPrimitivesInternal, and the action in ActorBuilder should be kept to a minimum.&nbsp; I violated this rule in the sample code for the sake of illustration, but you should be aware of it.</P>
<P>Finally, an important consideration is level of detail.&nbsp; Dense and numerous models can slow down loading and rendering.&nbsp; DataSources take advantage of the ActorBounds and scale concepts, such that it is possible to use simplified models at certain LODs, and switch to more detailed as the user zooms in.&nbsp; If your needs are less extreme, then you can simply use scale to cause models to stop rendering when not in view, and at a certain distance, which is what I have done in the sample.</P>
<P>Have fun!</P>]]></content:encoded>
    </item>
  </channel>
</rss>