A way to make background (outer space!) transparent?

May 4, 2009 at 6:12 AM

Does anyone know of a way to make the background, i.e. outer space transparent instead of black?

I want to be able to draw the globe on its own, without the black window its displayed in.

If tha'ts not possible it there a way to change the bg colour?

May 4, 2009 at 4:16 PM
This isn't possible.  The rendering of space is provided by the Virtual Earth 3D control (just like in the browser version.)  There are any options to do that though.

Also keep in mind that even if you did get the globe by itself, once you zoom in it would fill up the control.
May 4, 2009 at 7:20 PM

Perhaps you could define the map in code and use a clip geometry toclip the VE Control using an ellipse, and then add the clipped map to a Grid in XAML that is transparent or styled as you choose? In c# :

 map = new VEMap
                  Width = 590,
                  Height = 590,
                  Margin = new Thickness(5),
                  VerticalAlignment = VerticalAlignment.Top,
                  HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
                  MapStyle = VEMapStyle.Hybrid,
                  Clip = new EllipseGeometry
                         RadiusX = 230,
                         RadiusY = 230,
                         Center = new Point(295, 295)


            //Add to an existing transparent grid defined already in XAML


May 5, 2009 at 12:59 AM
Thanks for the replies.

Joshb, on the subject of rendering space, do you happen to know why I don't see stars + planet halo in the background if the control is rendered just like the browser version?

Jay, thanks for the idea. I might try it but I suspect it would not come out with great quality. Perhaps with some post processing effects the rough edges could be hidden though.

It's obvious the MS VE3D control was never designed to be reused in a flexible way (particularly the rendering it seems) so I should congratulate you Joshb for figuring out how to get it into a d3d surface that can be grabbed by WPF. There is no documentation of any of the 3d stuff that I can find on the web. How did you figure it out?

May 5, 2009 at 1:03 AM

I just tried your idea and it could work - the $million question is how to work out the size of the earth in screen space accurately, so that the mask can be fitted.

Any ideas?
May 5, 2009 at 1:30 AM

There are stars and space in the 3d version of maps.live.com.

If would be difficult to find a clip geometry that fits the globe exactly, particularly when you start zooming.  At minor zoom levels you can still see the entire globe but it is larger.  At larger zoom levels the Earth takes up the entire control.

Also jaysolomon, you don't have to create the control in code to add clipping.  You can add clipping in XAML.  If you wanted to dynamically change the clipping region you could give the EllipseGeometry a name and access it in code.

One crude way to determine what is space and what is Earth would be to use PointToLatLong and search certain points along the horizontal or vertical midline to find the threshold.  (If PointToLatLong returns null, the point isn't on Earth.)

I figured all this out by putting together the minimal samples that are on the web plus a lot of time in Reflector.NET.