<?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/"
	>

<channel>
	<title>Jean-Marc Le Roux</title>
	<atom:link href="http://blogs.aerys.in/jeanmarc-leroux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.aerys.in/jeanmarc-leroux</link>
	<description>Web, RIAs and chocolate spaghettis...</description>
	<lastBuildDate>Wed, 09 May 2012 09:30:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Minko 2 Collada Extension Available</title>
		<link>http://blogs.aerys.in/jeanmarc-leroux/2012/05/09/minko-2-collada-extension-available/</link>
		<comments>http://blogs.aerys.in/jeanmarc-leroux/2012/05/09/minko-2-collada-extension-available/#comments</comments>
		<pubDate>Wed, 09 May 2012 07:07:03 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Aerys]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Minko]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Collada]]></category>
		<category><![CDATA[Flash 11]]></category>
		<category><![CDATA[Minko 2]]></category>
		<category><![CDATA[Stage3D]]></category>

		<guid isPermaLink="false">http://blogs.aerys.in/jeanmarc-leroux/?p=1835</guid>
		<description><![CDATA[We've just pushed the 2.0b branch for minko-collada on github, our Minko extension to load Collada files. We've patched our Collada files loader to provide much faster parsing times. In our tests, some of the files now take up to 10 times less time to load. You can now load 100+MB *.DAE files containing 600 [...]]]></description>
			<content:encoded><![CDATA[<p>We've just pushed <a href="https://github.com/aerys/minko-collada/tree/2.0b">the 2.0b branch for minko-collada on github</a>, our Minko extension to load Collada files.</p>
<p>We've patched our Collada files loader to provide <strong>much faster parsing times</strong>. In our tests, some of the files now take <strong>up to 10 times less time to load. You can now load 100+MB *.DAE files containing 600 000 polygons and more</strong>, including animations.</p>
<p>Another important addition is that we now parse a lot more data about the materials. <strong>We are now able to load material values</strong> such as the reflectivity, shininess and more to make it easier for the artists to customize the rendering using their favorite CAO tool.</p>
<p>A small patch will soon will soon not only read this data but use it properly to match the requirements of the new version of the lighting engine (minko-lighting). This patch should be available with the 2.0b branch of minko-lighting, which should be released at the end of next week.</p>
<p>Still, it's very important to remember that <strong>material settings and edition are very different matters whether you consider real-time or pre-computed 3D rendering</strong>. Thus, Minko Studio and Minko ShaderLab will always be the best way to work on real-time materials:</p>
<p><center><iframe width="560" height="315" src="http://www.youtube.com/embed/Uzj5lkniPVY?rel=0" frameborder="0" allowfullscreen></iframe></center></p>
<p>In this video you see how in just 30 minutes we go from a simple 3D shape to a photo-realistic rendering using only Minko Studio. Using code only, this operation would take hours, if not days.</p>
<p><strong>We're dedicated to make those tools user friendly for the artists in order to provide a smooth developer/designer workflow to target both mobile, web and desktop platforms</strong>. Minko Studio is currently being tested by multiple game developers around the world and we've received very positive feedback.</p>
<p>We've also fixed a lot of minor bugs. It was also updated to fit Minko 2 new APIs of course. If you have questions or suggestions, you can post in the comments or on <a href="http://answers.aerys.in">Aerys Answers</a> using <a href="http://answers.aerys.in/discussions/tagged/minko-collada">the minko-collada tag</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.aerys.in/jeanmarc-leroux/2012/05/09/minko-2-collada-extension-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>100+ Watching Minko On GitHub</title>
		<link>http://blogs.aerys.in/jeanmarc-leroux/2012/04/25/100-watching-minko-on-github/</link>
		<comments>http://blogs.aerys.in/jeanmarc-leroux/2012/04/25/100-watching-minko-on-github/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 08:00:27 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Aerys]]></category>
		<category><![CDATA[Minko]]></category>

		<guid isPermaLink="false">http://blogs.aerys.in/jeanmarc-leroux/?p=1819</guid>
		<description><![CDATA[I'm very happy and honored to celebrate the 100th watcher on Minko's repository on github. As you know, we're making an increasing effort to deliver the most powerful, most extensible and yet simplest 3D engine ever created. And believe me when I say the beta release of Minko 2 is just the beginning: the tools [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/github-logo.png" alt="" title="github-logo" width="580" height="230" class="aligncenter size-full wp-image-1820" /></p>
<p>I'm very happy and honored to celebrate the 100th watcher on <a href="http://github.com/aerys/minko">Minko's repository on github</a>. As you know, we're making an increasing effort to deliver the most powerful, most extensible and yet simplest 3D engine ever created. And believe me when I say the beta release of Minko 2 is just the beginning: the tools - Minko Studio and ShaderLab - will give you just another incredible productivity and creativity boost.</p>
<p><strong>And this is just a start... thank you all!</strong> <img src='http://blogs.aerys.in/jeanmarc-leroux/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If you want to start working with Minko 2 today, you can <a href="https://github.com/aerys/minko/tree/2.0b">get the core framework beta</a> and <a href="https://github.com/aerys/minko-examples/tree/master/src/aerys/minko/example/core">the corresponding examples on github</a> today.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.aerys.in/jeanmarc-leroux/2012/04/25/100-watching-minko-on-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minko 2 Beta Available On GitHub</title>
		<link>http://blogs.aerys.in/jeanmarc-leroux/2012/04/24/minko-2-beta-available-on-github/</link>
		<comments>http://blogs.aerys.in/jeanmarc-leroux/2012/04/24/minko-2-beta-available-on-github/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 13:42:27 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Aerys]]></category>
		<category><![CDATA[Minko]]></category>
		<category><![CDATA[Minko 2]]></category>
		<category><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://blogs.aerys.in/jeanmarc-leroux/?p=1803</guid>
		<description><![CDATA[The first public beta of Minko 2 is available on GitHub. For now, only the core framework is online. The extensions such as minko-collada and minko-lighting will follow in the next few weeks. This new version of Minko will add: A much faster rendering pipeline (+3000% in the best cases) Support for the MK file [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/256.png" rel="shadowbox[sbpost-1803];player=img;"><img src="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/256.png" alt="" title="256" width="256" height="50" class="aligncenter size-full wp-image-1758" /></a></p>
<p>The first public beta of <a href="https://github.com/aerys/minko/tree/2.0b">Minko 2 is available on GitHub</a>. For now, only the core framework is online. The extensions such as minko-collada and minko-lighting will follow in the next few weeks.</p>
<p>This new version of Minko will add:</p>
<ul>
<li>A much <strong>faster rendering pipeline (+3000% in the best cases)</strong></li>
<li>Support for <strong>the MK file format, optimized for web/mobile 3D applications</strong> with lossy/lossless 3D compression for files up to 50 times lighter</li>
<li><strong>Minko Studio to build 3D scenes and export optimized MK files</strong></li>
<li><strong>Minko ShaderLab to create 3D hardware accelerated rendering effects</strong></li>
<li>Lightweight MVC architecture to easily add code for game/application logic</li>
<li>Faster dynamic JIT shader compiler with more optimizations and support for the "kil" AGAL instruction</li>
<li><strong>Simplified API to program the GPU with ActionScript code</strong></li>
<li>Unified scene-to-shaders data binding API</li>
<li>Procedural animations API</li>
<li>Better performances for the Collada parser</li>
<li>New open source examples in <a href="https://github.com/aerys/minko-examples">minko-examples</a></li>
<li>Better quality for projected shadows</li>
<li>Projected shadows on every light types</li>
<li>Cubic, spheric and Blinn-Newell reflections</li>
<li>Support for ambient occlusion maps</li>
</ul>
<p>To learn more and ask questions about Minko 2, you can read the <a href="http://answers.aerys.in/discussion/78/about-minko-2">"About Minko 2" thread on Aerys Answers</a>.</p>
<p><center><iframe width="560" height="315" src="http://www.youtube.com/embed/Uzj5lkniPVY?rel=0" frameborder="0" allowfullscreen></iframe></center></p>
<p><center><iframe width="560" height="315" src="http://www.youtube.com/embed/yuR1e1PjU8Y?rel=0" frameborder="0" allowfullscreen></iframe></center></p>
<p>If you have questions or suggestions, you can post on <a href="http://answers.aerys.in">Aerys Answers</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.aerys.in/jeanmarc-leroux/2012/04/24/minko-2-beta-available-on-github/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Spritesheets With Minko</title>
		<link>http://blogs.aerys.in/jeanmarc-leroux/2012/04/20/spritesheets-with-minko/</link>
		<comments>http://blogs.aerys.in/jeanmarc-leroux/2012/04/20/spritesheets-with-minko/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 10:19:51 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Aerys]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Minko]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Minko 2]]></category>
		<category><![CDATA[shader]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blogs.aerys.in/jeanmarc-leroux/?p=1768</guid>
		<description><![CDATA[Update: the full source code for this tutorial is available in minko-examples on GitHub. Spritesheets are a nice way to create nice effects with an extensive artistic control. You just have to create a texture with a series of cool-looking sprites to have a nice animation. They are widely used for particles, fog and explosions [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: the full source code for this tutorial is available in <a href="https://github.com/aerys/minko-examples/tree/master/src/aerys/minko/example/core/spritesheet">minko-examples on GitHub</a>.</p>
<p>Spritesheets are a nice way to create nice effects with an extensive artistic control. You just have to create a texture with a series of cool-looking sprites to have a nice animation. They are widely used for particles, fog and explosions for example. We used spritesheets to render the explosions and the clouds in our latest game: <a href="http://themirage.fr">The Mirage</a>.</p>
<p><center><iframe width="560" height="315" src="http://www.youtube.com/embed/zPoVztkMDxE?rel=0" frameborder="0" allowfullscreen></iframe></center></p>
<p>When you have the spritesheet itself, you need two things to get it working in your application:</p>
<ol>
<li>A "frame id" value that will be updated to tell which frame of the spritesheet should be sampled.</li>
<li>A shader that will sample the spritesheet accordingly.</li>
</ol>
<p>And here is what you get:</p>
<p><a href="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/SpritesheetExample.html" rel="shadowbox;width=800;height=600"><img src="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/minko_spritesheet_explosion.jpg" alt="" title="minko_spritesheet_explosion" width="600" height="365" class="aligncenter size-full wp-image-1777" /></a></p>
<p><span id="more-1768"></span><br />
The first point is very interesting because it will allow me to introduce the new MVC architecture inside Minko 2. To animate stuff - and when I say "animate" I mean "update any kind of value depending on time" - we use a controller called the "AnimationController". The very interesting point here is that animating a 3D matrix to translate an object or animating our "frame id" works exactly the same way.</p>
<p><strong>It really was one of our main objectives with Minko 2: make everything a lot easier.</strong> And being able to animate scene properties - whether they are used by the scene itself or the shaders - with a single API is a good proof that our work has paid. One would say that there is no such thing as a scene "property" that shall not be used in a shader. And at some extend it is a valid assumption. Thus, having a simplified general purpose API to automate the scene-to-shader marshalling is a must have <img src='http://blogs.aerys.in/jeanmarc-leroux/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>The Shader</h3>
<p>I'll start by creating the shader and then see how we can add the animation. The vertex shader just makes sure the quad always faces the camera. This effect is achieved by transforming (0, 0, 0) into view space and then use the actual (x, y, z) position of the vertex as an offset. Because (0, 0, 0) will not be affected by any rotation, we end up with a view space quad facing the camera. It has nothing to do with spritesheets per say, but in the end they are mostly used for particles effects so rendering camera-facing quads is a must have:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> getVertexPosition<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span>SFloat
<span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> id		<span style="color: #000066; font-weight: bold;">:</span> SFloat	= vertexId<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> corner	<span style="color: #000066; font-weight: bold;">:</span> SFloat	= vertexXY<span style="color: #000066; font-weight: bold;">.</span>xy<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">position</span>	<span style="color: #000066; font-weight: bold;">:</span> SFloat	= float4<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #004993;">position</span> = localToView<span style="color: #000000;">&#40;</span><span style="color: #004993;">position</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #004993;">position</span> = <span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">position</span><span style="color: #000066; font-weight: bold;">,</span> float4<span style="color: #000000;">&#40;</span>corner<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">return</span> multiply4x4<span style="color: #000000;">&#40;</span><span style="color: #004993;">position</span><span style="color: #000066; font-weight: bold;">,</span> projectionMatrix<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Then we have to sample the spritesheet. Here is how a classic explosion spritesheet looks like:</p>
<p><a href="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/explosion_opaque.png" rel="shadowbox[sbpost-1768];player=img;"><img src="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/explosion_opaque-300x300.png" alt="" title="explosion_opaque" width="300" height="300" class="aligncenter size-medium wp-image-1770" /></a></p>
<p>The pixel shader just needs to translate/scale the actual per-vertex UVs according to the frame we want to sample:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> getPixelColor<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span>SFloat
<span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">frame</span>	<span style="color: #000066; font-weight: bold;">:</span> SFloat = <span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span>meshBindings<span style="color: #000066; font-weight: bold;">.</span>getParameter<span style="color: #000000;">&#40;</span>
		<span style="color: #990000;">&quot;spritesheetFrameId&quot;</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> uv		<span style="color: #000066; font-weight: bold;">:</span> SFloat = <span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0.5</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">interpolate</span><span style="color: #000000;">&#40;</span>vertexXY<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> diffuseMap	<span style="color: #000066; font-weight: bold;">:</span> SFloat = meshBindings<span style="color: #000066; font-weight: bold;">.</span>getTextureParameter<span style="color: #000000;">&#40;</span>
		<span style="color: #990000;">&quot;diffuseMap&quot;</span><span style="color: #000066; font-weight: bold;">,</span>
		SamplerFiltering<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">LINEAR</span><span style="color: #000066; font-weight: bold;">,</span>
		SamplerMipMapping<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">LINEAR</span><span style="color: #000066; font-weight: bold;">,</span>
		SamplerWrapping<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLAMP</span>
	<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #6699cc; font-weight: bold;">var</span> spriteSheetOffset	<span style="color: #000066; font-weight: bold;">:</span> SFloat = float2<span style="color: #000000;">&#40;</span>
		modulo<span style="color: #000000;">&#40;</span><span style="color: #004993;">frame</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span>divide<span style="color: #000000;">&#40;</span><span style="color: #004993;">frame</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #6699cc; font-weight: bold;">var</span> spriteSheetUv	<span style="color: #000066; font-weight: bold;">:</span> SFloat = divide<span style="color: #000000;">&#40;</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span>spriteSheetOffset<span style="color: #000066; font-weight: bold;">,</span> uv<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">return</span> sampleTexture<span style="color: #000000;">&#40;</span>diffuseMap<span style="color: #000066; font-weight: bold;">,</span> spriteSheetUv<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>You can then setup your scene like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>Embed<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;../assets/explosion.png&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
<span style="color: #0033ff; font-weight: bold;">private</span> static const ASSET_SPRITESHEET	<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Class</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
scene<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> Mesh<span style="color: #000000;">&#40;</span>
	<span style="color: #0033ff; font-weight: bold;">new</span> BillboardsGeometry<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #000000;">&#123;</span>
		diffuseMap		<span style="color: #000066; font-weight: bold;">:</span> TextureLoader<span style="color: #000066; font-weight: bold;">.</span>loadClass<span style="color: #000000;">&#40;</span>ASSET_SPRITESHEET<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span>
		spritesheetFrameId	<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #000000; font-weight:bold;">0</span>
	<span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #0033ff; font-weight: bold;">new</span> Effect<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> SpritesheetShader<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>You can send change the value of the "spritesheetFrameId" property and see how the rendering changes. Now how to make the spritesheet "playable" like a real animation?</p>
<h3>The Controller</h3>
<p>The first (crappy) solution is to implement a timer or something like this. Don't get me wrong: it works. Yet, you'll have only the basics of the animation: you'll be able to play it. You'll have to add some code to be able to stop it, play it reversed, etc... And I'm not even speaking about naming frames to have multiple animations in a single spritesheet.</p>
<p>But wait! As I explained earlier, Minko provides the AnimationController. Controller like in "Model View Controller". <strong>In Minko 2, your scene is the View, the "properties" and the data binding API handle the Model and you can use/create/add Controllers</strong>. The AnimationController is one of those controllers and it is specially designed to animate stuff.</p>
<p>Here is how we can use it to animate our spritesheet:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> ssc <span style="color: #000066; font-weight: bold;">:</span> AnimationController = <span style="color: #0033ff; font-weight: bold;">new</span> AnimationController<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">&lt;</span>ITimeline<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#91;</span>
	<span style="color: #0033ff; font-weight: bold;">new</span> ScalarRegularTimeline<span style="color: #000000;">&#40;</span>
		<span style="color: #990000;">'properties.spritesheetFrameId'</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #000000; font-weight:bold;">1000</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">&lt;</span>Number<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">24</span><span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>You can then use all the methods of the AnimationController to animate your spritesheet:</p>
<ul>
<li>play/stop</li>
<li>goToAndPlay/goToAndStop</li>
<li>setPlaybackWindow</li>
</ul>
<p>The AnimationController.setPlaybackWindow is very cool because it makes it possible to dynamically setup the "bounds" of the timeline in order to play only a part of it. It's very useful to store multiple animations in one timeline and then play each of them separately. To put it in a nutshell, you have the same control than you have on a MovieClip. But everything is happening on the GPU and the timeline is created programmatically and can animate any property.</p>
<p>Here we use the ScalarRegularTimeline because our "spritesheetFrameId" property is a scalar value. You have other timelines to animate 3D matrices or colors for example. Here is the full code for the scene setup:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> sprite <span style="color: #000066; font-weight: bold;">:</span> Mesh = <span style="color: #0033ff; font-weight: bold;">new</span> Mesh<span style="color: #000000;">&#40;</span>
	<span style="color: #0033ff; font-weight: bold;">new</span> BillboardsGeometry<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #000000;">&#123;</span> diffuseMap <span style="color: #000066; font-weight: bold;">:</span> TextureLoader<span style="color: #000066; font-weight: bold;">.</span>loadClass<span style="color: #000000;">&#40;</span>ASSET_SPRITESHEET<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #0033ff; font-weight: bold;">new</span> Effect<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> SpritesheetShader<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span>
<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
sprite<span style="color: #000066; font-weight: bold;">.</span>addController<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> AnimationController<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">&lt;</span>ITimeline<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#91;</span>
	<span style="color: #0033ff; font-weight: bold;">new</span> ScalarRegularTimeline<span style="color: #000000;">&#40;</span>
		<span style="color: #990000;">'properties.spritesheetFrameId'</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #000000; font-weight:bold;">1000</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">&lt;</span>Number<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">24</span><span style="color: #000000;">&#93;</span>
	<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
scene<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>sprite<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>If you have questions, you can post in the comments on or <a href="http://answers.aerys.in">Aerys Answers</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.aerys.in/jeanmarc-leroux/2012/04/20/spritesheets-with-minko/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>First Minko Workshop In Paris, France!</title>
		<link>http://blogs.aerys.in/jeanmarc-leroux/2012/04/17/first-minko-workshop-in-paris-france/</link>
		<comments>http://blogs.aerys.in/jeanmarc-leroux/2012/04/17/first-minko-workshop-in-paris-france/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 11:32:48 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Aerys]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Minko]]></category>

		<guid isPermaLink="false">http://blogs.aerys.in/jeanmarc-leroux/?p=1757</guid>
		<description><![CDATA[I've met a lot of people willing to start working with Minko. That's why we've decided to organize our very first workshop ever! This first workshop would be about Minko's basics: how to create a simple scene how to manipulate a scene (add animation, change textures...) how to handle the camera how to load Collada/3ds/Obj [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/256.png" alt="" title="256" width="256" height="50" class="aligncenter size-full wp-image-1758" /></p>
<p>I've met a lot of people willing to start working with Minko. That's why we've decided to organize our very first workshop ever!<br />
This first workshop would be about Minko's basics:</p>
<ul>
<li>how to create a simple scene</li>
<li>how to manipulate a scene (add animation, change textures...)</li>
<li>how to handle the camera</li>
<li>how to load Collada/3ds/Obj files</li>
<li>the best practices</li>
</ul>
<p>This first workshop is free.<br />
The current date is set to the 23rd of May.<br />
This workshop will take the entire afternoon and will be set in our Paris office.</p>
<p>We just need to make sure we will have enough participants first so if you are interested, please post on Aerys Answers:</p>
<p><a href="http://answers.aerys.in/discussion/86/first-minko-workshop-in-paris-france#Item_1">"First Minko workshop in Paris, France!" on Aerys Answers</a></p>
<p>I hope a lot of people will attend <img src='http://blogs.aerys.in/jeanmarc-leroux/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.aerys.in/jeanmarc-leroux/2012/04/17/first-minko-workshop-in-paris-france/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Render To Texture With Minko 2</title>
		<link>http://blogs.aerys.in/jeanmarc-leroux/2012/04/16/render-to-texture-with-minko-2/</link>
		<comments>http://blogs.aerys.in/jeanmarc-leroux/2012/04/16/render-to-texture-with-minko-2/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 15:42:53 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Aerys]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Minko]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Flash 11]]></category>
		<category><![CDATA[Minko 2]]></category>
		<category><![CDATA[shader]]></category>

		<guid isPermaLink="false">http://blogs.aerys.in/jeanmarc-leroux/?p=1716</guid>
		<description><![CDATA[Update: If you want to give it a try, you can start working with Minko 2 beta today! During last week "Starting With Shaders" workshop, nicoptere asked me about Render To Texture (RTT). RTT is a very common technique used for multi-pass rendering. The principle is quite simple: the pre-passes render the scene in one [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: If you want to give it a try, you can <a href="http://blogs.aerys.in/jeanmarc-leroux/2012/04/24/minko-2-beta-available-on-github/">start working with Minko 2 beta today</a>!</p>
<p>During last week "Starting With Shaders" workshop, <a href="http://twitter.com/nicoptere" target="_blank">nicoptere</a> asked me about Render To Texture (RTT). RTT is a very common technique used for multi-pass rendering. The principle is quite simple: the pre-passes render the scene in one or more textures. This texture can then be sampled to provide per-pixel data during the rendering pass.</p>
<p>A very common use for RTT is <a href="http://en.wikipedia.org/wiki/Shadow_mapping" target="_blank">shadow mapping</a>. Shadow mapping is a technique to create projected shadows. The shadow mapping rendering pass will require access to the depth of each pixel as seen from the light source which is "emitting" the shadow. Therefore, each mesh will have more than just a rendering pass. Indeed, we will have to add a pre-pass for each light in the scene to generate it's "depth map".</p>
<p><strong>RTT can also be used to create portals!</strong> So it's a very cool feature.</p>
<p><a href="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/Portal-2.jpg" rel="shadowbox[sbpost-1716];player=img;"><img class="aligncenter size-medium wp-image-1719" title="Portal-2" src="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/Portal-2-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p><span id="more-1716"></span><br />
RTT might look quite simple. It reads like it's just like rendering in a texture. But it's not that simple: the goal of rendering in a texture is most likely to use that texture afterward during another pass. Therefore, some rendering passes will depend on other pre-passes. So you have to be able to sort all the passes. It's yet another symptom of the scene tree VS draw calls list paradox: the 3D scene is a tree but the rendering is performed as a list of passes/draw calls. As a developer, you want to affect the rendering effects to the meshes. It's a scene node/geometry centric paradigm. But the rendering API expects a list of passes and each pass will perform a draw call for each mesh it affects.</p>
<p><strong>With Minko 2, it's very easy to perform RTT or multi-pass rendering</strong>. Each Mesh as an Effect object. And this very Effect object is a collection of passes. Each pass is a shader, and each shader can render in a texture or directly in the back-buffer. <strong>The RenderingController does all the job and creates, organizes and performs all the mesh-to-passes operations</strong>. Here is a simple demo:</p>
<p><center><a href="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/RenderToTextureExample.html" rel="shadowbox;width=800;height=600"><img class="aligncenter size-full wp-image-1737" title="" src="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/Untitled-2.jpg" alt="" width="600" height="364" /></a></center>And here is the scene initialization code :</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900; font-style: italic;">// setup lighting</span>
scene<span style="color: #000066; font-weight: bold;">.</span>bindings<span style="color: #000066; font-weight: bold;">.</span>setProperties<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#123;</span>
	lightDirection		<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">new</span> Vector4<span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">.</span>1<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">.</span>1<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span>
	lightDiffuseColor	<span style="color: #000066; font-weight: bold;">:</span> 0xffffff<span style="color: #000066; font-weight: bold;">,</span>
	lightDiffuse		<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">.,</span>
	lightEnabled		<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">true</span>
<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">// create render targets</span>
<span style="color: #6699cc; font-weight: bold;">var</span> normalsTexture <span style="color: #000066; font-weight: bold;">:</span> RenderTarget = <span style="color: #0033ff; font-weight: bold;">new</span> RenderTarget<span style="color: #000000;">&#40;</span>
	<span style="color: #000000; font-weight:bold;">128</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">128</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #0033ff; font-weight: bold;">new</span> TextureResource<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">128</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">128</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span>
	0x000000ff
<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> positionsTexture <span style="color: #000066; font-weight: bold;">:</span> RenderTarget = <span style="color: #0033ff; font-weight: bold;">new</span> RenderTarget<span style="color: #000000;">&#40;</span>
	<span style="color: #000000; font-weight:bold;">128</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">128</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #0033ff; font-weight: bold;">new</span> TextureResource<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">128</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">128</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span>
	0x000000ff
<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">// create the teapot</span>
<span style="color: #6699cc; font-weight: bold;">var</span> teapot <span style="color: #000066; font-weight: bold;">:</span> Mesh = <span style="color: #0033ff; font-weight: bold;">new</span> Mesh<span style="color: #000000;">&#40;</span>
	<span style="color: #0033ff; font-weight: bold;">new</span> TeapotGeometry<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #000000;">&#123;</span>
		diffuseColor	<span style="color: #000066; font-weight: bold;">:</span> 0xffffff00<span style="color: #000066; font-weight: bold;">,</span>
		lightEnabled	<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">true</span>
	<span style="color: #000000;">&#125;</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #0033ff; font-weight: bold;">new</span> Effect<span style="color: #000000;">&#40;</span>
		<span style="color: #009900; font-style: italic;">// RTT passes</span>
		<span style="color: #0033ff; font-weight: bold;">new</span> VertexNormalShader<span style="color: #000000;">&#40;</span>normalsTexture<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #0033ff; font-weight: bold;">new</span> VertexPositionShader<span style="color: #000000;">&#40;</span>positionsTexture<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span>
		<span style="color: #009900; font-style: italic;">// rendering pass</span>
		<span style="color: #0033ff; font-weight: bold;">new</span> BasicShader<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
teapot<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">transform</span>
	<span style="color: #000066; font-weight: bold;">.</span>appendUniformScale<span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">.</span>5<span style="color: #000000;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">.</span>appendTranslation<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">0.6</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
scene<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>teapot<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">// create the sprites to see the result of the RTT</span>
scene<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span>
	<span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #000000; font-weight:bold;">128</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">128</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #000000;">&#123;</span> diffuseMap <span style="color: #000066; font-weight: bold;">:</span> normalsTexture<span style="color: #000066; font-weight: bold;">.</span>resource <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
scene<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span>
	<span style="color: #000000; font-weight:bold;">10</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">148</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #000000; font-weight:bold;">128</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">128</span><span style="color: #000066; font-weight: bold;">,</span>
	<span style="color: #000000;">&#123;</span> diffuseMap <span style="color: #000066; font-weight: bold;">:</span> positionsTexture<span style="color: #000066; font-weight: bold;">.</span>resource <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>The shaders I use for the RTT are debug shaders provided with Minko 2. Here is the code for the VertexNormalShader for example:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> final <span style="color: #9900cc; font-weight: bold;">class</span> VertexNormalShader <span style="color: #0033ff; font-weight: bold;">extends</span> BasicShader
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> VertexNormalShader<span style="color: #000000;">&#40;</span><span style="color: #004993;">target</span>	<span style="color: #000066; font-weight: bold;">:</span> RenderTarget	= <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span>
					  priority	<span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Number</span>	= <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">target</span><span style="color: #000066; font-weight: bold;">,</span> priority<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> getPixelColor<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> SFloat
	<span style="color: #000000;">&#123;</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> normal <span style="color: #000066; font-weight: bold;">:</span> SFloat = <span style="color: #004993;">interpolate</span><span style="color: #000000;">&#40;</span>
			vertexAnimation<span style="color: #000066; font-weight: bold;">.</span>getAnimatedVertexNormal<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		normal = <span style="color: #004993;">normalize</span><span style="color: #000000;">&#40;</span>normal<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		normal = divide<span style="color: #000000;">&#40;</span><span style="color: #004993;">add</span><span style="color: #000000;">&#40;</span>normal<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">return</span> float4<span style="color: #000000;">&#40;</span>normal<span style="color: #000066; font-weight: bold;">.</span>xyz<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>A very interesting thing here is that this shader extends the BasicShader. BasicShader handles all the "usual stuff" and its vertex shader does all the animations. So being able to extend it only to override the behavior of the pixel shader is a very cool feature.</p>
<p>RTT combined with ActionScript shaders is incredible. You have to remember that every AS shader you write can fork into many actual shaders on the GPU to handle all the rendering situations. It's yet another problem: it means a "pass" is not just a "shader", but multiple shaders forked from the original AS shader you wrote. For example, a normal pre-pass (rendering the normals in a texture) will have to work for both animated and static objects. So it's actually two passes: the normal pre-pass for the animated objects and the normal pre-pass for the static ones.</p>
<p>Thanks to the AS shaders and the rendering API, you write your shader once and Minko will figure it out all by itself: when to fork your shaders, how many passes are actually needed, what objects should be rendered during each pass, what pass has to be rendered first, etc...</p>
<p>If you have questions or comments, you can post here or on <a href="http://answers.aerys.in">Aerys Answers</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.aerys.in/jeanmarc-leroux/2012/04/16/render-to-texture-with-minko-2/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>&#8220;Starting With Shaders&#8221; Workshop</title>
		<link>http://blogs.aerys.in/jeanmarc-leroux/2012/04/13/starting-with-shaders-workshop/</link>
		<comments>http://blogs.aerys.in/jeanmarc-leroux/2012/04/13/starting-with-shaders-workshop/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 09:29:14 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Aerys]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Minko]]></category>

		<guid isPermaLink="false">http://blogs.aerys.in/jeanmarc-leroux/?p=1711</guid>
		<description><![CDATA[Update: if you want to learn more about Minko, you can subscribe to our first Minko workshop in Paris, France! Update 2: I patched the sources to add a few comments and fix a little mistake reported in the comments. Make sure you download the updated sources. I had the pleasure to animate a workshop [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: if you want to learn more about Minko, you can subscribe to <a href="http://answers.aerys.in/discussion/86/first-minko-workshop-in-paris-france#Item_1">our first Minko workshop in Paris, France</a>!</p>
<p><strong>Update 2</strong>: I patched the sources to add a few comments and fix a little mistake reported in the comments. Make sure you download <a href="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/shader-workshop-20120418.zip">the updated sources</a>.</p>
<p>I had the pleasure to animate a workshop just yesterday about "Starting With Shaders" here in Paris, France. It was very nice to meet new people and see what's going on in the heads of some of the most talented French Flash developers. It was also a nice occasion to gather feedback on the new implementation of Minko that we will soon share on GitHub.</p>
<p>I would like to thank the <a href="http://www.regart.net/">Regart.net</a> formation institute and all the attendees for their attention and support during the event. I think all went well and I will try to do more events like this in the near future.</p>
<p>I presented:</p>
<ul>
<li>why shaders are the very fabric of 3D applications</li>
<li>what shaders really imply on the development workflow</li>
<li>why AGAL is good for 3D engine developers, but not for game/application developers</li>
<li>what are the constraints inherited from the classic shader workflow</li>
<li>how those constraints are solved with Minko</li>
</ul>
<p>AGAL is explained through 4 examples: solid color, texture, directional lighting and cel shading rendering. Each sample is implemented using both raw AGAL and Minko. Doing AGAL was a bit a pain in the a**. But it was a good reminder of how Minko, ActionScript shaders and the ShaderLab can really empower the developers and the artists. If you don't understand the AGAL implementation, have a look at the ActionScript one which is - of course - much easier to read/work with.</p>
<p>You can download <a href="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/04/shader-workshop-20120418.zip">the sources and the slides</a>. They feature an intermediate version of Minko 2 which is basically what we will release in the next few days...</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.aerys.in/jeanmarc-leroux/2012/04/13/starting-with-shaders-workshop/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Minko 2 New Feature: XPath Selectors</title>
		<link>http://blogs.aerys.in/jeanmarc-leroux/2012/04/11/minko-2-new-feature-xpath/</link>
		<comments>http://blogs.aerys.in/jeanmarc-leroux/2012/04/11/minko-2-new-feature-xpath/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 09:40:49 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Aerys]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Minko]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[Minko 2]]></category>

		<guid isPermaLink="false">http://blogs.aerys.in/jeanmarc-leroux/?p=1705</guid>
		<description><![CDATA[Manipulating a scene graph is sometime quite a challenge. If you take the classic Flash display list for example: fetching tree nodes and modifying them as batches is not possible. You have to write a lot of code to simply fetch all the nodes you need reqgarding a set of creteria. Then you have to [...]]]></description>
			<content:encoded><![CDATA[<p>Manipulating a scene graph is sometime quite a challenge. If you take the classic Flash display list for example: fetching tree nodes and modifying them as batches is not possible. You have to write a lot of code to simply fetch all the nodes you need reqgarding a set of creteria. Then you have to loop on this set to call the proper functions and set the right properties.</p>
<p>Working with trees as a representation model is something XML is very good at. XPath is a part of the XML specification and it defines a specific syntax to select a subset of XML nodes in an XML document. I think the syntax is quite obvious and very intuitive as it inherits most of its design from the UNIX/URI paths.</p>
<p>That's why we chose to add a simple XPath implementation in Minko 2. You can now write this kind of things:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> visibleMeshes <span style="color: #000066; font-weight: bold;">:</span> SceneIterator = group<span style="color: #000066; font-weight: bold;">.</span><span style="color: #0033ff; font-weight: bold;">get</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;/group/mesh[visible=true]&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>The Group.get() method takes the XPath you wan to match and returns a SceneIterator object. This object acts as a wrapper for the fetched collection of nodes that matched your XPath request:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> visibleMeshes <span style="color: #000066; font-weight: bold;">:</span> SceneIterator = group<span style="color: #000066; font-weight: bold;">.</span><span style="color: #0033ff; font-weight: bold;">get</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;/group/mesh[visible=true]&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> numMeshes <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span> = visibleMeshes<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> numMeshes<span style="color: #000066; font-weight: bold;">;</span> <span style="color: #000066; font-weight: bold;">++</span>i<span style="color: #000000;">&#41;</span>
  visibleMeshes<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>The "[]" operator can be used to get the nth item of the fetched collection. To override this operator, we simply extend the Proxy class and override the flash_proxy getProperty() method. Extending the Proxy makes it possible to add two new features:<br />
- iterator: our SceneIterator object can be used in "for each" loops if we override the proper Proxy methods<br />
- property setters/getters overriding: set/get properties on all the selected nodes at once</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900; font-style: italic;">// fetch all the visible meshes and hide them</span>
group<span style="color: #000066; font-weight: bold;">.</span><span style="color: #0033ff; font-weight: bold;">get</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;//mesh[visible=true]&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">// fetch all the white meshes and make them white</span>
group<span style="color: #000066; font-weight: bold;">.</span><span style="color: #0033ff; font-weight: bold;">get</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;//mesh[@diffuseColor=0xffffffff]&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>bindings<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setProperty</span><span style="color: #000000;">&#40;</span>
  <span style="color: #990000;">&quot;diffuseColor&quot;</span><span style="color: #000066; font-weight: bold;">,</span>
  0xff0000ff
<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">// fetch all the visible white meshes and remove them from their parent</span>
group<span style="color: #000066; font-weight: bold;">.</span><span style="color: #0033ff; font-weight: bold;">get</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;/group/group/mesh[@diffuseColor=0xffffffff][visible=true]&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">parent</span> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blogs.aerys.in/jeanmarc-leroux/2012/04/11/minko-2-new-feature-xpath/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Minko 2 FAQ</title>
		<link>http://blogs.aerys.in/jeanmarc-leroux/2012/03/31/minko-2-faq/</link>
		<comments>http://blogs.aerys.in/jeanmarc-leroux/2012/03/31/minko-2-faq/#comments</comments>
		<pubDate>Sat, 31 Mar 2012 09:16:21 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Aerys]]></category>
		<category><![CDATA[Minko]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Flash 11]]></category>
		<category><![CDATA[Minko 2]]></category>
		<category><![CDATA[Stage3D]]></category>

		<guid isPermaLink="false">http://blogs.aerys.in/jeanmarc-leroux/?p=1701</guid>
		<description><![CDATA[I've just created a thread dedicated to Minko 2's FAQ on our forum: "About Minko 2" on Aerys Answers Please feel free to ask there any question you might have about Minko 2 and the new features! You can also read this thread. It contains a lot of technical questions/answers about how the framework works [...]]]></description>
			<content:encoded><![CDATA[<p>I've just created a thread dedicated to Minko 2's FAQ on our forum:</p>
<p><a href="http://answers.aerys.in/discussion/78/about-minko-2#Item_1">"About Minko 2" on Aerys Answers</a></p>
<p>Please feel free to ask there any question you might have about Minko 2 and the new features! You can also read <a href="http://answers.aerys.in/discussion/77/several-questions-about-minko-engine">this thread</a>. It contains a lot of technical questions/answers about how the framework works and what it provides.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.aerys.in/jeanmarc-leroux/2012/03/31/minko-2-faq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Mirage available on the Chrome Web Store</title>
		<link>http://blogs.aerys.in/jeanmarc-leroux/2012/03/19/the-mirage-available-on-the-chrome-web-store/</link>
		<comments>http://blogs.aerys.in/jeanmarc-leroux/2012/03/19/the-mirage-available-on-the-chrome-web-store/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 16:42:34 +0000</pubDate>
		<dc:creator>Promethe</dc:creator>
				<category><![CDATA[Orbit]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Chrome Web Store]]></category>
		<category><![CDATA[Flash 11]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://blogs.aerys.in/jeanmarc-leroux/?p=1694</guid>
		<description><![CDATA[The Mirage is our latest creation: a 3D small shoot'm up you can play with your iPhone/Android as a gamepad! Your smartphone becomes a game controller and you don't even have to install any application: it's all done in HTML5 in the mobile browser! This HTML5 magic is achieved with Orbit, our multi-platform real-time networking [...]]]></description>
			<content:encoded><![CDATA[<p>The Mirage is our latest creation: a 3D small shoot'm up you can play with your iPhone/Android as a gamepad! Your smartphone becomes a game controller and <strong>you don't even have to install any application: it's all done in HTML5 in the mobile browser!</strong></p>
<p><center><iframe width="560" height="315" src="http://www.youtube.com/embed/zPoVztkMDxE?rel=0" frameborder="0" allowfullscreen></iframe></center></p>
<p><a href="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/03/html5_cloudpad_600.png" rel="shadowbox[sbpost-1694];player=img;"><img src="http://blogs.aerys.in/jeanmarc-leroux/wp-content/uploads/2012/03/html5_cloudpad_600.png" alt="" title="html5_cloudpad_600" width="600" height="235" class="aligncenter size-full wp-image-1696" /></a></p>
<p>This HTML5 magic is achieved with <a href="http://aerys.in/orbit">Orbit</a>, our multi-platform real-time networking technology. And <a href="https://chrome.google.com/webstore/detail/eibikilmpbanbgffdfipjbpgkamgjhpi">The Mirage is now available on the Chrome Web Store!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.aerys.in/jeanmarc-leroux/2012/03/19/the-mirage-available-on-the-chrome-web-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

