<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>untoldentertainment.com &#187; 3D</title>
	<atom:link href="http://www.untoldentertainment.com/blog/tag/3d/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.untoldentertainment.com/blog</link>
	<description>We Make Flash Games</description>
	<lastBuildDate>Wed, 01 Feb 2012 15:18:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<copyright>Copyright &#xA9; untoldentertainment.com 2011 </copyright>
	<managingEditor>ryan@untoldentertainment.com (untoldentertainment.com)</managingEditor>
	<webMaster>ryan@untoldentertainment.com (untoldentertainment.com)</webMaster>
	<image>
		<url>http://www.untoldentertainment.com/blog/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
		<title>untoldentertainment.com</title>
		<link>http://www.untoldentertainment.com/blog</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle></itunes:subtitle>
	<itunes:summary>We Make Flash Games</itunes:summary>
	<itunes:keywords></itunes:keywords>
	<itunes:category text="Society &#38; Culture" />
	<itunes:author>untoldentertainment.com</itunes:author>
	<itunes:owner>
		<itunes:name>untoldentertainment.com</itunes:name>
		<itunes:email>ryan@untoldentertainment.com</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.untoldentertainment.com/blog/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<item>
		<title>Flash CS4 3D &#8211; Depth Management</title>
		<link>http://www.untoldentertainment.com/blog/2008/11/26/flash-cs4-3d-depth-management/</link>
		<comments>http://www.untoldentertainment.com/blog/2008/11/26/flash-cs4-3d-depth-management/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 17:00:57 +0000</pubDate>
		<dc:creator>Ryan Henson Creighton</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[CS4]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.untoldentertainment.com/blog/?p=573</guid>
		<description><![CDATA[i&#8217;ve been playing around with the 3D tools in Flash 10/CS4, with half a mind to completely redo our cube-mapped memory game Two By Two with an actual 3D cube. (Currently, the game uses a series of skewed planes to fake the 3D effect.) The good news is that CS4 does support 3D, although some [...]]]></description>
			<content:encoded><![CDATA[<p>i&#8217;ve been playing around with the 3D tools in Flash 10/CS4, with half a mind to completely redo our cube-mapped memory game <a href="http://www.untoldentertainment.com/blog/2007/04/26/two-by-two/">Two By Two</a> with an actual 3D cube.  (Currently, the game uses a series of skewed planes to fake the 3D effect.)</p>
<p>The good news is that CS4 does support 3D, although some people on the web are calling it 2.5D for one particular reason:  the DisplayObjects that you transform and translate are unaware of each other, and do not exist in the same 3D space.</p>
<p>Here&#8217;s what that means: you can have two planes sitting next to each other.  Depth-wise, PlaneA is in front of PlaneB.  You move PlaneA backwards along the z axis, and it <em>never swaps depths behind PlaneB</em>.  It&#8217;s as if the two clips are entirely autonomous and exist in their own little 3D worlds.  Which they do.</p>
<p>note: you&#8217;ll need to be running the Flash Player 10 plugin to view these examples.  Get it <a href="http://get.adobe.com/flashplayer/">HERE</a>.</p>
<p> <br />

<object width="550" height="400">
<param name="movie" value="http://www.untoldentertainment.com/blog/labs/3d/depthProblem/depthProblem.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="transparent"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<embed type="application/x-shockwave-flash" width="550" height="400" src="http://www.untoldentertainment.com/blog/labs/3d/depthProblem/depthProblem.swf" quality="high" bgcolor="#FFFFFF" wmode="transparent" menu="false" ></embed>
</object>
<br />
 </p>
<p>This becomes a big problem when you need things to look natural.  Check out this Flash coder&#8217;s experiment with a 3D world and a camera:</p>
<div class="displayed">
<p><a href="http://www.btinternet.com/~m.j_hall/check_cs4_3d.html"><img src="http://www.untoldentertainment.com/blog/img/2008_11_26/depthProblem.jpg" alt="Flash 3D World with Messed Up Depth" /></a></p>
<p>This is fine if all of your game characters have X-Ray vision, i suppose.</p></div>
<p>The floors and the walls are placed correctly, but they all show through each other. i had the exact same problem when i tried building a cube from MovieClips.  Placing the clips was very easy, but the depth problem baffled me.  i knew that i had to loop through all the cube faces and re-order them based on their z properties, but i didn&#8217;t know how to do that, since localToGlobal only supports x/y coordinates.</p>
<p>It turns out you have to actually write your own depth manager if you want to build any kind of 3D object and have it display correctly.  i found just the code i needed here on Drew Cummins&#8217;s blog:</p>
<p><a href="http://blog.generalrelativity.org/?p=28">http://blog.generalrelativity.org/?p=28</a></p>
<p>i&#8217;m a big enough man to admit that at one o&#8217;clock in the morning last night, i didn&#8217;t fully grasp how this code did what it did.  Happily, it worked.  You can see the difference in cube rendering below.  The cube on the left applies Drew&#8217;s depth management routine.</p>
<p>Thanks, Drew!</p>
<p> <br />

<object width="550" height="400">
<param name="movie" value="http://www.untoldentertainment.com/blog/labs/3d/cube_depthManagement/cube_comparison.swf"></param>
<param name="quality" value="high"></param>
<param name="wmode" value="transparent"></param>
<param name="menu" value="false"></param>
<param name="bgcolor" value="#FFFFFF"></param>
<param name="allowScriptAccess" value="always"></param>
<embed type="application/x-shockwave-flash" width="550" height="400" src="http://www.untoldentertainment.com/blog/labs/3d/cube_depthManagement/cube_comparison.swf" quality="high" bgcolor="#FFFFFF" wmode="transparent" menu="false" ></embed>
</object>
<br />
 </p>
<p>Additional notes: there is a (possibly deliberate?) type-o in Drew&#8217;s code.  One of the loops is missing a minus operator on its iteration decrementor (i-), so watch out for that.</p>
<p>You may also have to rely on the ADDED_TO_STAGE event, as Drew&#8217;s code threw me an error when doc.stage was <strong>null</strong>.  This can happen when you try to fire code before an object actually exists on the stage.
<div class="tweetmeme_button" style="margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.untoldentertainment.com%2Fblog%2F2008%2F11%2F26%2Fflash-cs4-3d-depth-management%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.untoldentertainment.com%2Fblog%2F2008%2F11%2F26%2Fflash-cs4-3d-depth-management%2F&amp;source=untoldent&amp;style=normal&amp;service_api=R_44463fc40e5eda8ec585b4088e695066&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p class="fbconnect_share"><fb:share-button class="url" href="http://www.untoldentertainment.com/blog/2008/11/26/flash-cs4-3d-depth-management/" /></p><img src="http://www.untoldentertainment.com/blog/?ak_action=api_record_view&id=573&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.untoldentertainment.com/blog/2008/11/26/flash-cs4-3d-depth-management/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

