<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Project Vanquish</title>
	<atom:link href="http://projectvanquish.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://projectvanquish.wordpress.com</link>
	<description>An XNA, community based, deferred rendering engine project</description>
	<lastBuildDate>Thu, 23 Feb 2012 18:24:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='projectvanquish.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Project Vanquish</title>
		<link>http://projectvanquish.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://projectvanquish.wordpress.com/osd.xml" title="Project Vanquish" />
	<atom:link rel='hub' href='http://projectvanquish.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Slight shuffle of code</title>
		<link>http://projectvanquish.wordpress.com/2012/02/23/slight-shuffle-of-code/</link>
		<comments>http://projectvanquish.wordpress.com/2012/02/23/slight-shuffle-of-code/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 17:56:12 +0000</pubDate>
		<dc:creator>Neil_Knight</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[Deferred Rendering]]></category>

		<guid isPermaLink="false">http://projectvanquish.wordpress.com/?p=426</guid>
		<description><![CDATA[In the latest changeset, I&#8217;ve moved the rendering from the &#8220;SceneManager&#8221; class into the &#8220;Actor&#8221; class using a new interface, &#8220;IRenderable&#8221;. I&#8217;m looking at creating an &#8220;ICullable&#8221; as well in order to only render those models that will appear in &#8230; <a href="http://projectvanquish.wordpress.com/2012/02/23/slight-shuffle-of-code/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=426&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the latest changeset, I&#8217;ve moved the rendering from the &#8220;SceneManager&#8221; class into the &#8220;Actor&#8221; class using a new interface, &#8220;IRenderable&#8221;.  I&#8217;m looking at creating an &#8220;ICullable&#8221; as well in order to only render those models that will appear in the view frustum.</p>
<p>Another change I made was for the &#8220;PhysicsManager&#8221;.  If you have a quad core processor, this will now add 3 threads to the &#8220;PhysicsManager&#8221;.  Vigrid pointed out that he had been burnt in the past by allocating a thread for all processors, so rather than learn the hard-way, it&#8217;s been to re-allocated <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/projectvanquish.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/projectvanquish.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/projectvanquish.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/projectvanquish.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/projectvanquish.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/projectvanquish.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/projectvanquish.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/projectvanquish.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/projectvanquish.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/projectvanquish.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/projectvanquish.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/projectvanquish.wordpress.com/426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/projectvanquish.wordpress.com/426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/projectvanquish.wordpress.com/426/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=426&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://projectvanquish.wordpress.com/2012/02/23/slight-shuffle-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9314f9e69706f0469b5272e25803160e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ardman</media:title>
		</media:content>
	</item>
		<item>
		<title>Extending the SceneManager and introducing&#8230;.</title>
		<link>http://projectvanquish.wordpress.com/2012/02/23/extending-the-scenemanager-and-introducing/</link>
		<comments>http://projectvanquish.wordpress.com/2012/02/23/extending-the-scenemanager-and-introducing/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 13:00:11 +0000</pubDate>
		<dc:creator>Neil_Knight</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[Deferred Rendering]]></category>
		<category><![CDATA[Physics Engine]]></category>
		<category><![CDATA[Scene Manager]]></category>

		<guid isPermaLink="false">http://projectvanquish.wordpress.com/?p=431</guid>
		<description><![CDATA[Yes, I&#8217;ve finally managed got around to implementing BEPU Physics. This has meant introducing a new &#8220;PhysicsManager&#8221; class and extending the &#8220;SceneManager&#8221; class, but it&#8217;s worth it. If you haven&#8217;t already, download the latest code from the link above (I&#8217;m &#8230; <a href="http://projectvanquish.wordpress.com/2012/02/23/extending-the-scenemanager-and-introducing/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=431&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yes, I&#8217;ve finally managed got around to implementing <a href="http://bepuphysics.codeplex.com/" target="_blank">BEPU Physics</a>.  This has meant introducing a new &#8220;PhysicsManager&#8221; class and extending the &#8220;SceneManager&#8221; class, but it&#8217;s worth it.  If you haven&#8217;t already, download the latest code from the link above (I&#8217;m using 1.1.0).  In the &#8220;ProjectVanquish&#8221; project, add a reference to the BEPU DLL.</p>
<p>We&#8217;ll start with the new &#8220;PhysicsManager&#8221; class.  In the &#8220;Core&#8221; folder, add a new class called &#8220;PhysicsManager&#8221; and include the following namespaces:<br />
<pre class="brush: csharp;">
using BEPUphysics;
using BEPUphysics.Constraints;
using BEPUphysics.Settings;
using Microsoft.Xna.Framework;
using ProjectVanquish.Models;
</pre></p>
<p>Add the following variables:<br />
<pre class="brush: csharp;">
private Space space;
private IList&lt;PhysicsObject&gt; physicsObjects; 
</pre></p>
<p><code>PhysicsObject</code> doesn&#8217;t exist yet, so you&#8217;ll have to fight with Visual Studio for the time being with regards the Intellisense.  Let&#8217;s create the constructor:<br />
<pre class="brush: csharp;">
public PhysicsManager(Vector3 gravity)
{
    space = new Space();
    space.ForceUpdater.Gravity = gravity;
    SolverSettings.DefaultMinimumIterations = 2;
    MotionSettings.DefaultPositionUpdateMode = BEPUphysics.PositionUpdating.PositionUpdateMode.Continuous;
    MotionSettings.UseExtraExpansionForContinuousBoundingBoxes = true;
    MotionSettings.CoreShapeScaling = 0.99f;
    space.Solver.IterationLimit = 20;

    // Check if we can use mutli-threading
    if (Environment.ProcessorCount &gt; 1)
    {
        for (int i = 0; i &lt; Environment.ProcessorCount; i++)
            space.ThreadManager.AddThread();

        space.BroadPhase.AllowMultithreading = true;
    }

    physicsObjects = new List&lt;PhysicsObject&gt;();
} 
</pre></p>
<p>In the constructor we are instantiating a new BEPU physics object and setting some default values.  We also check to see if we can use multi-threading that the BEPU engine now supports.  Straight forward enough.  We&#8217;ll add some properties:<br />
<pre class="brush: csharp;">
public IList&lt;PhysicsObject&gt; PhysicsObjects 
{ 
    get { return physicsObjects; } 
}

public Space Space 
{ 
    get { return space; } 
} 
</pre></p>
<p>This will be used in the &#8220;SceneManager&#8221; class.  Lastly, we just need an &#8220;Update&#8221; method:<br />
<pre class="brush: csharp;">
public void Update(GameTime gameTime)
{
    space.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
} 
</pre></p>
<p>Excellent.  That is our &#8220;PhysicsManager&#8221; class complete.  Let&#8217;s extend our &#8220;SceneManager&#8221; class to use this new class.  Open the &#8220;SceneManager&#8221; class and declare a new variable:<br />
<pre class="brush: csharp;">
static PhysicsManager physicsManager;
</pre></p>
<p>In the constructor, we&#8217;ll instantiate it:<br />
<pre class="brush: csharp;">
physicsManager = new PhysicsManager(new Vector3(0, -9.81f, 0));
</pre></p>
<p>This will create an earth-like gravity.  We&#8217;ll create a <code>static</code> property so we can access this from the &#8220;PhysicsManager&#8221; class:<br />
<pre class="brush: csharp;">
public static PhysicsManager PhysicsManager 
{ 
    get { return physicsManager; } 
}
</pre></p>
<p>The last part of the &#8220;SceneManager&#8221; class is to update the &#8220;PhysicsManager&#8221; in the &#8220;Update&#8221; method:<br />
<pre class="brush: csharp;">
physicsManager.Update(gameTime);
</pre></p>
<p>That&#8217;s all we need to do with the &#8220;SceneManager&#8221;.  The last thing on the check-list is the new &#8220;PhysicsObject&#8221; class.  Add a new class in the &#8220;Models&#8221; folder called &#8220;PhysicsObject&#8221; and add in the following namespaces:<br />
<pre class="brush: csharp;">
using BEPUphysics.Entities;
using BEPUphysics.Entities.Prefabs;
using BEPUphysics.MathExtensions;
using Microsoft.Xna.Framework;
using ProjectVanquish.Core;
</pre></p>
<p>Make the class <code>public abstract</code>:<br />
<pre class="brush: csharp;">
public abstract class PhysicsObject
</pre></p>
<p>Declare the following variables:<br />
<pre class="brush: csharp;">
bool movable = false;
Entity entity;
float mass = 1f;
</pre></p>
<p>Add a constructor:<br />
<pre class="brush: csharp;">
public PhysicsObject(bool isMovable)
{
    movable = isMovable;
    InitializeEntity();
} 
</pre></p>
<p>In the constructor, we are declaring if the object is movable or static.  We are also calling the &#8220;InitializeEntity&#8221; method.  We have 2 methods to add:<br />
<pre class="brush: csharp;">
protected void InitializeEntity()
{
    entity = new Box(Vector3.Zero, 0f, 0f, 0f, mass);
    SceneManager.PhysicsManager.PhysicsObjects.Add(this);
}

public void Remove()
{
    entity.Space.Remove(entity);
    SceneManager.PhysicsManager.PhysicsObjects.Remove(this);
}
</pre></p>
<p>The first initializes a new &#8220;Box&#8221; object entity and adds it to the &#8220;PhysicsManager&#8221; list, whilst the second removes the object.  That&#8217;s all for now with this class.  We will be returning to it to add properties later on, but for now, you have successfully integrated BEPU Physics into the engine.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/projectvanquish.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/projectvanquish.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/projectvanquish.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/projectvanquish.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/projectvanquish.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/projectvanquish.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/projectvanquish.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/projectvanquish.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/projectvanquish.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/projectvanquish.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/projectvanquish.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/projectvanquish.wordpress.com/431/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/projectvanquish.wordpress.com/431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/projectvanquish.wordpress.com/431/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=431&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://projectvanquish.wordpress.com/2012/02/23/extending-the-scenemanager-and-introducing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9314f9e69706f0469b5272e25803160e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ardman</media:title>
		</media:content>
	</item>
		<item>
		<title>Extending the Actor class</title>
		<link>http://projectvanquish.wordpress.com/2012/02/23/extending-the-actor-class/</link>
		<comments>http://projectvanquish.wordpress.com/2012/02/23/extending-the-actor-class/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 12:36:23 +0000</pubDate>
		<dc:creator>Neil_Knight</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[Models]]></category>

		<guid isPermaLink="false">http://projectvanquish.wordpress.com/?p=420</guid>
		<description><![CDATA[In this post we&#8217;ll extend the &#8220;Actor&#8221; class to include a few more useful properties. We&#8217;ll start of by creating a new folder under the &#8220;Models&#8221; folder called &#8220;Interfaces&#8221;. In this new folder, create an interface called &#8220;IEntity&#8221;. Add the &#8230; <a href="http://projectvanquish.wordpress.com/2012/02/23/extending-the-actor-class/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=420&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this post we&#8217;ll extend the &#8220;Actor&#8221; class to include a few more useful properties.  We&#8217;ll start of by creating a new folder under the &#8220;Models&#8221; folder called &#8220;Interfaces&#8221;.  In this new folder, create an interface called &#8220;IEntity&#8221;.  Add the following namespaces:<br />
<pre class="brush: csharp;">
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
</pre><br />
The interface will look like below:<br />
<pre class="brush: csharp;">
interface IEntity
{
    BoundingBox BoundingBox { get; }

    Model Model { get; set; }

    Vector3 Position { get; set; }

    Vector3 Rotation { get; set; }

    Vector3 Scale { get; set; }
}
</pre></p>
<p>That&#8217;s all we need for the interface.  Now we just need to hook that up with the &#8220;Actor&#8221; class.  Open the &#8220;Actor&#8221; class and change the class declaration to:<br />
<pre class="brush: csharp;">
public class Actor : IEntity
</pre></p>
<p>We need to add in the new properties from the interface into our &#8220;Actor&#8221; class:<br />
<pre class="brush: csharp;">
public BoundingBox BoundingBox 
{ 
    get { return new BoundingBox(Position - Scale / 2f, Position + Scale / 2f); }
}

public Vector3 Position 
{ 
    get { return position; } 
    set { position = value; } 
}

public Vector3 Rotation 
{ 
    get { return rotation; } 
    set { rotation = value; } 
}

public Vector3 Scale 
{ 
    get { return scale; } 
    set { scale = value; } 
}
</pre></p>
<p>That&#8217;s it.  We now have a calculated BoundingBox for our model which will come in handy when we introduce the Physics part of the engine.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/projectvanquish.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/projectvanquish.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/projectvanquish.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/projectvanquish.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/projectvanquish.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/projectvanquish.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/projectvanquish.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/projectvanquish.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/projectvanquish.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/projectvanquish.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/projectvanquish.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/projectvanquish.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/projectvanquish.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/projectvanquish.wordpress.com/420/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=420&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://projectvanquish.wordpress.com/2012/02/23/extending-the-actor-class/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9314f9e69706f0469b5272e25803160e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ardman</media:title>
		</media:content>
	</item>
		<item>
		<title>SSAO Fix</title>
		<link>http://projectvanquish.wordpress.com/2012/02/21/ssao-fix/</link>
		<comments>http://projectvanquish.wordpress.com/2012/02/21/ssao-fix/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 21:51:18 +0000</pubDate>
		<dc:creator>Neil_Knight</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[SSAO]]></category>

		<guid isPermaLink="false">http://projectvanquish.wordpress.com/?p=411</guid>
		<description><![CDATA[I was running through some code and stumbled across a problem with the Screen Space Ambient Occlusion. When I started to debug this, I noticed that the output of the RenderTarget was a solid grey window. After looking into it &#8230; <a href="http://projectvanquish.wordpress.com/2012/02/21/ssao-fix/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=411&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was running through some code and stumbled across a problem with the Screen Space Ambient Occlusion.  When I started to debug this, I noticed that the output of the RenderTarget was a solid grey window.  After looking into it in more detail, I released that I wasn&#8217;t setting the correct RenderTarget in the Draw code.  I&#8217;ve now corrected this, but I think it could still do with some work as it looks as if something is slightly wrong with it.  However, whilst I had my debugging hat on, I got stuck into the Shadow Mapping.  I have managed to fix the Depth RenderTarget, but the Shadow Occlusion is still causing a slight issue.  I&#8217;m slowly but surely getting there.</p>
<p>SSAO Off:<br />
<a href="http://projectvanquish.files.wordpress.com/2012/02/ssao_off.png"><img src="http://projectvanquish.files.wordpress.com/2012/02/ssao_off.png?w=593&#038;h=463" alt="" title="SSAO_Off" width="593" height="463" class="alignnone size-full wp-image-421" /></a></p>
<p>SSAO On:<br />
<a href="http://projectvanquish.files.wordpress.com/2012/02/ssao_on.png"><img src="http://projectvanquish.files.wordpress.com/2012/02/ssao_on.png?w=593&#038;h=463" alt="" title="SSAO_On" width="593" height="463" class="alignnone size-full wp-image-422" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/projectvanquish.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/projectvanquish.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/projectvanquish.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/projectvanquish.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/projectvanquish.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/projectvanquish.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/projectvanquish.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/projectvanquish.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/projectvanquish.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/projectvanquish.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/projectvanquish.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/projectvanquish.wordpress.com/411/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/projectvanquish.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/projectvanquish.wordpress.com/411/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=411&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://projectvanquish.wordpress.com/2012/02/21/ssao-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9314f9e69706f0469b5272e25803160e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ardman</media:title>
		</media:content>

		<media:content url="http://projectvanquish.files.wordpress.com/2012/02/ssao_off.png" medium="image">
			<media:title type="html">SSAO_Off</media:title>
		</media:content>

		<media:content url="http://projectvanquish.files.wordpress.com/2012/02/ssao_on.png" medium="image">
			<media:title type="html">SSAO_On</media:title>
		</media:content>
	</item>
		<item>
		<title>New CameraManager class</title>
		<link>http://projectvanquish.wordpress.com/2012/02/21/new-cameramanager-class/</link>
		<comments>http://projectvanquish.wordpress.com/2012/02/21/new-cameramanager-class/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 14:42:59 +0000</pubDate>
		<dc:creator>Neil_Knight</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[Camera Manager]]></category>

		<guid isPermaLink="false">http://projectvanquish.wordpress.com/?p=401</guid>
		<description><![CDATA[More improvements have been added with the introduction of a new &#8220;CameraManager&#8221; class. Overall, the changes were quite large, so I&#8217;ll sum up the amends here but the full version can be found here. The idea behind the &#8220;CameraManager&#8221; class &#8230; <a href="http://projectvanquish.wordpress.com/2012/02/21/new-cameramanager-class/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=401&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>More improvements have been added with the introduction of a new &#8220;CameraManager&#8221; class.  Overall, the changes were quite large, so I&#8217;ll sum up the amends here but the full version can be found <a href="http://projectvanquish.codeplex.com/SourceControl/list/changesets" target="_blank">here</a>.</p>
<p>The idea behind the &#8220;CameraManager&#8221; class was to allow multiple cameras to be instantiated and used.  Before, everything was hard-coded to a &#8220;FirstPersonCamera&#8221; and now the camera classes inherit from a new &#8220;ICamera&#8221; interface.  This allows for a camera class to be passed through the engine without actually knowing what type of camera it is.  The new &#8220;CameraManager&#8221; class sits inside of the &#8220;Core&#8221; folder.  It has 4 simple methods which allow you to add, remove, set and get a camera.  The &#8220;SceneManager&#8221; class has been altered to automatically create a &#8220;FirstPersonCamera&#8221; and assigns a name of &#8220;Default&#8221;.  I&#8217;ll quickly run through the new methods:<br />
<pre class="brush: csharp;">
public static void AddCamera(string name, ICamera camera);
</pre></p>
<p>&#8220;AddCamera&#8221; allows you to add a new camera.  As it&#8217;s a <code>static</code> method (and so are the other methods), you use it like:<br />
<pre class="brush: csharp;">
CameraManager.AddCamera(&quot;Camera1&quot;, new PerspectiveCamera(MathHelper.PiOver2, 
                                                         GraphicsDevice.Viewport.AspectRatio, 
                                                         1.0f, 100.0f)); 
</pre></p>
<p><pre class="brush: csharp;">
public static ICamera GetActiveCamera();
</pre></p>
<p>&#8220;GetActiveCamera&#8221; does exactly what it says, it will return the camera that is currently set as active.  If no camera is found, then it will throw an exception.</p>
<p><pre class="brush: csharp;">
public static void RemoveCamera(string name);
</pre></p>
<p>&#8220;RemoveCamera&#8221; will remove the camera with the specified name.</p>
<p><pre class="brush: csharp;">
public static void SetActiveCamera(string name);
</pre></p>
<p>&#8220;SetActiveCamera&#8221; will assign the active camera to the specified name.  If the specified camera name does not exist in the camera collection, it will throw an exception.</p>
<p>That is pretty much it.  Just a quick summary post of the new class.  I would download the latest changeset to see the implications that the new class has had on the structure of the engine.  Thanks to the new interface &#8220;ICamera&#8221;, passing cameras between renderers is now a lot easier.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/projectvanquish.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/projectvanquish.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/projectvanquish.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/projectvanquish.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/projectvanquish.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/projectvanquish.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/projectvanquish.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/projectvanquish.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/projectvanquish.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/projectvanquish.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/projectvanquish.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/projectvanquish.wordpress.com/401/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/projectvanquish.wordpress.com/401/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/projectvanquish.wordpress.com/401/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=401&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://projectvanquish.wordpress.com/2012/02/21/new-cameramanager-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9314f9e69706f0469b5272e25803160e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ardman</media:title>
		</media:content>
	</item>
		<item>
		<title>Latest version of source code now in Codeplex</title>
		<link>http://projectvanquish.wordpress.com/2012/02/21/latest-version-of-source-code-now-in-codeplex/</link>
		<comments>http://projectvanquish.wordpress.com/2012/02/21/latest-version-of-source-code-now-in-codeplex/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 09:56:26 +0000</pubDate>
		<dc:creator>Neil_Knight</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[Codeplex]]></category>
		<category><![CDATA[Physics Engine]]></category>
		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://projectvanquish.wordpress.com/?p=408</guid>
		<description><![CDATA[Just to let you all know that I&#8217;ve managed to get round to uploading the source code into the Codeplex project. This includes the new &#8220;Actor&#8221; class, which I&#8217;m looking at extending over the next couple of days. Currently researching &#8230; <a href="http://projectvanquish.wordpress.com/2012/02/21/latest-version-of-source-code-now-in-codeplex/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=408&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Just to let you all know that I&#8217;ve managed to get round to uploading the source code into the <a href="http://projectvanquish.wordpress.com/" target="_blank">Codeplex</a> project.  This includes the new &#8220;Actor&#8221; class, which I&#8217;m looking at extending over the next couple of days.  Currently researching BEPU Physics as the preferred Physics engine.  More to come soon&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/projectvanquish.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/projectvanquish.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/projectvanquish.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/projectvanquish.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/projectvanquish.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/projectvanquish.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/projectvanquish.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/projectvanquish.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/projectvanquish.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/projectvanquish.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/projectvanquish.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/projectvanquish.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/projectvanquish.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/projectvanquish.wordpress.com/408/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=408&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://projectvanquish.wordpress.com/2012/02/21/latest-version-of-source-code-now-in-codeplex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9314f9e69706f0469b5272e25803160e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ardman</media:title>
		</media:content>
	</item>
		<item>
		<title>New Actor class</title>
		<link>http://projectvanquish.wordpress.com/2012/02/20/new-actor-class/</link>
		<comments>http://projectvanquish.wordpress.com/2012/02/20/new-actor-class/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 15:58:50 +0000</pubDate>
		<dc:creator>Neil_Knight</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[Deferred Rendering]]></category>
		<category><![CDATA[Models]]></category>

		<guid isPermaLink="false">http://projectvanquish.wordpress.com/?p=391</guid>
		<description><![CDATA[After the tidy up, it was apparent that the current &#8220;SceneManager&#8221; wasn&#8217;t going to last much longer due to variables being hardcoded. So, I decided to create a small &#8220;Actor&#8221; class that will expand over time, but it will help &#8230; <a href="http://projectvanquish.wordpress.com/2012/02/20/new-actor-class/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=391&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After the tidy up, it was apparent that the current &#8220;SceneManager&#8221; wasn&#8217;t going to last much longer due to variables being hardcoded.  So, I decided to create a small &#8220;Actor&#8221; class that will expand over time, but it will help out the &#8220;SceneManager&#8221; class and mean that we can position models.  </p>
<p>In the &#8220;ProjectVanquish&#8221; project, create a new folder called &#8220;Models&#8221; and in there create a new class called &#8220;Actor&#8221;.  Make the class <code>public</code>.  Also, add the following namespaces:<br />
<pre class="brush: csharp;">
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
</pre></p>
<p>We&#8217;ll add a couple of variables:<br />
<pre class="brush: csharp;">
Model model;
Vector3 position, rotation, scale; 
</pre></p>
<p>So, we&#8217;ll store a Model and its position, rotation and scale.  Simple enough.  We&#8217;ll add a default constructor:<br />
<pre class="brush: csharp;">
public Actor(Model model)
{
    this.model = model;
    position = Vector3.Zero;
    rotation = Vector3.Zero;
    scale = Vector3.One;
}
</pre></p>
<p>We&#8217;ll use this in our &#8220;SceneManager&#8221; class, but we&#8217;ll be adding 3 more constructor for completeness.<br />
<pre class="brush: csharp;">
public Actor(Model model, Vector3 position)
{
    this.model = model;
    this.position = position;
    rotation = Vector3.Zero;
    scale = Vector3.One;
} 

public Actor(Model model, Vector3 position, Vector3 rotation)
{
    this.model = model;
    this.position = position;
    this.rotation = rotation;
    scale = Vector3.One;
} 

public Actor(Model model, Vector3 position, Vector3 rotation, Vector3 scale)
{
    this.model = model;
    this.position = position;
    this.rotation = rotation;
    this.scale = scale;
} 
</pre></p>
<p>So, you can see that we are allowing for the alterations of the Position, Rotation and Scale.  I would like to have used Optional Parameters, but I can&#8217;t use <code>Vector3.Zero</code> as it&#8217;s a runtime constant and not compile-time.</p>
<p>To finish the class, we&#8217;ll add a couple of properties:<br />
<pre class="brush: csharp;">
public Model Model
{
    get { return model; }
}

public Matrix World
{
    get
    {
        return Matrix.CreateTranlsation(position) * Matrix.CreateScale(scale)
             * Matrix.CreateRotationX(rotation.X) * Matrix.CreateRotationY(rotation.Y)
             * Matrix.CreateRotationZ(rotation.Z);
    }
}
</pre></p>
<p>That&#8217;s the new &#8220;Actor&#8221; class finished for the time being.  All that is left is to alter the &#8220;SceneManager&#8221; class to cater for the new class.  We will need to add our new namespace:<br />
<pre class="brush: csharp;">
using ProjectVanquish.Models;
</pre></p>
<p>Then we&#8217;ll start with the Models variable:<br />
<pre class="brush: csharp;">
static IList&lt;Actor&gt; models;
</pre></p>
<p>Amend the declaration in the constructor:<br />
<pre class="brush: csharp;">
models = new List&lt;Actor&gt;();
</pre></p>
<p>We need to modify the Property:<br />
<pre class="brush: csharp;">
public IList&lt;Actor&gt; Models
{
    get { return models; }
}
</pre></p>
<p>Now, we just need to modify the Members and we finished with the &#8220;ProjectVanquish&#8221; project:<br />
<pre class="brush: csharp;">
public static void AddModel(Model model)
{
    models.Add(new Actor(model));
}

public void Draw()
{
    // RenderStates etc. here

    foreach (Actor actor in models)
        DrawModel(actor.Model, actor.World, camera);
}
</pre></p>
<p>The last change to make is to the Draw with Effect member.  The change is basically going from:<br />
<pre class="brush: csharp;">
for (int j = 0; j &lt; models[i].Meshes.Count; j++)


Model mesh = models[i].Meshes[j];
</pre></p>
<p>to<br />
<pre class="brush: csharp;">
for (int j = 0; j &lt; models[i].Model.Meshes.Count; j++)


Model mesh = models[i].Model.Meshes[j];
</pre></p>
<p>Lastly, there is the Matrix that will need to be altered:<br />
<pre class="brush: csharp;">
Matrix world = models[i].World;
</pre></p>
<p>That&#8217;s all.  We have enabled 4 constructors in the &#8220;Actor&#8221; class, but we don&#8217;t have any means of using 3 of them.  We&#8217;ll create the &#8220;AddModel&#8221; methods in the &#8220;SceneManager&#8221; class, just copy and paste the below:<br />
<pre class="brush: csharp;">
public static void AddModel(Model model, Vector3 position)
{
    models.Add(new Actor(model, position));
}

public static void AddModel(Model model, Vector3 position, Vector3 rotation)
{
    models.Add(new Actor(model, position, rotation));
}

public static void AddModel(Model model, Vector3 position, Vector3 rotation, Vector3 scale)
{
    models.Add(new Actor(model, position, rotation, scale));
}
</pre></p>
<p>You&#8217;ll be able to use these new methods in the &#8220;Game1&#8243; class.  That&#8217;s all for now.  Will carry on banging head against keyboard until Shadow Mapping is working.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/projectvanquish.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/projectvanquish.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/projectvanquish.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/projectvanquish.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/projectvanquish.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/projectvanquish.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/projectvanquish.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/projectvanquish.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/projectvanquish.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/projectvanquish.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/projectvanquish.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/projectvanquish.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/projectvanquish.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/projectvanquish.wordpress.com/391/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=391&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://projectvanquish.wordpress.com/2012/02/20/new-actor-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9314f9e69706f0469b5272e25803160e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ardman</media:title>
		</media:content>
	</item>
		<item>
		<title>Project is now in Codeplex</title>
		<link>http://projectvanquish.wordpress.com/2012/02/20/project-is-now-in-codeplex/</link>
		<comments>http://projectvanquish.wordpress.com/2012/02/20/project-is-now-in-codeplex/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 12:09:39 +0000</pubDate>
		<dc:creator>Neil_Knight</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[Codeplex]]></category>
		<category><![CDATA[Deferred Rendering]]></category>

		<guid isPermaLink="false">http://projectvanquish.wordpress.com/?p=395</guid>
		<description><![CDATA[After speaking with Mash at the weekend, I have tidied up the code and managed to create a Codeplex project. Currently, the source code is available for download as a whole. I&#8217;ve not had a chance to set the project &#8230; <a href="http://projectvanquish.wordpress.com/2012/02/20/project-is-now-in-codeplex/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=395&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After speaking with Mash at the weekend, I have tidied up the code and managed to create a Codeplex project.  Currently, the source code is available for download as a whole.  I&#8217;ve not had a chance to set the project up with full source code as yet but it will be done in the near future.  Anyways, here is the link:</p>
<p><a href="http://projectvanquish.codeplex.com/" target="_blank">Project Vanquish on Codeplex</a></p>
<p>I had a slight tidy up of the source code as well.  I&#8217;ve also altered the way that you add a Model.  The &#8220;SceneManager&#8221; class is now public and &#8220;AddModel&#8221; is now static, allowing you to add a model using the following code:<br />
<pre class="brush: csharp;">
SceneManager.AddModel(Content.Load&lt;Model&gt;(&quot;Models/Sponza&quot;));
</pre></p>
<p>I&#8217;ll carry on implementing new things whilst tidying up some more.  One point that has been highlighted from the tidy up, is the need for a Model class.  I&#8217;ll think about doing this next, but would love to get the shadows working first.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/projectvanquish.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/projectvanquish.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/projectvanquish.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/projectvanquish.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/projectvanquish.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/projectvanquish.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/projectvanquish.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/projectvanquish.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/projectvanquish.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/projectvanquish.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/projectvanquish.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/projectvanquish.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/projectvanquish.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/projectvanquish.wordpress.com/395/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=395&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://projectvanquish.wordpress.com/2012/02/20/project-is-now-in-codeplex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9314f9e69706f0469b5272e25803160e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ardman</media:title>
		</media:content>
	</item>
		<item>
		<title>A general tidy up</title>
		<link>http://projectvanquish.wordpress.com/2012/02/18/a-general-tidy-up/</link>
		<comments>http://projectvanquish.wordpress.com/2012/02/18/a-general-tidy-up/#comments</comments>
		<pubDate>Sat, 18 Feb 2012 09:39:26 +0000</pubDate>
		<dc:creator>Neil_Knight</dc:creator>
				<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://projectvanquish.wordpress.com/?p=373</guid>
		<description><![CDATA[Over the next couple of days, I&#8217;ll be revisiting the project as a whole and doing some tidying up. The shadow mapping still isn&#8217;t working which I will revisit after the tidy up. The tidy up will consist of some &#8230; <a href="http://projectvanquish.wordpress.com/2012/02/18/a-general-tidy-up/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=373&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Over the next couple of days, I&#8217;ll be revisiting the project as a whole and doing some tidying up.  The shadow mapping still isn&#8217;t working which I will revisit after the tidy up.  The tidy up will consist of some design alterations which will make it easier to adjust things like the SSAO Range and Distance, plus I&#8217;m really tempted to add a new Light Manager as currently there it&#8217;s hardcoded.  That&#8217;s where I&#8217;ll be for the next couple of days, so if you have any requests as to what you&#8217;d like to have in the engine, post a comment <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Some planned items for the future are to include physics, some form of Anti-Aliasing and some more post processing such as Depth of Field.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/projectvanquish.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/projectvanquish.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/projectvanquish.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/projectvanquish.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/projectvanquish.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/projectvanquish.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/projectvanquish.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/projectvanquish.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/projectvanquish.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/projectvanquish.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/projectvanquish.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/projectvanquish.wordpress.com/373/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/projectvanquish.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/projectvanquish.wordpress.com/373/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=373&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://projectvanquish.wordpress.com/2012/02/18/a-general-tidy-up/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9314f9e69706f0469b5272e25803160e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ardman</media:title>
		</media:content>
	</item>
		<item>
		<title>Bloom</title>
		<link>http://projectvanquish.wordpress.com/2012/02/17/bloom/</link>
		<comments>http://projectvanquish.wordpress.com/2012/02/17/bloom/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 13:24:42 +0000</pubDate>
		<dc:creator>Neil_Knight</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[Bloom]]></category>
		<category><![CDATA[Deferred Rendering]]></category>
		<category><![CDATA[Post Processing]]></category>

		<guid isPermaLink="false">http://projectvanquish.wordpress.com/?p=365</guid>
		<description><![CDATA[In this post, we&#8217;ll be adding a Bloom Post Processing effect. We&#8217;ll start of simple by adding in some new folders. In the &#8220;ProjectVanquish&#8221; project, under the &#8220;Renderers&#8221; folder, create a new folder called &#8220;PostProcessing&#8221;. In the &#8220;ProjectVanquishTestContent&#8221; project, under &#8230; <a href="http://projectvanquish.wordpress.com/2012/02/17/bloom/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=365&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this post, we&#8217;ll be adding a Bloom Post Processing effect.  We&#8217;ll start of simple by adding in some new folders.  In the &#8220;ProjectVanquish&#8221; project, under the &#8220;Renderers&#8221; folder, create a new folder called &#8220;PostProcessing&#8221;.  In the &#8220;ProjectVanquishTestContent&#8221; project, under the &#8220;Shaders&#8221; folder, create a new one called &#8220;PostProcessing&#8221;.  Then inside the new folder, create another called &#8220;Bloom&#8221;.</p>
<p>Now that&#8217;s out of the way, let&#8217;s create the &#8220;Bloom&#8221; class.  Add a new class to the &#8220;PostProcessing&#8221; folder in the &#8220;ProjectVanquish&#8221; project and name it &#8220;Bloom&#8221;.</p>
<p>Add the following namespaces:<br />
<pre class="brush: csharp;">
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
</pre></p>
<p>Now we can add our variables:<br />
<pre class="brush: csharp;">
Effect bloomEffect, blurEffect, finalEffect;
RenderTarget2D bloomRT, blurHRT, blurVRT;
QuadRenderer fullscreenQuad;
</pre></p>
<p>Nothing out of the ordinary there.  Moving onto the constructor, we will instantiate these new variables ready for use in the &#8220;Draw&#8221; method:<br />
<pre class="brush: csharp;">
public Bloom(GraphicsDevice device, ContentManager content)
{
    bloomEffect = content.Load&lt;Effect&gt;(&quot;Shaders/PostProcessing/Bloom/Bloom&quot;);
    blurEffect = content.Load&lt;Effect&gt;(&quot;Shaders/PostProcessing/Bloom/Blur&quot;);
    finalEffect = content.Load&lt;Effect&gt;(&quot;Shaders/PostProcessing/Bloom/Final&quot;);

    bloomRT = new RenderTarget2D(device, device.PresentationParameters.BackBufferWidth,
                             device.PresentationParameters.BackBufferHeight,
                             false, SurfaceFormat.Color, DepthFormat.None);
    blurHRT = new RenderTarget2D(device, device.PresentationParameters.BackBufferWidth, 
                             device.PresentationParameters.BackBufferHeight,
                             false, SurfaceFormat.Color, DepthFormat.None);
    blurVRT = new RenderTarget2D(device, device.PresentationParameters.BackBufferWidth, 
                             device.PresentationParameters.BackBufferHeight,
                             false, SurfaceFormat.Color, DepthFormat.None);

    fullscreenQuad = new QuadRenderer(device);
}
</pre></p>
<p>We&#8217;ll finish off the class before we create our new Effects.  We&#8217;ll create our last method for the class, &#8220;Draw&#8221;.  In this code, we&#8217;ll take our RenderTarget output from the &#8220;SSAORenderer&#8221; and we&#8217;ll apply a two pass blur and then combine the final result:<br />
<pre class="brush: csharp;">
public void Draw(GraphicsDevice device, RenderTarget2D sceneRT)
{
    // Bloom pass
    device.SetRenderTarget(bloomRT);
    device.Clear(Color.Black);
    device.Textures[0] = sceneRT;
    bloomEffect.CurrentTechnique.Passes[0].Apply();
    fullscreenQuad.Draw();
    device.SetRenderTarget(null);

    // Horizontal pass
    device.SetRenderTarget(blurHRT);
    device.Clear(Color.Black);
    device.Textures[0] = bloomRT;
    blurEffect.CurrentTechnique.Passes[0].Apply();
    fullscreenQuad.Draw();
    device.SetRenderTarget(null);

    // Vertical pass
    device.SetRenderTarget(blurVRT);
    device.Clear(Color.Black);
    device.Textures[0] = blurHRT;
    blurEffect.CurrentTechnique.Passes[0].Apply();
    fullscreenQuad.Draw();
    device.SetRenderTarget(null);

    // Final pass
    device.Clear(Color.Black);
    device.Textures[0] = blurVRT;
    finalEffect.Parameters[&quot;ColorMap&quot;].SetValue(sceneRT);
    finalEffect.CurrentTechnique.Passes[0].Apply();
    fullscreenQuad.Draw();
}
</pre></p>
<p>That is the &#8220;Bloom&#8221; class complete.  We&#8217;ll quickly add this to the &#8220;DeferredRenderer&#8221; class so we can then move onto the Effects.  In the &#8220;DeferredRenderer&#8221; class, declare the namespace:<br />
<pre class="brush: csharp;">
using ProjectVanquish.Renderers.PostProcessing;
</pre></p>
<p>Now we can declare two new variables:<br />
<pre class="brush: csharp;">
RenderTarget2D bloomRT;
Bloom bloom;
</pre></p>
<p>In the constructor, we can instantiate the new class:<br />
<pre class="brush: csharp;">
bloomRT = new RenderTarget2D(device, backbufferWidth, backbufferHeight, false, 
                             SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
bloom = new Bloom(device, content);
</pre></p>
<p>Lastly, we just need to add the &#8220;Draw&#8221; call in the &#8220;Draw&#8221; method.  We also need to alter the &#8220;SSAORenderer&#8221; call:<br />
<pre class="brush: csharp;">
ssaoRenderer.Draw(device, renderTargets, sceneRT, sceneManager, bloomRT);
bloom.Draw(device, bloomRT);
</pre></p>
<p>That&#8217;s all of the class code complete.  Now we can move onto the Shaders, starting with the &#8220;Bloom&#8221;.  Create a new Effect file in the &#8220;Bloom&#8221; folder called &#8220;Bloom&#8221;.  Remove all default contents and replace with the following:<br />
<pre class="brush: csharp;">
sampler TextureSampler : register(s0);

float Threshold = 0.3;

float4 PixelShaderFunction(float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 Color = tex2D(TextureSampler, texCoord);
    
    // Get the bright areas that is brighter than Threshold and return it.
    return saturate((Color - Threshold) / (1 - Threshold));
}

technique Bloom
{
    pass Pass1
    {
        PixelShader = compile ps_3_0 PixelShaderFunction();
    }
}
</pre></p>
<p>Quite straight forward.  It gets the bright areas that are brighter than the Threshold and saturates it.  Create a new file called &#8220;Blur&#8221; and remove the default contents.  Replace with:<br />
<pre class="brush: csharp;">
// The blur amount( how far away from our texel will we look up neighbour texels? )
float BlurDistance = 0.003f;

// This will use the texture bound to the object( like from the sprite batch ).
sampler ColorMapSampler : register(s0);
 
float4 PixelShaderFunction(float2 Tex: TEXCOORD0) : COLOR
{
    float4 Color;
 
    // Get the texel from ColorMapSampler using a modified texture coordinate. This
    // gets the texels at the neighbour texels and adds it to Color.
	Color  = tex2D( ColorMapSampler, float2(Tex.x+BlurDistance, Tex.y+BlurDistance));
	Color += tex2D( ColorMapSampler, float2(Tex.x-BlurDistance, Tex.y-BlurDistance));
	Color += tex2D( ColorMapSampler, float2(Tex.x+BlurDistance, Tex.y-BlurDistance));
	Color += tex2D( ColorMapSampler, float2(Tex.x-BlurDistance, Tex.y+BlurDistance));
    // We need to devide the color with the amount of times we added
    // a color to it, in this case 4, to get the avg. color
    Color = Color / 4; 
 
    // returned the blurred color
    return Color;
}

technique Blur
{
	pass Pass1
	{
		PixelShader = compile ps_3_0 PixelShaderFunction();
	}
}
</pre></p>
<p>This will apply a Blur effect to the RenderTarget.  Lastly, we create a new Effect file called &#8220;Final&#8221;.  Once again, remove the default contents and replace with:<br />
<pre class="brush: csharp;">
sampler BloomSampler : register(s0);

// Our original SceneTexture
texture ColorMap;

// Create a sampler for the ColorMap texture using lianear filtering and clamping
sampler ColorMapSampler = sampler_state
{
   Texture = &lt;ColorMap&gt;;
   MinFilter = Linear;
   MagFilter = Linear;
   MipFilter = Linear;   
   AddressU  = Clamp;
   AddressV  = Clamp;
};

// Controls the Intensity of the bloom texture
float BloomIntensity = 1.3;

// Controls the Intensity of the original scene texture
float OriginalIntensity = 1.0;

// Saturation amount on bloom
float BloomSaturation = 1.0;

// Saturation amount on original scene
float OriginalSaturation = 1.0;

float4 AdjustSaturation(float4 color, float saturation)
{
    // We define gray as the same color we used in the grayscale shader
    float grey = dot(color, float3(0.3, 0.59, 0.11));
    
    return lerp(grey, color, saturation);
}

float4 PixelShaderFunction(float2 texCoord : TEXCOORD0) : COLOR0
{
	// Get our bloom pixel from bloom texture
	float4 bloomColor = tex2D(BloomSampler, texCoord);

	// Get our original pixel from ColorMap
	float4 originalColor = tex2D(ColorMapSampler, texCoord);
    
    // Adjust color saturation and intensity based on the input variables to the shader
	bloomColor = AdjustSaturation(bloomColor, BloomSaturation) * BloomIntensity;
	originalColor = AdjustSaturation(originalColor, OriginalSaturation) * OriginalIntensity;
    
    // make the originalColor darker in very bright areas, avoiding these areas look burned-out
    originalColor *= (1 - saturate(bloomColor));
    
    // Combine the two images.
    return originalColor + bloomColor;
}

technique BloomFinal
{
    pass Pass1
    {
        PixelShader = compile ps_3_0 PixelShaderFunction();
    }
}
</pre></p>
<p>This combines the bloom texture with the original scene texture.  BloomIntensity, OriginalIntensity, BloomSaturation and OriginalSaturation is used to control the blooming effect.  This Bloom effect is based on the sample found at <a href="http://create.msdn.com" target="_blank">create.msdn.com</a>.</p>
<p>In the screenshot below, I&#8217;ve added an extra 2 Point Lights:<br />
<a href="http://projectvanquish.files.wordpress.com/2012/02/bloom.png"><img src="http://projectvanquish.files.wordpress.com/2012/02/bloom.png?w=593&#038;h=463" alt="" title="Bloom" width="593" height="463" class="alignnone size-full wp-image-374" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/projectvanquish.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/projectvanquish.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/projectvanquish.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/projectvanquish.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/projectvanquish.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/projectvanquish.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/projectvanquish.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/projectvanquish.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/projectvanquish.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/projectvanquish.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/projectvanquish.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/projectvanquish.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/projectvanquish.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/projectvanquish.wordpress.com/365/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=projectvanquish.wordpress.com&amp;blog=31606032&amp;post=365&amp;subd=projectvanquish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://projectvanquish.wordpress.com/2012/02/17/bloom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9314f9e69706f0469b5272e25803160e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ardman</media:title>
		</media:content>

		<media:content url="http://projectvanquish.files.wordpress.com/2012/02/bloom.png" medium="image">
			<media:title type="html">Bloom</media:title>
		</media:content>
	</item>
	</channel>
</rss>
