<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Four Uses of VTF</title>
	<atom:link href="http://www.catalinzima.com/tutorials/4-uses-of-vtf/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.catalinzima.com</link>
	<description>XNA Tutorials, Samples and Thoughts</description>
	<lastBuildDate>Wed, 01 Feb 2012 17:36:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: JG</title>
		<link>http://www.catalinzima.com/tutorials/4-uses-of-vtf/comment-page-1/#comment-32151</link>
		<dc:creator>JG</dc:creator>
		<pubDate>Tue, 21 Dec 2010 20:22:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?page_id=13#comment-32151</guid>
		<description>http://web.archive.org/web/20080102024317/http://www.ziggyware.com/readarticle.php?article_id=127</description>
		<content:encoded><![CDATA[<p><a href="http://web.archive.org/web/20080102024317/http://www.ziggyware.com/readarticle.php?article_id=127" rel="nofollow">http://web.archive.org/web/20080102024317/http://www.ziggyware.com/readarticle.php?article_id=127</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DragonSix</title>
		<link>http://www.catalinzima.com/tutorials/4-uses-of-vtf/comment-page-1/#comment-31889</link>
		<dc:creator>DragonSix</dc:creator>
		<pubDate>Sun, 28 Nov 2010 06:48:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?page_id=13#comment-31889</guid>
		<description>I found the original files here: http://catalinzima.spaces.live.com/blog/cns!3D9ECAE1F2DC56EF!267.entry
It&#039;s on an old xna version, making it hard to understand and use. Hopefully you&#039;ll find the time to upgrade those.</description>
		<content:encoded><![CDATA[<p>I found the original files here: <a href="http://catalinzima.spaces.live.com/blog/cns!3D9ECAE1F2DC56EF!267.entry" rel="nofollow">http://catalinzima.spaces.live.com/blog/cns!3D9ECAE1F2DC56EF!267.entry</a><br />
It&#8217;s on an old xna version, making it hard to understand and use. Hopefully you&#8217;ll find the time to upgrade those.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Month Later</title>
		<link>http://www.catalinzima.com/tutorials/4-uses-of-vtf/comment-page-1/#comment-27342</link>
		<dc:creator>Month Later</dc:creator>
		<pubDate>Wed, 10 Mar 2010 18:48:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?page_id=13#comment-27342</guid>
		<description>This looked good, hope you get time to repost this.</description>
		<content:encoded><![CDATA[<p>This looked good, hope you get time to repost this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lakstyo</title>
		<link>http://www.catalinzima.com/tutorials/4-uses-of-vtf/comment-page-1/#comment-26684</link>
		<dc:creator>lakstyo</dc:creator>
		<pubDate>Wed, 10 Feb 2010 09:55:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?page_id=13#comment-26684</guid>
		<description>Hi, 
I think I really need your VTF article.
Since I googled and can&#039;t found reliable article abaut VTF in XNA, especially abaout implementing VTF in particle rendering.

I hope you repost your article soon.
Thank you.

Regards</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I think I really need your VTF article.<br />
Since I googled and can&#8217;t found reliable article abaut VTF in XNA, especially abaout implementing VTF in particle rendering.</p>
<p>I hope you repost your article soon.<br />
Thank you.</p>
<p>Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Catalin Zima</title>
		<link>http://www.catalinzima.com/tutorials/4-uses-of-vtf/comment-page-1/#comment-26639</link>
		<dc:creator>Catalin Zima</dc:creator>
		<pubDate>Mon, 08 Feb 2010 18:17:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?page_id=13#comment-26639</guid>
		<description>Sorry.
I&#039;ll try to repost it on my site when I get some free time.</description>
		<content:encoded><![CDATA[<p>Sorry.<br />
I&#8217;ll try to repost it on my site when I get some free time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://www.catalinzima.com/tutorials/4-uses-of-vtf/comment-page-1/#comment-26638</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Mon, 08 Feb 2010 17:47:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?page_id=13#comment-26638</guid>
		<description>Thats because ziggyware is gone, its been down for a while now and apparently for good :(</description>
		<content:encoded><![CDATA[<p>Thats because ziggyware is gone, its been down for a while now and apparently for good <img src='http://www.catalinzima.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: th</title>
		<link>http://www.catalinzima.com/tutorials/4-uses-of-vtf/comment-page-1/#comment-26501</link>
		<dc:creator>th</dc:creator>
		<pubDate>Wed, 03 Feb 2010 05:30:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?page_id=13#comment-26501</guid>
		<description>the Ziggyware link is broken...</description>
		<content:encoded><![CDATA[<p>the Ziggyware link is broken&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Armigus</title>
		<link>http://www.catalinzima.com/tutorials/4-uses-of-vtf/comment-page-1/#comment-19404</link>
		<dc:creator>Armigus</dc:creator>
		<pubDate>Wed, 29 Apr 2009 01:21:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?page_id=13#comment-19404</guid>
		<description>Your vertex textures work well for smaller terrains like in your example but how about much larger ones (4097x4097)?  I have the foundation for an answer but I can&#039;t get it to work yet.

Part of the idea is to have the nodes of a quadtree maintain a Rectangle structure so that the leaves can have their own subset of the main texture:

private Texture2D BuildTex()
        {
            Rectangle texArea = _region.Augment(1,1);
            int xl = texArea.Width;
            int yl = texArea.Height;
            Color[] data = new Color[xl*yl];
            _root.Map.GetData(0, texArea, data, 0, data.Length);
            Texture2D tex = new Texture2D(_root.Game.GraphicsDevice, xl, yl);
            tex.SetData(data);

            return tex;
        }

QuadTerrain _root is the parent tree object reference for the nodes, and it maintains a Game reference and the main Texture2D Map.  _region is the Rectangle and the Augment method is a custom extension method:

 public static Rectangle Augment(this Rectangle r, int dx, int dy)
        {
            return new Rectangle(r.X, r.Y, r.Width + dx, r.Height + dy);
        }

The patchwork textures need common edges to stitch together properly.

During update each node checks itself for frustum visibility:

QuadNode:
public virtual void Update(BoundingFrustum cone)
        {
            _enabled = cone.Intersects(_boundary);
            if (_enabled)
                for (int c = 0; c &lt; 4; c++) _children[c].Update(cone);
        }

QuadLeaf :: QuadNode:
public override void Update(BoundingFrustum cone)
        {
            _enabled = cone.Intersects(_boundary);
        }

The QuadTerrain, as a GameComponent, sets things in motion:
 public override void Update(GameTime gameTime)
        {
            _root.Update(_cam.Frustum);
            base.Update(gameTime);
        }

My problem is that the leaves are not referencing separate pieces of the map as intended but are all showing the same part, and that part varies with camera location and direction!  Each leaf has a separate effect cloned from the parent in QuadTerrain and its own texture clipped from the original, so this should not happen.

The frustum culling works, BTW.

I originally wrote because I was getting no terrain at all, but adding the Update method to QuadTerrain fixed that.

I have way too much material for a more detailed disclosure right here.  I can send you what I have minus the big map textures (25 MB and nearly incompressible), but you will need to email me with a return address first.</description>
		<content:encoded><![CDATA[<p>Your vertex textures work well for smaller terrains like in your example but how about much larger ones (4097&#215;4097)?  I have the foundation for an answer but I can&#8217;t get it to work yet.</p>
<p>Part of the idea is to have the nodes of a quadtree maintain a Rectangle structure so that the leaves can have their own subset of the main texture:</p>
<p>private Texture2D BuildTex()<br />
        {<br />
            Rectangle texArea = _region.Augment(1,1);<br />
            int xl = texArea.Width;<br />
            int yl = texArea.Height;<br />
            Color[] data = new Color[xl*yl];<br />
            _root.Map.GetData(0, texArea, data, 0, data.Length);<br />
            Texture2D tex = new Texture2D(_root.Game.GraphicsDevice, xl, yl);<br />
            tex.SetData(data);</p>
<p>            return tex;<br />
        }</p>
<p>QuadTerrain _root is the parent tree object reference for the nodes, and it maintains a Game reference and the main Texture2D Map.  _region is the Rectangle and the Augment method is a custom extension method:</p>
<p> public static Rectangle Augment(this Rectangle r, int dx, int dy)<br />
        {<br />
            return new Rectangle(r.X, r.Y, r.Width + dx, r.Height + dy);<br />
        }</p>
<p>The patchwork textures need common edges to stitch together properly.</p>
<p>During update each node checks itself for frustum visibility:</p>
<p>QuadNode:<br />
public virtual void Update(BoundingFrustum cone)<br />
        {<br />
            _enabled = cone.Intersects(_boundary);<br />
            if (_enabled)<br />
                for (int c = 0; c &lt; 4; c++) _children.Update(cone);<br />
        }</p>
<p>QuadLeaf :: QuadNode:<br />
public override void Update(BoundingFrustum cone)<br />
        {<br />
            _enabled = cone.Intersects(_boundary);<br />
        }</p>
<p>The QuadTerrain, as a GameComponent, sets things in motion:<br />
 public override void Update(GameTime gameTime)<br />
        {<br />
            _root.Update(_cam.Frustum);<br />
            base.Update(gameTime);<br />
        }</p>
<p>My problem is that the leaves are not referencing separate pieces of the map as intended but are all showing the same part, and that part varies with camera location and direction!  Each leaf has a separate effect cloned from the parent in QuadTerrain and its own texture clipped from the original, so this should not happen.</p>
<p>The frustum culling works, BTW.</p>
<p>I originally wrote because I was getting no terrain at all, but adding the Update method to QuadTerrain fixed that.</p>
<p>I have way too much material for a more detailed disclosure right here.  I can send you what I have minus the big map textures (25 MB and nearly incompressible), but you will need to email me with a return address first.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wang dong</title>
		<link>http://www.catalinzima.com/tutorials/4-uses-of-vtf/comment-page-1/#comment-18619</link>
		<dc:creator>wang dong</dc:creator>
		<pubDate>Fri, 20 Mar 2009 13:12:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?page_id=13#comment-18619</guid>
		<description>In my computor, when I double click the *.sln file, a diagbox is poped-up ,showing that the *.csproj cannot be opend and the project type is not supported by this installation.

My compile enviroment is Microsoft studio 2005, XNA Game Studio 2.0.

I have also setup Microsoft Visual C# 2008 and XNA Game Studio 3.0

None of these can open your project

I have one XNA 2.0 demo project,and it is OK.</description>
		<content:encoded><![CDATA[<p>In my computor, when I double click the *.sln file, a diagbox is poped-up ,showing that the *.csproj cannot be opend and the project type is not supported by this installation.</p>
<p>My compile enviroment is Microsoft studio 2005, XNA Game Studio 2.0.</p>
<p>I have also setup Microsoft Visual C# 2008 and XNA Game Studio 3.0</p>
<p>None of these can open your project</p>
<p>I have one XNA 2.0 demo project,and it is OK.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Catalin Zima</title>
		<link>http://www.catalinzima.com/tutorials/4-uses-of-vtf/comment-page-1/#comment-11047</link>
		<dc:creator>Catalin Zima</dc:creator>
		<pubDate>Sun, 14 Sep 2008 16:45:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.catalinzima.com/?page_id=13#comment-11047</guid>
		<description>Well, you could theoretically do GetData on the morph texture, but I&#039;m not sure how performant that is.</description>
		<content:encoded><![CDATA[<p>Well, you could theoretically do GetData on the morph texture, but I&#8217;m not sure how performant that is.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

