<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>nulldesign // lars gerckens</title>
	
	<link>http://www.nulldesign.de</link>
	<description>blog &amp; portfolio</description>
	<lastBuildDate>Thu, 10 Jan 2013 08:02:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/nulldesign" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="nulldesign" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>It has been fun, while it lasted…</title>
		<link>http://www.nulldesign.de/2012/09/19/it-has-been-fun-while-it-lasted/</link>
		<comments>http://www.nulldesign.de/2012/09/19/it-has-been-fun-while-it-lasted/#comments</comments>
		<pubDate>Wed, 19 Sep 2012 20:31:37 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=824</guid>
		<description><![CDATA[Since quite a while, I was struggling to make a decision. A decision, if I can continue supporting the flash community with the ongoing development of my open source Stage3D engine ND2D. The sad answer is: I can&#8217;t. Despite it has been so much fun building the engine, being one of the few guys who &#8230; <a href="http://www.nulldesign.de/2012/09/19/it-has-been-fun-while-it-lasted/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Since quite a while, I was struggling to make a decision. A decision, if I can continue supporting the flash community with the ongoing development of my open source Stage3D engine <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a>.</p>
<p>The sad answer is: I can&#8217;t. Despite it has been so much fun building the engine, being one of the few guys who could explore and tinker with the Flash Player 11 from the very early alpha&#8217;s (Thank you <a href="http://www.bytearray.org/" target="_blank">Thibault</a>!) and bringing this engine to a level where it can compete with other professional 2D engines, it&#8217;s time for me to say goodbye.</p>
<p><img class="alignnone size-full wp-image-828" title="" src="http://www.nulldesign.de/wp-content/uploads/2012/09/IMG_6831-2.jpg" alt="" width="350" height="350" /></p>
<p>The truth is, that I just don&#8217;t do Flash / Actionscript projects anymore. It wasn&#8217;t a conscious decision, more a smooth transition. Meanwhile, most of my client work is native iOS. I moved completely to mobile platforms. About two years ago, I started to play around with the iOS SDK and started to build my own little mobile apps. Started out just with a bit of experimenting, this is the platform I now use on a daily basis and I earn my money (mostly) building native iOS apps for clients now. After so many years of Flash and Actionscript it was really refreshing to learn so many new things and switch to a new platform with so different capabilities. I really feel comfortable in this world, being closer to the operating system than in a virtual machine. I think this was my main drive, try a new platform and a new language.</p>
<p>I was continuing to add features to <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a>, merging in pull requests and answering questions in the <a href="http://nulldesign.de/nd2d/forum/" target="_blank">forum</a> until now, but when you don&#8217;t use the technology in your own projects, it&#8217;s pretty hard to keep yourself up to date with all the new stuff that has been <a href="http://www.bytearray.org/?p=4789" target="_blank">added to the platform</a> and really bring the engine to a next level. And it&#8217;s a bit pointless as well. So I had to draw a line here. Sad but true&#8230;</p>
<p>It is so cool to see, what some of you have done with the engine and what nice games (<a href="http://www.nulldesign.de/2012/02/07/nd2d-extensions-games/" target="_blank">#1</a>, <a href="http://nulldesign.de/nd2d/forum/forum.php?id=3" target="_blank">#2</a>) you have made. <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a> won&#8217;t disappear. It will still be available on <a href="https://github.com/nulldesign/nd2d" target="_blank">github</a> with all examples and docs. And I hope it won&#8217;t be abandoned now. There are some really interestings <a href="https://github.com/rolfd/nd2d" target="_blank">forks (Hello Rolf!)</a> you might wan&#8217;t to have a look at. If anyone of you wants to actively continue developing <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a>, drop me a mail!</p>
<p>So! Thanks to all of you guys in the <a href="http://nulldesign.de/nd2d/forum/" target="_blank">forum</a> (except the spambots ;)) for the nice discussions, interesting questions and code improvements. Thanks to <a href="http://blog.flash-core.com" target="_blank">sHTiF</a> for some really cool GPU deepdives and <a href="http://gamua.com/blog/" target="_blank">Daniel</a> for the nice email conversations about Stage3D. Thanks to everyone who submitted a patch or a <a href="https://github.com/nulldesign/nd2d/pulls" target="_blank">pull request</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2012/09/19/it-has-been-fun-while-it-lasted/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>ND2D Extensions &amp; Games</title>
		<link>http://www.nulldesign.de/2012/02/07/nd2d-extensions-games/</link>
		<comments>http://www.nulldesign.de/2012/02/07/nd2d-extensions-games/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 11:09:44 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=757</guid>
		<description><![CDATA[You might have seen it already: Mike built some cool force field experiments with ND2D a while ago. Now he opened a github project called Napoleon. Napoleon is a 2D physics extension for ND2D using Nape, which looks very promising: Second I found a really nice looking game built with ND2D from Björn: &#8220;28 Bratwursts &#8230; <a href="http://www.nulldesign.de/2012/02/07/nd2d-extensions-games/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>You might have seen it already: <a href="http://mikedotalmond.co.uk" target="_blank">Mike </a>built some cool <a href="http://mikedotalmond.co.uk/?p=466" target="_blank">force field experiments</a> with <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a> a while ago. Now he opened a github project called <a href="https://github.com/mikedotalmond/napoleon" target="_blank">Napoleon</a>. Napoleon is a 2D physics extension for <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a> using <a href="http://deltaluca.me.uk/" target="_blank">Nape</a>, which looks very promising:</p>
<p><a href="http://mikedotalmond.github.com/napoleon/" target="_blank"><img class="alignnone size-full wp-image-758" title="" src="http://www.nulldesign.de/wp-content/uploads/2012/02/Bildschirmfoto-2012-02-07-um-11.55.02.png" alt="" width="466" height="221" /></a></p>
<p>Second I found a really nice looking game built with <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a> from <a href="http://www.bjoernacker.de/" target="_blank">Björn</a>: &#8220;<a href="http://www.bjoernacker.de/?p=518" target="_blank">28 Bratwursts Later</a>&#8220;. I really like the title ;). It&#8217;s still in development, but it look like good fun. Check out the video here:</p>
<p><iframe src="http://www.youtube.com/embed/TL9t2fRWAeg" frameborder="0" width="560" height="315"></iframe></p>
<p>Another tutorial game made by <a href="http://www.rengelbert.com" target="_blank">Roger</a> is <a href="http://www.rengelbert.com/tutorial.php?id=185" target="_blank">Frogger: ND2D</a>. He explains how to built a game like this with ND2D with a lot of code examples. A good place to start, if you are building your first game:</p>
<p><a href="http://www.rengelbert.com/tutorial.php?id=185"><img class="alignnone size-full wp-image-767" title="Bildschirmfoto 2012-02-07 um 19.05.47" src="http://www.nulldesign.de/wp-content/uploads/2012/02/Bildschirmfoto-2012-02-07-um-19.05.47.png" alt="" width="313" height="231" /></a></p>
<p>This one is already a few months old: <a href="http://www.photonstorm.com/archives/2600/infinivaders-by-sosker-stage3d-game" target="_blank">Infinivaders</a>. A stunning 8-bit retro space shooter.</p>
<p><a href="http://www.newgrounds.com/portal/view/583773"><img class="alignnone size-full wp-image-770" title="Bildschirmfoto 2012-02-08 um 10.35.24" src="http://www.nulldesign.de/wp-content/uploads/2012/02/Bildschirmfoto-2012-02-08-um-10.35.24.png" alt="" width="596" height="315" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2012/02/07/nd2d-extensions-games/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ND2D best practices – howto</title>
		<link>http://www.nulldesign.de/2012/01/30/nd2d-best-practices-how-to/</link>
		<comments>http://www.nulldesign.de/2012/01/30/nd2d-best-practices-how-to/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 21:39:51 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=734</guid>
		<description><![CDATA[I just released version 0.9.13 of my Stage3D engine. Meanwhile is ND2D in a very good and stable state. All features that I planned to integrate, are implemented and working. It&#8217;s very close to v 1.0. So it&#8217;s about time to have a little detailed »best practice and how to« post. This post is meant &#8230; <a href="http://www.nulldesign.de/2012/01/30/nd2d-best-practices-how-to/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I just released version 0.9.13 of my Stage3D engine. Meanwhile is <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a> in a very good and stable state. All features that I planned to integrate, are implemented and working. It&#8217;s very close to v 1.0. So it&#8217;s about time to have a little detailed »best practice and how to« post. This post is meant for the traditional flash developer who has never touched a GPU (The processor on your graphics card) accelerated environment. There are significant differences in this GPU powered world and you have to think and prepare your assets in a different way, than you used to. Let&#8217;s start:</p>
<p><strong>What is ND2D?<br />
</strong></p>
<p>ND2D is a GPU accelerated 2D game engine, that makes use of the new Stage3D features introduced in Flash Player 11 (Also known as Molehill). It has nothing to do with the traditional flash display list and runs on a different &#8220;layer&#8221;, behind all flash content. If you want to get a little low level knowledge, read <a href="http://www.bytearray.org/?p=2555" target="_blank">Thibault&#8217;s article here</a>. Using the GPU, the flash player is able to render full screen HD content at 60hz&#8230; Finally a dream comes true. Of course Stage3D is mainly focused on 3D, but we can make good use of the hardware for a 2D engine as well and speed things up a lot.</p>
<p><strong>A GPU Environment</strong></p>
<p>First of all, let&#8217;s try to understand a little, how 2D rendering on a GPU works. Actually, the GPU can only deal with 3D data. To render 2D, we just don&#8217;t use the third dimension. So you could call ND2D a &#8220;planes-in-3D-space-engine&#8221; if you like.</p>
<p>Unfortunately, the GPU can only deal with triangles (A triangle is also called a polygon in the 3D world). To render a sprite, we need construct a quad out of two triangles like this:</p>
<p><img class="alignnone size-full wp-image-735" title="texture_uv" src="http://www.nulldesign.de/wp-content/uploads/2012/01/texture_uv.jpg" alt="" width="200" height="200" /></p>
<p>Next we have to specify, which part of our bitmap is mapped to which corner of our quad. This is called UV mapping. As you see in the picture above, the top left corner has a UV coordinate of (0, 0), which is the top left pixel of our bitmap. The lower right corner UV(1,1) is of course the lower rightmost pixel of our image. The GPU interpolates between these coordinates and know&#8217;s which pixel to choose for a UV(0.5, 0.5) coordinate (If our image is 128&#215;128 px, it chooses the pixel 64,64, this is called sampling). One important thing is, that the GPU can only handle textures sizes, that are a power of 2 (32&#215;32, 64&#215;32, 128&#215;128, 256&#215;64, etc.). In the above example, a lot of space and therefor texture memory is wasted, because ND2D has to blow up the 68&#215;68 sized PNG of the little bacteria and create a 128&#215;128 texture. So keep the power of two (2^n) in mind, when exporting your images. Later we&#8217;ll get to know the TextureAtlas and it&#8217;s tools, which will take take of the unused space problem automatically.</p>
<p>So we need to pass all this information to the GPU: A quad/triangle definition, UV coordinates, the bitmap (on the GPU it&#8217;s called a texture). All of this is done internally in ND2D. You only have to deal with these low level details, if you want to create own objects or write your own materials and shaders.</p>
<p><strong>The display hierarchy and it&#8217;s limitations</strong></p>
<p>To mimic the displaylist, ND2D has a similar hierarchy compared to the flash displaylist. It feels very similar, albeit there are significant differences we&#8217;ll get to know now. Everything in ND2D is a Node2D which can have a number of childs, just like in your normal flash display list. The drawing is done from back to front of course. The draw loop starts with the topmost parent and continues with the childs. This is no different to flash&#8217;s displaylist.</p>
<p>One thing that&#8217;s very important to know, basically the most important thing when you&#8217;re dealing with a GPU environment is »how« things are sent to the GPU and being drawn. Keep this in mind, this is the bottleneck and the reason for low speed in your game: We have to try to sent as less data to the GPU and call as less methods as possible! Unfortunately an engine like ND2D or any other engine can&#8217;t automate this process. Let me give you an example:</p>
<p>You&#8217;re building a game where you have hundreds or even thousands of fluffy little bunnies on the screen. If you now would create 1000 Sprite2D&#8217;s, ND2D has to send 2000 triangles and 1000 textures to the GPU and the GPU would have to draw them one by one, which would be just very slow. This might be slower that a traditional <a href="http://www.adobe.com/devnet/flash/articles/blitting_mc.html" target="_blank">blitting</a> approach. But don&#8217;t give up so fast: There is batching. The GPU has methods, that allow ND2D to sent the data for 1000 sprites as one single data package instead of 1000 little one&#8217;s. The downside is, that the texture of all these 1000 sprites has to be the same. That&#8217;s the limitation: Batching is only possible, if the texture of the batched nodes is the same! Good for us, if we want to display 1000 bunnies that all look the same, but what if we have lot&#8217;s of different looking bunnies we want to display? We can&#8217;t get back to rendering them all one by one, this would be slow&#8230;</p>
<p><strong>TextureAtlases / SpriteSheets</strong></p>
<p>Behold! There&#8217;s always a solution and this is called a TextureAtlas. When the limitation is, that all sprites have to have the same texture, then why not just put all graphics we have in one bigger texture:</p>
<p><a href="http://www.nulldesign.de/wp-content/uploads/2012/01/textureatlas.jpg"><img class="alignnone size-full wp-image-736" title="textureatlas" src="http://www.nulldesign.de/wp-content/uploads/2012/01/textureatlas.jpg" alt="" width="128" height="128" /></a></p>
<p>By changing the UV coordinates for each sprite, we can specify which part of the texture should be drawn for our sprite. There are a few good tools, that help you to generate a TextureAtlas (A bitmap that has a size of 2^n). You don&#8217;t have to do this by hand. ND2D currently supports these tools:</p>
<p>- <a href="http://www.texturepacker.com/" target="_blank">TexturePacker</a> (cocos2d + cocos2d-0.99.4 format)<br />
- <a href="http://zwoptexapp.com/" target="_blank">Zwoptex App</a> (zwoptex-default format)</p>
<p>This is the main difference to traditional flash. Instead of getting your assets one by one from a library, you &#8220;bake&#8221; them all in a big PNG. And that&#8217;s the way you should go. If, for some reason, you need a dynamic approach and generate this atlas on the fly, you can check out the &#8220;<a href="http://docs.rsnewmedia.co.uk/display/nd2ddynatlas/Releases" target="_blank">nd2d-dynatlas</a>&#8221; extension built by wjammal (thanks mate!).</p>
<p><strong>Using a batch</strong></p>
<p>ND2D provides two different kind of batches: The Sprite2DCloud and the Sprite2DBatch (I&#8217;ll explain the differences later). You just create a batch, pass it the TextureAtlas and the Texture2D and start to add children&#8217;s:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> atlasTex:Texture2D = Texture2D.<span style="color: #006600;">textureFromBitmapData</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> textureAtlasBitmap<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">bitmapData</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> atlas:TextureAtlas = <span style="color: #000000; font-weight: bold;">new</span> TextureAtlas<span style="color: #66cc66;">&#40;</span>atlasTex.<span style="color: #006600;">bitmapWidth</span>, atlasTex.<span style="color: #006600;">bitmapHeight</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> textureAtlasXML<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>, TextureAtlas.<span style="color: #006600;">XML_FORMAT_ZWOPTEX</span>, <span style="color: #cc66cc;">5</span>, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
batch = <span style="color: #000000; font-weight: bold;">new</span> Sprite2DBatch<span style="color: #66cc66;">&#40;</span>atlasTex<span style="color: #66cc66;">&#41;</span>;
batch.<span style="color: #006600;">setSpriteSheet</span><span style="color: #66cc66;">&#40;</span>atlas<span style="color: #66cc66;">&#41;</span>;
&nbsp;
s = <span style="color: #000000; font-weight: bold;">new</span> Sprite2D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
batch.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>s<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>As you can see, you have to add an empty Sprite2D to the batch. After adding the child to the batch, the batch passes a copy of the TextureAtlas to the sprite. Then you&#8217;re able to set individual frames or animations on that sprite:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">s.<span style="color: #006600;">spriteSheet</span>.<span style="color: #006600;">playAnimation</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;walkingBunny&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>To stop any confusion: A TextureAtlas sometimes is called a SpriteSheet and vice versa. In ND2D, a TextureAtlas means a bitmap containing packed images like in the screenshot above, plus an XML definition that defines the UV coordinates for each sprite. The simpler version is a SpriteSheet, which just contains images of equal sizes and doesn&#8217;t need an XML. You can create SpriteSheets with tools like <a href="http://www.bit-101.com/blog/?p=2939" target="_blank">SWFSheet</a> by <a href="http://www.bit-101.com/blog/" target="_blank">Keith Peiters</a>.</p>
<p><strong>Performance</strong></p>
<p>In an ideal world, you would place all your graphics in one big TextureAtlas and work with just one batch. In reality it&#8217;s not always possible. The size of a texture is limited (2048 x 2048) and you sometimes can&#8217;t squeeze all your graphics and animations into it. You might need a second batch with a second texture. You can&#8217;t nest batches and since we live in a hierarchical world, you have to keep in mind, that one batch and all of it&#8217;s children will be drawn before the other! So one batch could deal with all background and level assets, while the upper batch renders the characters and other foreground graphics.</p>
<p>I said, I&#8217;ll explain the difference between a Sprite2DCloud and a Sprite2DBatch and here we go. I won&#8217;t get into technical details here, but there a basically two different methods for batching data. For those who are interested: <a href="http://www.nulldesign.de/2011/04/07/molehill-nd2d-speeding-up-the-engine/" target="_blank">ND2D &#8211; speeding up the engine</a>.</p>
<p>The Sprite2DCloud does more computation on the CPU and delivers a complete package to the GPU, while the Sprite2DBatch receives &#8220;chunks&#8221; of data and processes it on the GPU:</p>
<p><em><strong>Sprite2DCloud: Higher CPU load, lower GPU usage</strong></em><br />
<em><strong> Sprite2DBatch: Lower CPU load, higher GPU usage</strong></em></p>
<p>On a desktop machine with a decent CPU, the cloud will be faster. On machines with a slower CPU or on mobile systems, the batch could be faster. So, I&#8217;m afraid it&#8217;s up to you to choose which batching method you&#8217;d like to use. One more important thing I have to say about the differences: Due to technical limitations (and speed optimizations) the cloud can just render it&#8217;s own children and won&#8217;t render the children&#8217;s children, while the batch will render the full display list tree. No limitations there. I&#8217;d always vote for the batch, even though it&#8217;s a bit slower on a desktop machine, but still powerful enough for our fluffy bunny horde.</p>
<p>There are other objects in ND2D that are fully calculated on the GPU. For example the ParticleSystem2D. Get into detail <a href="http://www.nulldesign.de/2011/10/05/nd2d-particles-gpu-vs-cpu/" target="_blank">here</a>.</p>
<p><strong>Outlook</strong></p>
<p>I mentioned the word »mobile« quite a few times and you might ask, when Stage3D for mobile will be available. I can&#8217;t say when it&#8217;s public, but as you know, Adobe is working hard on it. All I can say, is that ND2D is already ready for mobile. MultiTouchEvent&#8217;s are integrated and a new compressed texture format (ATF) also, which will be released with Stage3D for mobile as well (hopefully).</p>
<p>I hope this post was somehow useful to you and helps you to get started in this new accelerated world. If you have any questions, don&#8217;t hesitate to ask them. ND2D has also a <a href="http://www.nulldesign.de/nd2d/forum/" target="_blank">forum</a> where a lot of questions have been answered.</p>
<p><strong>Resources</strong></p>
<ul>
<li><a href="https://github.com/nulldesign/nd2d" target="_blank">Sources</a></li>
<li><a href="http://www.nulldesign.de/nd2d/forum/" target="_blank">Forum</a></li>
<li><a href="http://www.nulldesign.de/nd2d/docs/" target="_blank">Documentation</a></li>
<li><a href="https://github.com/nulldesign/nd2d/wiki" target="_blank">Wiki</a></li>
<li><a href="http://blog.tabinda.net/actionscript/wck-vs-nape/" target="_blank">WCK / Nape integration</a></li>
<li>Getting started Videos: <a href="http://www.youtube.com/watch?v=cysug6VNXPM" target="_blank">Part 1</a> | <a href="http://www.youtube.com/watch?v=sSeXdB5wKuU" target="_blank">Part 2</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2012/01/30/nd2d-best-practices-how-to/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Adobe AIR Native Extensions for iOS, Learnings</title>
		<link>http://www.nulldesign.de/2012/01/22/adobe-air-native-extensions-for-ios-learnings/</link>
		<comments>http://www.nulldesign.de/2012/01/22/adobe-air-native-extensions-for-ios-learnings/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 14:08:26 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=726</guid>
		<description><![CDATA[In my current client project, we&#8217;re developing an AIR application targeted for iOS (Android will follow) and we wanted to make use of some iOS SDK features, so I had to write my first NativeExtension. Developing the Objective C part is pretty straight forward (If you know C++ and Objective C) and so is the &#8230; <a href="http://www.nulldesign.de/2012/01/22/adobe-air-native-extensions-for-ios-learnings/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>In my current client project, we&#8217;re developing an AIR application targeted for iOS (Android will follow) and we wanted to make use of some iOS SDK features, so I had to write my first <a href="http://www.adobe.com/devnet/air/native-extensions-for-air.html" target="_blank">NativeExtension</a>. Developing the Objective C part is pretty straight forward (If you know C++ and Objective C) and so is the Actionscript part. There are some good examples and tutorials on the <a href="http://www.adobe.com/devnet/air/native-extensions-for-air.html" target="_blank">Adobe site</a> about all kind of extensions.</p>
<p>The hard part was to get this thing to work. So I just wanted to share my settings here. This might become useful, if you&#8217;re starting to develop your first ANE. I had strange crashes when I packaged the app with my ANE and I couldn&#8217;t figure out what was wrong. The app just crashed everytime I launched it on the device. The crashlog wasn&#8217;t very helpful. After quite a search, I found out, that I didn&#8217;t set an apparently important compiler flag for the LLVM compiler in my XCode project. So, be sure to set:</p>
<p><strong>Enable Linking With Shared Libraries: No</strong></p>
<p>And if you want to get rid of the warnings:</p>
<p><strong>Warnings: Missing Function Prototypes: No</strong></p>
<p>The second part was packaging the ANE correctly. The working command for my case is:</p>
<p><strong>adt -package -target ane MyExtension.ane extension.xml -swc MyExtension.swc -platform iPhone-ARM library.swf libMyNativeExtensionIOS.a</strong></p>
<p>The annoying thing about packaging the ANE is, that after you have built your swc, you have to extract the library.swf out of it (By renaming it to .zip and extracting the swf). So you need both, the swc AND the swf. I didn&#8217;t write an ANT task to do automate the process until now and I don&#8217;t know the reason for this strange step, since the ADT compiler has everything it needs within the swc. Only Adobe knows ;)</p>
<p>Obviously you can not test on the device everytime, because the deployment process to iOS is more or less manual and just takes too long at the moment. I found out, that I could link the ANE as a regular library (SWC) in my Flash Builder project and launch the app on my desktop machine. When the native extension tries to create the context on the desktop machine, it fails and returns null, because it was just built for the iOS platform:</p>
<p><strong>context = ExtensionContext.createExtensionContext(EXTENSION_ID, null);</strong></p>
<p>So I could implement a fallback for the extention when running on the desktop that mocked the behaviour in AS3. To package the application for iOS, I wrote a small ANT task. This way we can easily test on the device and have a fallback, when testing 0n the desktop without writing desktop extensions as well.</p>
<p>So, maybe someone will find this useful&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2012/01/22/adobe-air-native-extensions-for-ios-learnings/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ND2D – Blur</title>
		<link>http://www.nulldesign.de/2011/12/07/nd2d-blur/</link>
		<comments>http://www.nulldesign.de/2011/12/07/nd2d-blur/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 13:51:52 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Pixelshader]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=713</guid>
		<description><![CDATA[Good news everyone. I found a little time to implement a blur shader for ND2D and I&#8217;m trying to explain how to implement a shader like this: First of all: How does a blur work? To blur an image, you sample neighbouring pixels of each pixel in the image and compute the average color. For &#8230; <a href="http://www.nulldesign.de/2011/12/07/nd2d-blur/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Good news everyone. I found a little time to implement a blur shader for ND2D and I&#8217;m trying to explain how to implement a shader like this:</p>
<p>First of all: How does a blur work? To blur an image, you sample neighbouring pixels of each pixel in the image and compute the average color. For example if you have a 3&#215;3 image and the pixel in the middle is black, the rest white. You sample all neighbours of the middle pixel (r: 1.0 g: 1.0 b: 1.0) * 8 plus the pixel itself (r: 0,0 g: 0,0 b: 0,0) * 1 and compute the average (divide by 9), the resulting pixel will be (r: 0,88 g: 0,88 b: 0,88). Just do that for every pixel in the image and you&#8217;ll have a blur.</p>
<p>To implement this in a shader we have to consider a few things: First you want to save as many texture sampling calls as possible. For example if you want to blur your image 4 pixels horizontally and vertically, you would have to take 9 x 9 = 81 samples (4 to the left, up and down and the pixel that should be blurred itself). This is way too much and you could never squeeze this into a fragment shader with AGAL. But there is a trick: First blur your image horizontally, take the result and blur it vertically. This way, you have to take only 9 + 9 = 18 samples (see <a href="http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/" target="_blank">Article: Gaussian Blur Shader</a>). Implementing it this way, means we have to do a horizontal blur, write the output to a texture and do a vertical blur with the already horizontal blurred texture. In other words, a two pass rendering. A nice sideeffect of this approach is, that we can not only blur in x AND y direction, but in x OR y individually.</p>
<p>So we&#8217;ve implemented our blur now and are happy that everything is blurry with a 4&#215;4 blur, but how do we animate it now? We could generate the shader dynamically, so that we would have a different shader for different blur values, but space is limited in a fragment shader. A program can&#8217;t exceed a certain size. What if we want to have a blur of 50 x 50? We can&#8217;t write a shader that does this. The program would be just too big, since we don&#8217;t have loops in AGAL.</p>
<p>One part of the answer is good old: <a href="http://de.wikipedia.org/wiki/Carl_Friedrich_Gau%C3%9F" target="_blank">Carl Friedrich Gauß</a>. He invented a formular a few hundred years ago, that let&#8217;s us weighten the sampled pixels (see <a href="http://en.wikipedia.org/wiki/Gaussian_blur" target="_blank">Article: Guassian Blur</a> and an <a href="http://stackoverflow.com/questions/1696113/how-do-i-gaussian-blur-an-image-without-using-any-in-built-gaussian-functions" target="_blank">Implementation</a>). So our shader can remain static and sample always 9 pixels, but the gaussian function will tell us how the samples are treated. So instead of dividing all samples by 9, we have a factor for each sample. Now not only the blur is dynamic, it even looks a lot better with the gauss values than our simple &#8220;divide by 9&#8243; approach. Neat! Now we can animate a blur from 0 to 4 pixels. That&#8217;s ok, but we wanted 50 or more, remember?</p>
<p>The last and final part to our full dynamic blur shader is: Just repeat what we&#8217;ve done already! If you want to have a blur of 10, just blur two times by 4 pixels, followed by a 2 pixel blur. Implementing this is also straight forward: setRenderToTexture(), renderBlur(), switchTextures(). All done in a loop.</p>
<p>Enough of the tech talk, here&#8217;s the result (move your mouse to blur the sprites in x and/or y):</p>
<p><a href="http://www.nulldesign.de/nd2d/tests/blur_test.html"><img class="alignnone size-full wp-image-715" title="Bildschirmfoto 2011-12-07 um 14.41.32" src="http://www.nulldesign.de/wp-content/uploads/2011/12/Bildschirmfoto-2011-12-07-um-14.41.32.png" alt="" width="554" height="190" /></a></p>
<p>You&#8217;ll notice the ugly edges in the middle image. This happens, if the blur is larger than the transparent space available in the texture. So the blur is &#8220;cut off&#8221;. I haven&#8217;t found a good solution for this, except of: Leave enough space in your textures if you want to blur it ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2011/12/07/nd2d-blur/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>ND2D – Now with 50% more D (and some more features)</title>
		<link>http://www.nulldesign.de/2011/11/06/nd2d-now-with-50-more-d-and-some-more-features/</link>
		<comments>http://www.nulldesign.de/2011/11/06/nd2d-now-with-50-more-d-and-some-more-features/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 17:37:12 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=707</guid>
		<description><![CDATA[I found some time to add a little bit more &#8220;D&#8221; to ND2D. Besides the regular &#8220;rotation&#8221; property which rotated around the z-axis, all nodes now have  rotationX, rotationY, rotationZ properties and are displayed via a perspective projection. It works similar to the Flash 10 2.5D API (Planes in space), could be useful for some &#8230; <a href="http://www.nulldesign.de/2011/11/06/nd2d-now-with-50-more-d-and-some-more-features/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I found some time to add a little bit more &#8220;D&#8221; to ND2D. Besides the regular &#8220;rotation&#8221; property which rotated around the z-axis, all nodes now have  rotationX, rotationY, rotationZ properties and are displayed via a perspective projection. It works similar to the Flash 10 2.5D API (Planes in space), could be useful for some fancy transition effects.</p>
<p><a href="http://www.nulldesign.de/nd2d/tests/3d_transforms.html"><img class="alignnone size-full wp-image-708" title="Bildschirmfoto 2011-11-06 um 18.23.32" src="http://www.nulldesign.de/wp-content/uploads/2011/11/Bildschirmfoto-2011-11-06-um-18.23.32.png" alt="" width="600" height="275" /></a></p>
<p>Second, I added a few properties to change the appearance of textures. You can strech textures now and define how they should be sampled. The API let&#8217;s you choose how the texture is filtered, if mipmapping should be used and how the mipmap filtering should be. I created four predefined quality settings: LOW, MED, HIGH and ULTRA. Have fun:</p>
<p><a href="http://www.nulldesign.de/nd2d/tests/texture_options.html"><img class="alignnone size-full wp-image-709" title="Bildschirmfoto 2011-11-06 um 18.28.03" src="http://www.nulldesign.de/wp-content/uploads/2011/11/Bildschirmfoto-2011-11-06-um-18.28.03.png" alt="" width="600" height="352" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2011/11/06/nd2d-now-with-50-more-d-and-some-more-features/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>ND2D – Speed tests</title>
		<link>http://www.nulldesign.de/2011/10/23/nd2d-speed-tests/</link>
		<comments>http://www.nulldesign.de/2011/10/23/nd2d-speed-tests/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 12:27:14 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=692</guid>
		<description><![CDATA[When talking about accelerated 2D in Flash, everybody is always asking for performance comparisons. So I threw together a little speed test for ND2D. Mainly to give you some numbers, but also to test the different implementations of ND2D&#8216;s objects. After selecting one of the four different options, the test will keep adding sprites until &#8230; <a href="http://www.nulldesign.de/2011/10/23/nd2d-speed-tests/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>When talking about accelerated 2D in Flash, everybody is always asking for performance comparisons. So I threw together a little speed test for <a href="https://github.com/nulldesign/nd2d">ND2D</a>. Mainly to give you some numbers, but also to test the different implementations of <a href="https://github.com/nulldesign/nd2d">ND2D</a>&#8216;s objects. After selecting one of the four different options, the test will keep adding sprites until the framerate drops below 60hz. While adding sprites, it&#8217;s likely, that the framerate drops below 60hz for a short while, because adding and creating objects is expensive too. But what counts is the end result.</p>
<p>This test allows you to compare four different types of objects / rendering:</p>
<ul>
<li>Sprite2D with a shared texture. Every sprite is drawn in a seperate drawCall, but there&#8217;s only one texture in memory</li>
<li>Sprite2D with individual textures. A drawCall for every sprite is used as well and there are as much textures in memory, as there are sprites</li>
<li>Sprite2DCloud. All sprites have a shared texture and are drawn in a single drawCall. All movement is calculated on the CPU and the vertexbuffer is uploaded to the GPU every frame</li>
<li>Sprite2DBatch. Shared texture as well, but most of the work is done by the GPU with batch processing.</li>
</ul>
<p style="text-align: center;"><a href="http://www.nulldesign.de/nd2d/tests/speedtest.html" target="_blank"><img class="alignnone size-full wp-image-693" title="speedtest" src="http://www.nulldesign.de/wp-content/uploads/2011/10/speedtest.jpg" alt="" width="601" height="313" /></a><br />
Hit &#8216;F&#8217; for fullscreen</p>
<p>The results on my machine in Chrome at fullscreen resolution (1680 x 1050) and the Flash Player 11 Release (Please, don&#8217;t try it in the debug player, it&#8217;s way slower) are:</p>
<ul>
<li>Sprite2D shared Texture: <strong>2157</strong></li>
<li>Sprite2D individual Textures: <strong>1881</strong></li>
<li>Sprite2DCloud: <strong>14579</strong></li>
<li>Sprite2DBatch: <strong>6180</strong></li>
</ul>
<p>There are still a lot of things, that can be optimized. For example, I&#8217;m not saving and comparing state changes in the context (texture bind / unbind checks, etc.). At least the first test could be optimized a lot with this technique I think. Even though there is still space for optimization, I&#8217;d say that <a href="https://github.com/nulldesign/nd2d">ND2D</a> is fast enough to build some stunning games! Who needs 15 thousand moving sprites in a game? That should be more than enough ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2011/10/23/nd2d-speed-tests/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>ND2D – Particles GPU vs. CPU</title>
		<link>http://www.nulldesign.de/2011/10/05/nd2d-particles-gpu-vs-cpu/</link>
		<comments>http://www.nulldesign.de/2011/10/05/nd2d-particles-gpu-vs-cpu/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 14:33:46 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=680</guid>
		<description><![CDATA[A few people where wondering why they can&#8217;t control individual particles in the ND2D particlesystem. Let me explain why: The ParticleSystem2D is built for speed. This means, that everything and really everything for each particle is calculated on the GPU. When you create a system, initially the starting values for each particles are created and &#8230; <a href="http://www.nulldesign.de/2011/10/05/nd2d-particles-gpu-vs-cpu/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>A few people where wondering why they can&#8217;t control individual particles in the <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a> particlesystem. Let me explain why:</p>
<p>The ParticleSystem2D is built for speed. This means, that everything and really everything for each particle is calculated on the GPU. When you create a system, initially the starting values for each particles are created and uploaded to the GPU. From now on, everything is calculated in shaders based on the current time step. This way <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a> is able to render 10.000 (or even more) particles at 60hz without any CPU usage. The drawback is, that you don&#8217;t have control over each particle, but you&#8217;ll have a lot of CPU time left for more important stuff. The ParticleSystem2D can be used for effects like rain, fire or water, but you won&#8217;t be able to animate a swarm of birds with it. You can play around with the system below, but be careful. Depending on the size of the particles you can display 10.000 at 60hz or nearly freeze your machine. The larger, the slower.</p>
<p><a href="http://www.nulldesign.de/nd2d/tests/particle_explorer.html"><img class="alignnone size-full wp-image-681" title="gpu_particles" src="http://www.nulldesign.de/wp-content/uploads/2011/10/gpu_particles.jpg" alt="" width="600" height="325" /></a></p>
<p>If you want to have  control over individual particles, you can use one of the batch nodes provided by <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a>. The Sprite2DCloud or the Sprite2DBatch. With these batch nodes you&#8217;re able to move each child, but they are slower, because all the positional information has to be uploaded to the GPU every single frame. When I say slower, I mean that you can still display 1000 (or a lot more) particles alphablended at 60hz. This should be enough for a whole army of kinghts or a fancy mousefollower. Play around with it here:</p>
<p><a href="http://www.nulldesign.de/nd2d/tests/sprite2dcloud_particles.html"><img class="alignnone size-full wp-image-682" title="cpu_particles" src="http://www.nulldesign.de/wp-content/uploads/2011/10/cpu_particles.jpg" alt="" width="600" height="325" /></a></p>
<p>And if you haven&#8217;t installed the new Flash Player 11 that has been released yesterday, grab it <a href="http://www.adobe.com/products/flashplayer.html" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2011/10/05/nd2d-particles-gpu-vs-cpu/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>ND2D – infinite scrolling made easy with animated UV coordinates</title>
		<link>http://www.nulldesign.de/2011/09/26/nd2d-infinite-scrolling-made-easy-with-animated-uv-coordinates/</link>
		<comments>http://www.nulldesign.de/2011/09/26/nd2d-infinite-scrolling-made-easy-with-animated-uv-coordinates/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 13:08:27 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=671</guid>
		<description><![CDATA[One really cool thing about textures on the GPU are the different wrapmodes when sampling pixels from it. In Molehill, there are two different types available: CLAMP &#8211; if UV coordinates are lower than zero or greater than one, the coordiantes are clamped to 0..1, so the edge pixels are repeated REPEAT &#8211; if UV &#8230; <a href="http://www.nulldesign.de/2011/09/26/nd2d-infinite-scrolling-made-easy-with-animated-uv-coordinates/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>One really cool thing about textures on the GPU are the different wrapmodes when sampling pixels from it. In Molehill, there are two different types available:</p>
<ul>
<li>CLAMP &#8211; if UV coordinates are lower than zero or greater than one, the coordiantes are clamped to 0..1, so the edge pixels are repeated</li>
</ul>
<ul>
<li>REPEAT &#8211; if UV coordinates are lower than zero or greater than one, the whole texture is repeated. So for a UV of (1.2, 1.4) the pixel of (0.2, 0.4) is sampled</li>
</ul>
<p>Simply spoken, if you set the wrapmode to REPEAT, animate the UV-coordinates and have a self repeating texture, you&#8217;ll have the most simple endless scroller you can imagine. Don&#8217;t worry, everything is built into <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a>, you don&#8217;t have to care about what I just told you. Just watch the example:</p>
<p><a href="http://www.nulldesign.de/nd2d/tests/starfield.html" target="_blank"><img class="alignnone size-full wp-image-672" title="Bildschirmfoto 2011-09-26 um 14.45.37" src="http://www.nulldesign.de/wp-content/uploads/2011/09/Bildschirmfoto-2011-09-26-um-14.45.37.png" alt="" width="599" height="327" /></a></p>
<p>This example is included in the <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D Examples on Github</a>. This scene just consists of two sprites with a fixed position in the middle of the screen. The only thing that is done on the CPU in the step loop is this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">override protected <span style="color: #000000; font-weight: bold;">function</span> step<span style="color: #66cc66;">&#40;</span>elapsed:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    starfield1.<span style="color: #006600;">material</span>.<span style="color: #006600;">uvOffsetX</span> -= <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageWidth</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.5</span> - mouseX<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.00002</span>;
    starfield1.<span style="color: #006600;">material</span>.<span style="color: #006600;">uvOffsetY</span> -= <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageHeight</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.5</span> - mouseY<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.00002</span>;
    starfield2.<span style="color: #006600;">material</span>.<span style="color: #006600;">uvOffsetX</span> -= <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageWidth</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.5</span> - mouseX<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.00004</span>;
    starfield2.<span style="color: #006600;">material</span>.<span style="color: #006600;">uvOffsetY</span> -= <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">stage</span>.<span style="color: #006600;">stageHeight</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.5</span> - mouseY<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.00004</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>This can become handy, if you want to animate a waterfall, waves or a space field background in your game. Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2011/09/26/nd2d-infinite-scrolling-made-easy-with-animated-uv-coordinates/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>ND2D Postprocessing effects</title>
		<link>http://www.nulldesign.de/2011/09/08/nd2d-postprocessing-effects/</link>
		<comments>http://www.nulldesign.de/2011/09/08/nd2d-postprocessing-effects/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 15:43:34 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Pixelshader]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=655</guid>
		<description><![CDATA[I never really introduced the TextureRenderer of ND2D and what possibilities you have, when using it. The TextureRenderer does what the name suggests: It renders a display object (Sprite2D, etc.) and all subsequent objects onto a Context3D texture. The cool thing is, that you are able to draw your entire scene to a (fullscreen) texture &#8230; <a href="http://www.nulldesign.de/2011/09/08/nd2d-postprocessing-effects/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I never really introduced the <a href="http://www.nulldesign.de/nd2d/docs/" target="_blank">TextureRenderer</a> of <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a> and what possibilities you have, when using it. The TextureRenderer does what the name suggests: It renders a display object (Sprite2D, etc.) and all subsequent objects onto a Context3D texture. The cool thing is, that you are able to draw your entire scene to a (fullscreen) texture and add some post processing effects, by writing a new material / shader and displaying it via a standard Sprite2D.</p>
<p>Here&#8217;s the plain scene without post processing:</p>
<p><img class="alignnone size-full wp-image-656" title="postprocessing1" src="http://www.nulldesign.de/wp-content/uploads/2011/09/postprocessing1.jpg" alt="" width="600" height="308" /></p>
<p>&#8230; and here with a small &#8220;dizzyness&#8221; post process shader:</p>
<p><img class="alignnone size-full wp-image-657" title="postprocessing2" src="http://www.nulldesign.de/wp-content/uploads/2011/09/postprocessing2.jpg" alt="" width="600" height="310" /></p>
<p>I&#8217;ve added this test to the <a href="https://github.com/nulldesign/nd2d/tree/master/examples/tests" target="_blank">examples</a> incluced in the <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a> sources. You can see the live running example <a href="http://nulldesign.de/nd2d/tests/" target="_blank">here</a> (test #18).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2011/09/08/nd2d-postprocessing-effects/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>ND2D – Stage3D Masks</title>
		<link>http://www.nulldesign.de/2011/09/02/nd2d-stage3d-masks/</link>
		<comments>http://www.nulldesign.de/2011/09/02/nd2d-stage3d-masks/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 14:39:15 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Source]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=633</guid>
		<description><![CDATA[Another feature I really wanted to implement in ND2D were masks. Just like the setMask() method in flash. In Stage3D (OpenGL), there is no such thing as a mask. You can display textured triangles, that&#8217;s it, but you know that nearly everything is possible with a pixel shader. So let&#8217;s start: The idea of masking &#8230; <a href="http://www.nulldesign.de/2011/09/02/nd2d-stage3d-masks/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Another feature I really wanted to implement in <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a> were masks. Just like the setMask() method in flash. In Stage3D (OpenGL), there is no such thing as a mask. You can display textured triangles, that&#8217;s it, but you know that nearly everything is possible with a pixel shader. So let&#8217;s start:</p>
<p>The idea of masking in a fragment shader is to grab the pixel color of your texture, then grab the pixel color of your mask, multiply the two colors and display the result. But how do we find the correct pixel in the mask? Our task is to find the right UV coordinates for the mask texture.</p>
<p><img class="alignnone size-full wp-image-636" title="masking_uv" src="http://www.nulldesign.de/wp-content/uploads/2011/09/masking_uv.png" alt="" width="502" height="287" /></p>
<p>If you look at the above image, the mask is rotated and overlaps the sprite we want to mask. How do we find the correct pixel (UV coordinate) of the mask, that overlaps this orange pixel in the sprite? Somehow we have to map the position of the pixel in the sprite to the pixel in the mask and we can do that by transforming it between the different coordinate systems. In a vertex shader we calculate the final pixel positon from local space to world space. The idea is to map this pixel in world space back to the local coordinate system of the mask. This way it&#8217;s pretty easy to find the correct UV coordinates. Let&#8217;s do a simple actionscript test:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// this is the top right corner of our sprite quad.</span>
<span style="color: #000000; font-weight: bold;">var</span> v:Vector3D = <span style="color: #000000; font-weight: bold;">new</span> Vector3D<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">128</span>, -<span style="color: #cc66cc;">128</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// this is the sprites matrix, translated a bit</span>
<span style="color: #000000; font-weight: bold;">var</span> clipSpaceMatrix:Matrix3D = <span style="color: #000000; font-weight: bold;">new</span> Matrix3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
clipSpaceMatrix.<span style="color: #006600;">appendTranslation</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// this is the masks matrix, it's in the same position as the sprite</span>
<span style="color: #000000; font-weight: bold;">var</span> maskClipSpaceMatrix:Matrix3D = <span style="color: #000000; font-weight: bold;">new</span> Matrix3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
maskClipSpaceMatrix.<span style="color: #006600;">appendTranslation</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">// this is the masks size</span>
<span style="color: #000000; font-weight: bold;">var</span> maskBitmap:Rectangle = <span style="color: #000000; font-weight: bold;">new</span> Rectangle<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">256</span>, <span style="color: #cc66cc;">256</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// invert the matrix, because we want to map back from world space to local mask space</span>
maskClipSpaceMatrix.<span style="color: #006600;">invert</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// transform our vertex from local sprite space to world space</span>
v = clipSpaceMatrix.<span style="color: #006600;">transformVector</span><span style="color: #66cc66;">&#40;</span>v<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#93;</span> moved to clipspace: Vector3D<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">228</span>, -<span style="color: #cc66cc;">128</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// transform world space vertex back to local mask space</span>
<span style="color: #808080; font-style: italic;">// the result is the same vector of course, because the positions of mask and sprite are equal</span>
v = maskClipSpaceMatrix.<span style="color: #006600;">transformVector</span><span style="color: #66cc66;">&#40;</span>v<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#93;</span> moved to local mask <span style="color: #0066CC;">space</span>: Vector3D<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">128</span>, -<span style="color: #cc66cc;">128</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// calculate the uv coordinates from the local pixel position</span>
v = <span style="color: #000000; font-weight: bold;">new</span> Vector3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>v.<span style="color: #006600;">x</span> + <span style="color: #66cc66;">&#40;</span>maskBitmap.<span style="color: #0066CC;">width</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> maskBitmap.<span style="color: #0066CC;">width</span>,
                 <span style="color: #66cc66;">&#40;</span>v.<span style="color: #006600;">y</span> + <span style="color: #66cc66;">&#40;</span>maskBitmap.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> maskBitmap.<span style="color: #0066CC;">height</span>,
                  <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">1.0</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// the result is what we expect, the top right uv coordinate:</span>
<span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#93;</span> local mask uv: Vector3D<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Porting this idea to a shader is pretty straight forward. Let&#8217;s code a PB3D Material Shader:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">void</span> evaluateVertex<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
     interpolatedUV = float4<span style="color: #66cc66;">&#40;</span>uvCoord.<span style="color: #006600;">x</span> + uvOffset.<span style="color: #006600;">x</span>, uvCoord.<span style="color: #006600;">y</span> + uvOffset.<span style="color: #006600;">y</span>, <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">0.0</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
     float4 worldSpacePos = float4<span style="color: #66cc66;">&#40;</span>vertexPos.<span style="color: #006600;">x</span>, vertexPos.<span style="color: #006600;">y</span>, <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">1.0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> objectToClipSpaceTransform;
     <span style="color: #808080; font-style: italic;">// maskObjectToClipSpaceTransform is the invertex clipspace matrix of the mask</span>
     float4 localMaskSpacePos = worldSpacePos <span style="color: #66cc66;">*</span> maskObjectToClipSpaceTransform;
&nbsp;
     <span style="color: #808080; font-style: italic;">// halfMaskSize.xy is maskBitmap.width/height * 0.5 passed as a parameter</span>
     <span style="color: #808080; font-style: italic;">// invertedMaskSize.xy = 1.0 / maskBitmap.width/height passed as a parameter, because divisions are not properly working in the current pb3d release</span>
     interpolatedMaskUV = float4<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>localMaskSpacePos.<span style="color: #006600;">x</span> + halfMaskSize.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> invertedMaskSize.<span style="color: #006600;">x</span>,
                                 <span style="color: #66cc66;">&#40;</span>localMaskSpacePos.<span style="color: #006600;">y</span> + halfMaskSize.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> invertedMaskSize.<span style="color: #006600;">y</span>,
                                  <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">0.0</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">void</span> evaluateFragment<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    float4 texel = sample<span style="color: #66cc66;">&#40;</span>textureImage, float2<span style="color: #66cc66;">&#40;</span>interpolatedUV.<span style="color: #006600;">x</span>, interpolatedUV.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>, PB3D_2D <span style="color: #66cc66;">|</span> PB3D_MIPNEAREST <span style="color: #66cc66;">|</span> PB3D_CLAMP<span style="color: #66cc66;">&#41;</span>;
    float4 texel2 = sample<span style="color: #66cc66;">&#40;</span>textureMaskImage, float2<span style="color: #66cc66;">&#40;</span>interpolatedMaskUV.<span style="color: #006600;">x</span>, interpolatedMaskUV.<span style="color: #006600;">y</span><span style="color: #66cc66;">&#41;</span>, PB3D_2D <span style="color: #66cc66;">|</span> PB3D_MIPNEAREST <span style="color: #66cc66;">|</span> PB3D_CLAMP<span style="color: #66cc66;">&#41;</span>;
&nbsp;
    result = float4<span style="color: #66cc66;">&#40;</span>texel.<span style="color: #006600;">r</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">color</span>.<span style="color: #006600;">r</span> <span style="color: #66cc66;">*</span> texel2.<span style="color: #006600;">r</span>,
                    texel.<span style="color: #006600;">g</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">color</span>.<span style="color: #006600;">g</span> <span style="color: #66cc66;">*</span> texel2.<span style="color: #006600;">g</span>,
                    texel.<span style="color: #006600;">b</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">color</span>.<span style="color: #006600;">b</span> <span style="color: #66cc66;">*</span> texel2.<span style="color: #006600;">b</span>,
                    texel.<span style="color: #006600;">a</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">color</span>.<span style="color: #006600;">a</span> <span style="color: #66cc66;">*</span> texel2.<span style="color: #006600;">a</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>If you don&#8217;t want to use PixelBender3D and like to &#8216;torture&#8217; yourself with AGAL, you can write the same shader this way:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*
vertex shader:
&nbsp;
vc0-vc3 = clipspace matrix of sprite
vc4-vc7 = inverted clipspace matrix of mask
vc8.xy = half mask width / height
vc8.zw = mask width / height
va0 = vertex
va1 = uv
*/</span>
&nbsp;
m44 vt0, va0, vc0           <span style="color: #808080; font-style: italic;">// vertex * clipspace</span>
m44 vt1, vt0, vc4           <span style="color: #808080; font-style: italic;">// clipspace to local pos in mask</span>
<span style="color: #0066CC;">add</span> vt1.<span style="color: #006600;">xy</span>, vt1.<span style="color: #006600;">xy</span>, vc8.<span style="color: #006600;">xy</span>  <span style="color: #808080; font-style: italic;">// add half masksize to local pos</span>
div vt1.<span style="color: #006600;">xy</span>, vt1.<span style="color: #006600;">xy</span>, vc8.<span style="color: #006600;">zw</span>  <span style="color: #808080; font-style: italic;">// local pos / masksize</span>
mov v0, va1                 <span style="color: #808080; font-style: italic;">// copy uv</span>
mov v1, vt1                 <span style="color: #808080; font-style: italic;">// copy mask uv</span>
mov op, vt0                 <span style="color: #808080; font-style: italic;">// output position</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*
fragment shader:
*/</span>
&nbsp;
mov ft0, v0                                <span style="color: #808080; font-style: italic;">// get interpolated uv coords</span>
tex ft1, ft0, fs0 <span style="color: #66cc66;">&lt;</span>2d,clamp,linear,nomip<span style="color: #66cc66;">&gt;</span>  <span style="color: #808080; font-style: italic;">// sample texture</span>
mov ft2, v1                                <span style="color: #808080; font-style: italic;">// get interpolated uv coords for mask</span>
tex ft3, ft2, fs1 <span style="color: #66cc66;">&lt;</span>2d,clamp,linear,nomip<span style="color: #66cc66;">&gt;</span>  <span style="color: #808080; font-style: italic;">// sample mask</span>
mul ft1, ft1, ft3                          <span style="color: #808080; font-style: italic;">// mult mask color with tex color</span>
mov oc, ft1                                <span style="color: #808080; font-style: italic;">// output color</span></pre></div></div>

<p>The result is visible here: <a href="http://www.nulldesign.de/nd2d/tests/mask_alpha.html" target="_blank">ND2D &#8211; alpha masks</a> (Move your mouse over the crates). I added one more feature: You can set the alpha of a mask, that means that you can specify how much the mask affects the sprite. In the demo above the alpha fades from 0.0 to 1.0. Since we&#8217;re using all four color components in our calculations (r,g,b,a), we can not only mask the alpha, but all color channels. I don&#8217;t know if this it&#8217;s a &#8220;nice thing to have&#8221; or if it will get annoying when you use sprites as masks in your game and need to provide an extra image for that. Just let me know :) Here is the example: <a href="http://www.nulldesign.de/nd2d/tests/mask_color.html" target="_blank">ND2D &#8211; disco color masks</a>.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2011/09/02/nd2d-stage3d-masks/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>ND2D – Pixel Bleeding</title>
		<link>http://www.nulldesign.de/2011/08/30/nd2d-pixel-bleeding/</link>
		<comments>http://www.nulldesign.de/2011/08/30/nd2d-pixel-bleeding/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 15:26:58 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=619</guid>
		<description><![CDATA[This post is more a note to myself, but you might find that interesting. There was a bug that was annoying me for a while in ND2D, but I didn&#8217;t had the time to fix it: When you use spritesheets and the sprites are packed without any space between them like this one: It&#8217;s likely &#8230; <a href="http://www.nulldesign.de/2011/08/30/nd2d-pixel-bleeding/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>This post is more a note to myself, but you might find that interesting.</p>
<p>There was a bug that was annoying me for a while in <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a>, but I didn&#8217;t had the time to fix it: When you use spritesheets and the sprites are packed without any space between them like this one:</p>
<p><img class="alignnone size-full wp-image-624" title="packed_sheet" src="http://www.nulldesign.de/wp-content/uploads/2011/08/packed_sheet.jpg" alt="" width="108" height="100" /></p>
<p>It&#8217;s likely that you run into issues where the GPU is drawing the pixels of another sprite around your sprite. This looks like this then (The lower image is the fixed version):</p>
<p><img class="alignnone size-full wp-image-620" title="pixelbleeding" src="http://www.nulldesign.de/wp-content/uploads/2011/08/pixelbleeding.jpg" alt="" width="500" height="316" /></p>
<p>If you use mip-mapping it get&#8217;s even worse, but that&#8217;s another story&#8230;</p>
<p>This happens, because OpenGL / DirectX needs to have the center of uv-coordinates on the pixel and not on the edge of the pixel. The solution is pretty simple: Instead of calculating the uv-coordinates from 0 to screenwidth, you&#8217;re technically supposed to calculate from 0.5 to screenwidth &#8211; 0.5. This way the edge pixels are &#8220;cropped&#8221; out and the bleeding stops :)</p>
<p>Operation successful, patient alive &amp; breathing. Nurse, I need a drink, cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2011/08/30/nd2d-pixel-bleeding/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>FP11 Public Beta totally rocks!</title>
		<link>http://www.nulldesign.de/2011/07/14/fp11-public-beta-totally-rocks/</link>
		<comments>http://www.nulldesign.de/2011/07/14/fp11-public-beta-totally-rocks/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 14:23:03 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=588</guid>
		<description><![CDATA[Hi there, I just updated ND2D to the latest public beta of the Flash Player 11. I&#8217;m totally amazed how much faster the new player is. Without any codechanges I get as twice as much FPS in most of my demos. Check it out:]]></description>
				<content:encoded><![CDATA[<p>Hi there,</p>
<p>I just updated <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a> to the latest public beta of the <a href="http://labs.adobe.com/downloads/flashplayer11.html" target="_blank">Flash Player 11</a>. I&#8217;m totally amazed how much faster the new player is. Without any codechanges I get as twice as much FPS in most of my demos. Check it out:</p>
<p><a href="http://nulldesign.de/nd2d/tests/"><img class="alignnone size-full wp-image-589" title="particles" src="http://www.nulldesign.de/wp-content/uploads/2011/07/particles.jpg" alt="" width="500" height="279" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2011/07/14/fp11-public-beta-totally-rocks/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>ND2D – Demo</title>
		<link>http://www.nulldesign.de/2011/04/29/nd2d-demo/</link>
		<comments>http://www.nulldesign.de/2011/04/29/nd2d-demo/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 12:18:06 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=579</guid>
		<description><![CDATA[I needed some more serious game scenarios to test ND2D. So I created this little sidescroller demo: Be patient, there is no preloader&#8230; The visuals I created, were heavily inspired by Glit. I hope they will release a playable version of the game soon! It features most of the effects currently implemented in ND2D: - &#8230; <a href="http://www.nulldesign.de/2011/04/29/nd2d-demo/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I needed some more serious game scenarios to test <a href="https://github.com/nulldesign/nd2d" target="_blank">ND2D</a>. So I created this little sidescroller demo:</p>
<p style="text-align: left;"><a href="http://www.nulldesign.de/nd2d/sidescroller/main.html" target="_blank"><img class="size-full wp-image-580" title="nd2d_world" src="http://www.nulldesign.de/wp-content/uploads/2011/04/nd2d_world.jpg" alt="" width="500" height="278" /></a></p>
<p>Be patient, there is no preloader&#8230; The visuals I created, were heavily inspired by <a href="http://www.glid.co.uk/" target="_blank">Glit</a>. I hope they will release a playable version of the game soon!</p>
<p>It features most of the effects currently implemented in ND2D:<br />
- 2D Sprites (floor and ceiling)<br />
- Particles (fire and moving dust)<br />
- 2D Grid (Distortion effect on the &#8216;cloud&#8217; layer)<br />
- 2D SpriteSheets (waving grass)</p>
<p>This little demo runs in full screen at 60hz on my machine! Yay! I&#8217;ll add it to the examples with the latest improvements I made for ND2D the next days.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2011/04/29/nd2d-demo/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>ND2D – Box2D Tests</title>
		<link>http://www.nulldesign.de/2011/04/27/nd2d-box2d-tests/</link>
		<comments>http://www.nulldesign.de/2011/04/27/nd2d-box2d-tests/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 18:01:26 +0000</pubDate>
		<dc:creator>lars</dc:creator>
				<category><![CDATA[Molehill / Stage3D]]></category>
		<category><![CDATA[ND2D]]></category>
		<category><![CDATA[Talk]]></category>

		<guid isPermaLink="false">http://www.nulldesign.de/?p=567</guid>
		<description><![CDATA[Good news everyone. Sven was so kind to create a little demo with Box2D and ND2D. The performance is already pretty good, but there are still a lot of things I have to optimize. I&#8217;ll include the source code of the Box2D example in the sources and post some more details of the latest ND2D features &#8230; <a href="http://www.nulldesign.de/2011/04/27/nd2d-box2d-tests/">Read more <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Good news everyone. <a href="http://ghost23.de/" target="_blank">Sven</a> was so kind to create a little demo with Box2D and ND2D. The performance is already pretty good, but there are still a lot of things I have to optimize. I&#8217;ll include the source code of the Box2D example in the sources and post some more details of the latest ND2D features the next days.</p>
<p><a href="http://www.nulldesign.de/nd2d/tests/box2d_demo.html" target="_blank"><img class="alignnone size-full wp-image-568" title="nd2d_box2d" src="http://www.nulldesign.de/wp-content/uploads/2011/04/nd2d_box2d.png" alt="" width="493" height="286" /></a><br />
(Note: The demo is broken with the latest Flashplayer 11 Release due to API changes)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nulldesign.de/2011/04/27/nd2d-box2d-tests/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
