<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Comment Feed for Channel 9 - We&#39;re all one little world... as shown with the Silverlight 5 3D sample, Solar Wind</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/coding4fun/blog/Were-all-one-little-world-as-shown-with-the-Silverlight-5-3D-sample-Solar-Wind/RSS"></atom:link>
	<image>
		<url>http://files.channel9.msdn.com/thumbnail/d4b8c248-9bdf-43b1-9e5d-f73a0ef6b646.png</url>
		<title>Channel 9 - We&#39;re all one little world... as shown with the Silverlight 5 3D sample, Solar Wind</title>
		<link></link>
	</image>
	<description> What I liked about this sample was that it was &#39;simple,&#39; focusing on one primary thing and yet was pretty cool looking. And there&#39;s just something about seeing our little ball of dirt and rock from space that appeals to the frustrated space voyager in me. [Insert quip, &amp;quot;Look! You can see my house from here!&amp;quot; ] Solar Wind 3D Sample  This sample for Silverlight 5 uses the new 3D features to draw the Earth with day and night transitions, atmosphere layers, and population density overlays. It demonstrates advanced concepts like mipmaps, texture blending, multiple drawing passes, sampler states, and lighting. Note the &amp;quot;Building the Sample&amp;quot; section (which of course I didn&#39;t until I tried to run it the first time... Note to self: RTFP [Read The Fine Post]...  Building the Sample To compile the solution you will need to install the DirectX SDK and the HLSL Shader Build Task. Afterwards you can open the solution in Visual Studio to build. Here&#39;s another shot, showing off some of the other capabilities, like the rotation and Magnetic Field overlay  The solution is pretty straight forward, with more files for the shaders and textures than for code...  Here&#39;s the Earth class;        public Earth()        {            Transform = Matrix.CreateWorld(new Vector3(), Vector3.Forward, Vector3.Up);&amp;nbsp;            AtmosphereVisible = true;            MagneticFieldVisible = false;            PopulationDensityVisible = false;            ShowWireframe = false;        }Now lets load the shaders and textures.       void LoadEarthContent()        {            // Load mesh            mesh = new SpherePrimitive(10.0f, 50);&amp;nbsp;            //            // Load shaders            //            earthVertexShader = ContentManager.LoadVertexShader(&amp;quot;Shaders/Earth_vs.vs&amp;quot;);            earthPixelShader = ContentManager.LoadPixelShader(&amp;quot;Shaders/Earth_ps.ps&amp;quot;);            //            // Load textures            //            dayTexture = ContentManager.LoadTexture(&amp;quot;Textures/Earth/EarthDay.png&amp;quot;, true);            nightTexture = ContentManager.LoadTexture(&amp;quot;Textures/Earth/EarthNight.png&amp;quot;, true);            nightLightsTexture = ContentManager.LoadTexture(&amp;quot;Textures/Earth/EarthNightLights.png&amp;quot;, true);            normalTexture = ContentManager.LoadTexture(&amp;quot;Textures/Earth/EarthNormal.png&amp;quot;, true);            maskTexture = ContentManager.LoadTexture(&amp;quot;Textures/Earth/EarthMask.png&amp;quot;, true);        }Here&#39;s a snap of those textures;  Drawing the world...       public void Draw(GraphicsDevice device, SceneTime time, Camera camera)        {            // All Earth pass shaders use the same constants so update them each frame            UpdateEarthShaderConstants(device, time, camera);&amp;nbsp;            //            // Pass 1 - Draw Earth            //&amp;nbsp;            // Set textures in order of samplers            device.Textures[0] = dayTexture;            device.Textures[1] = nightTexture;            device.Textures[2] = nightLightsTexture;            device.Textures[3] = normalTexture;            device.Textures[4] = maskTexture;&amp;nbsp;            // Set states to control sampling            device.SamplerStates[0] = SamplerState.AnisotropicClamp;            device.SamplerStates[1] = SamplerState.AnisotropicClamp;            device.SamplerStates[2] = SamplerState.AnisotropicClamp;            device.SamplerStates[3] = SamplerState.AnisotropicClamp;            device.SamplerStates[4] = SamplerState.AnisotropicClamp;                        // Set device states            device.BlendState = BlendState.Opaque;            device.RasterizerState = rasterizerState;&amp;nbsp;            // Configure shading pipeline            device.SetVertexShader(earthVertexShader);            device.SetPixelShader(earthPixelShader);&amp;nbsp;            // Draw the main earth pass            mesh.Draw(device);&amp;nbsp;            // Draw atmosphere layer            if (AtmosphereVisible)                atmosphereLayer.Draw(device);&amp;nbsp;            // Draw population layer            if (PopulationDensityVisible)                populationLayer.Draw(device);&amp;nbsp;            // Draw magnetic field            if (MagneticFieldVisible)                field.Draw(device, time, camera);        }And finally updating it as the world rotates.        void UpdateEarthShaderConstants(GraphicsDevice device, SceneTime time, Camera camera)        {                        // Get the inverse transpose matrix            Matrix WorldInverseTransposeMatrix = Matrix.Invert(Transform);            WorldInverseTransposeMatrix = Matrix.Transpose(WorldInverseTransposeMatrix);&amp;nbsp;            // Set the primary vertex constants            earthConstants.WorldMatrix = Transform;            earthConstants.WorldInverseTransposeMatrix = Matrix.Transpose(Matrix.Invert(Transform));            earthConstants.WorldViewProjectionMatrix = Transform * camera.ViewTransform * camera.ProjectionTransform;            earthConstants.ViewInverseMatrix = Matrix.Invert(camera.ViewTransform);            earthConstants.TotalSeconds.X = (float)time.TotalTime.TotalSeconds;            device.SetVertexShaderConstantFloat4(0, ref earthConstants);&amp;nbsp;            // Set the pixel shader constants (to achieve solid lighting in wireframe mode)            if(ShowWireframe)                device.SetPixelShaderConstantFloat4(0, ref showWireframeValue);            else                device.SetPixelShaderConstantFloat4(0, ref hideWireframeValue);        }&amp;nbsp; If you&#39;re looking at Silverlight 5&#39;s 3D capabilities, then this, or other samples from the MIX11 Silverlight 3D session, should be worth a peek... Here’s a few more links you might find interesting: Silverlight 3D : Tri-Winning (Part 1)Housebuilding with John Papa and Sliverlight 5 at MIX11Aaron Oneal&#39;s Blog (Sample author and has a number of additional Silverlight 3D posts) 3D Graphics OverviewMIX11 Silverlight 3D Session&amp;nbsp; Page thumbnail, Day 432 / 365 - It&#39;s a small world, curtsey of xJasonRogersx </description>
	<link></link>
	<language>en</language>
	<pubDate>Wed, 19 Jun 2013 11:08:23 GMT</pubDate>
	<lastBuildDate>Wed, 19 Jun 2013 11:08:23 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<item>
		<title>Re: We&#39;re all one little world... as shown with the Silverlight 5 3D sample, Solar Wind</title>
		<description>
			<![CDATA[ <p>I have a question re Silverlight 3D, i hope maybe you could help. Is it relateded to DirectX? and more importantly, is it supported on the Mac?</p><p>&nbsp;</p><p>Thx</p><p>posted by fanbaby</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/blog/Were-all-one-little-world-as-shown-with-the-Silverlight-5-3D-sample-Solar-Wind#c634425980570000000</link>
		<pubDate>Thu, 02 Jun 2011 07:54:17 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/blog/Were-all-one-little-world-as-shown-with-the-Silverlight-5-3D-sample-Solar-Wind#c634425980570000000</guid>
		<dc:creator>fanbaby</dc:creator>
	</item>
	<item>
		<title>Re: We&#39;re all one little world... as shown with the Silverlight 5 3D sample, Solar Wind</title>
		<description>
			<![CDATA[ <p>@<a href="/coding4fun/blog/Were-all-one-little-world-as-shown-with-the-Silverlight-5-3D-sample-Solar-Wind#c634425980570000000?areaType=Blogs&amp;areaName=Coding4FunBlog">fanbaby</a>: Silverlight is cross platform so yes to supported on the mac.&nbsp; For DirectX, what do you mean?</p><p>posted by Clint</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/blog/Were-all-one-little-world-as-shown-with-the-Silverlight-5-3D-sample-Solar-Wind#c634426819000000000</link>
		<pubDate>Fri, 03 Jun 2011 07:11:40 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/blog/Were-all-one-little-world-as-shown-with-the-Silverlight-5-3D-sample-Solar-Wind#c634426819000000000</guid>
		<dc:creator>Clint</dc:creator>
	</item>
	<item>
		<title>Re: We&#39;re all one little world... as shown with the Silverlight 5 3D sample, Solar Wind</title>
		<description>
			<![CDATA[ <p>@<a href="/coding4fun/blog/Were-all-one-little-world-as-shown-with-the-Silverlight-5-3D-sample-Solar-Wind#c634426819000000000?areaType=Blogs&amp;areaName=Coding4FunBlog">Clint</a>: I meant: is <strong>3d</strong> supported on the Mac. I think the answer is not right now, and I wanted more info about this, hence the question about directx</p><p>posted by fanbaby</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/blog/Were-all-one-little-world-as-shown-with-the-Silverlight-5-3D-sample-Solar-Wind#c634427878110000000</link>
		<pubDate>Sat, 04 Jun 2011 12:36:51 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/blog/Were-all-one-little-world-as-shown-with-the-Silverlight-5-3D-sample-Solar-Wind#c634427878110000000</guid>
		<dc:creator>fanbaby</dc:creator>
	</item>
	<item>
		<title>Re: We&#39;re all one little world... as shown with the Silverlight 5 3D sample, Solar Wind</title>
		<description>
			<![CDATA[ <p>great demo! 3ku</p><p>posted by jpr1990</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/blog/Were-all-one-little-world-as-shown-with-the-Silverlight-5-3D-sample-Solar-Wind#c634439920880000000</link>
		<pubDate>Sat, 18 Jun 2011 11:08:08 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/blog/Were-all-one-little-world-as-shown-with-the-Silverlight-5-3D-sample-Solar-Wind#c634439920880000000</guid>
		<dc:creator>jpr1990</dc:creator>
	</item>
</channel>
</rss>