<?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>BlackHC's Adventures in the Dev World</title>
	<atom:link href="http://blog.blackhc.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.blackhc.net</link>
	<description>Just another weblog</description>
	<lastBuildDate>Tue, 03 Aug 2010 14:28:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Light Propagation Volumes</title>
		<link>http://blog.blackhc.net/2010/07/light-propagation-volumes/</link>
		<comments>http://blog.blackhc.net/2010/07/light-propagation-volumes/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 15:44:39 +0000</pubDate>
		<dc:creator>BlackHC</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Game Projects]]></category>
		<category><![CDATA[Maths]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[Corrections]]></category>
		<category><![CDATA[Crytek]]></category>
		<category><![CDATA[I3D]]></category>
		<category><![CDATA[Light Propagation Volume]]></category>
		<category><![CDATA[LPV]]></category>
		<category><![CDATA[Reflective Shadow Map]]></category>
		<category><![CDATA[RSM]]></category>
		<category><![CDATA[Sponza]]></category>

		<guid isPermaLink="false">http://blog.blackhc.net/?p=795</guid>
		<description><![CDATA[I&#8217;ve finally finished my lab course last week &#8211; thanks to my supervisor Matthäus G. Chajdas &#8211; you can read his blog here -, it wasn&#8217;t your usual lab course with work sheets and boring homework, instead I&#8217;ve been allowed &#8230; <a href="http://blog.blackhc.net/2010/07/light-propagation-volumes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally finished my lab course last week &#8211; thanks to my supervisor Matthäus G. Chajdas &#8211; <a href="http://anteru.net/" target="_self">you can read his blog here</a> -, it wasn&#8217;t your usual lab course with work sheets and boring homework, instead I&#8217;ve been allowed to implement a nice paper about a <a href="http://en.wikipedia.org/wiki/Global Illumination" target="_blank" >Global Illumination</a> approximation algorithm called <a href="http://www.crytek.com/fileadmin/user_upload/inside/presentations/2010_I3D/20100301_lpv.pdf" target="_blank">(Cascaded) Light Propagation Volumes</a>. It&#8217;s been developed by Crytek and you can find more information (including some presentations and videos) on <a href="http://www.crytek.com/technology/presentations/" target="_blank">their server</a>. (Note: this is an implementation of the I3D paper, not the earlier SIGGRAPH one.)</p>
<div id="attachment_798" class="wp-caption alignnone" style="width: 650px"><a href="http://blog.blackhc.net/wp-content/uploads/2010/07/LPVfinal0.jpg"><img class="size-large wp-image-798 " title="LPVfinal0" src="http://blog.blackhc.net/wp-content/uploads/2010/07/LPVfinal0-1024x573.jpg" alt="" width="640" height="358" /></a><p class="wp-caption-text">Sponza scene (direct + indirect lighting w/ occlusion)</p></div>
<div id="attachment_799" class="wp-caption alignnone" style="width: 650px"><a href="http://blog.blackhc.net/wp-content/uploads/2010/07/LPVfinal1.jpg"><img class="size-large wp-image-799" title="LPVfinal1" src="http://blog.blackhc.net/wp-content/uploads/2010/07/LPVfinal1-1024x573.jpg" alt="" width="640" height="358" /></a><p class="wp-caption-text">Sponza scene (only indirect lighting w/ occlusion)</p></div>
<div id="attachment_800" class="wp-caption alignnone" style="width: 650px"><a href="http://blog.blackhc.net/wp-content/uploads/2010/07/LPVfinal2.jpg"><img class="size-large wp-image-800" title="LPVfinal2" src="http://blog.blackhc.net/wp-content/uploads/2010/07/LPVfinal2-1024x573.jpg" alt="" width="640" height="358" /></a><p class="wp-caption-text">Sponza scene (ony direct lighting)</p></div>
<div id="attachment_801" class="wp-caption alignnone" style="width: 650px"><a href="http://blog.blackhc.net/wp-content/uploads/2010/07/LPVfinal3.jpg"><img class="size-large wp-image-801" title="LPVfinal3" src="http://blog.blackhc.net/wp-content/uploads/2010/07/LPVfinal3-1024x573.jpg" alt="" width="640" height="358" /></a><p class="wp-caption-text">Sponza scene (boosted indirect lighting w/ occlusion)</p></div>
<div id="attachment_802" class="wp-caption alignnone" style="width: 650px"><a href="http://blog.blackhc.net/wp-content/uploads/2010/07/LPVfinal4.jpg"><img class="size-large wp-image-802" title="LPVfinal4" src="http://blog.blackhc.net/wp-content/uploads/2010/07/LPVfinal4-1024x573.jpg" alt="" width="640" height="358" /></a><p class="wp-caption-text">Sponza scene (boosted indirect lighting w/o occlusion)</p></div>
<p>The algorithm approximates global illumination by rendering the light into a <a href="http://www.vis.uni-stuttgart.de/dachsbacher/download/rsm.pdf" target="_blank">reflective shadow map</a>, injecting it into a volume (using a spherical harmonics representation) and propagates the light flux in this volume (hence the name of the algorithm) and taking into account occlusion as possible extension.</p>
<p>The whole algorithm is physically motivated but corners everywhere, of course, to be more efficient. The paper also contains a few errors and doesn&#8217;t explain everything needed to implement it in great detail (like eg the solid angles of the side faces), so I&#8217;ve written two documents detailing the mistakes I&#8217;ve found and the additional calculations I&#8217;ve performed.</p>
<p>You can find the mistakes <a href="http://blog.blackhc.net/wp-content/uploads/2010/07/lpv-corrections.pdf" target="_blank">here</a> (including suggested corrections) and the full annotations document <a href="http://blog.blackhc.net/wp-content/uploads/2010/07/lpv-annotations.pdf" target="_blank">here</a>.</p>
<p>Finally I&#8217;ve also uploaded the whole prototype (including my code licensed under the FreeBSD license and the media files) <a href="http://blog.blackhc.net/wp-content/uploads/2010/07/LPVPrototype.zip" target="_blank">here</a> &#8211; it&#8217;s 68 MB big (and it&#8217;s been compressed with 7zip with a compression mode that might not be supported by WinZIP. The Sponza model is from Crytek, too. You can download the original model and textures <a href="http://www.crytek.com/downloads/technology/" target="_blank">here</a>.<br />
The project uses DirectX 10.1 and by default it won&#8217;t run in DirectX 10, because it uses a texture format that is deprecated in D3D10 but supported again 10.1 (BGRA). See the comment by <strong>FatGarfield</strong> for the location that needs to be changed for it work in DX10, too. (However red and blue will be swapped then.)</p>
<p>I haven&#8217;t implemented cascaded LPVs and I also use only one light/RSM and only inject its depth into the occlusion volume, but the results already look very nice in my opinion.</p>
<p>Stay tuned for more <img src='http://blog.blackhc.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Cheers,<br />
Andreas</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blackhc.net/2010/07/light-propagation-volumes/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Panorama Stitching</title>
		<link>http://blog.blackhc.net/2010/07/panorama-stitching/</link>
		<comments>http://blog.blackhc.net/2010/07/panorama-stitching/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 11:00:04 +0000</pubDate>
		<dc:creator>BlackHC</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Personal Rantings]]></category>
		<category><![CDATA[University]]></category>

		<guid isPermaLink="false">http://blog.blackhc.net/?p=783</guid>
		<description><![CDATA[I&#8217;ve finally come around to &#8220;clean-up&#8221; some old project I&#8217;ve had lying around for a few months and upload it. I&#8217;m talking about some Panorama Stitching code I wrote for our participation in Microsoft&#8217;s Imagine Cup. I&#8217;m suppressing all memories &#8230; <a href="http://blog.blackhc.net/2010/07/panorama-stitching/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally come around to &#8220;clean-up&#8221; some old project I&#8217;ve had lying around for a few months and upload it.<br />
I&#8217;m talking about some Panorama Stitching code I wrote for our participation in Microsoft&#8217;s Imagine Cup.<br />
I&#8217;m suppressing all memories of it since it was an epic fail, but at least I still have learnt quite a bit about computer vision and image processing &#8211; enough to know that it&#8217;s incredibly hard to come up with stable algorithms and kudos to anyone working in the field.</p>
<p>Here is the code dump: <a href="http://blog.blackhc.net/wp-content/uploads/2010/07/PanoramaStitching.zip">PanoramaStitching.zip</a></p>
<p>It contains many small projects which usually use multiple pictures as inputs or multiple webcams (depending on code or chosen preprocessor macros).</p>
<p>The most advanced prototype is the SnapshotHomographyConfigurator, which allows you to determine homographies between multiple cameras at once by marking shared points between the images.</p>
<p>Another one which works okay is the PanoramaStitching project. It creates panoramas using spherical or cylindircal projections of the input images. However, it is very sensitive to translations of the viewpoint. It works quite well with optimal/artificial images:</p>
<p><a href="http://blog.blackhc.net/wp-content/uploads/2010/07/shotA.png"><img class="alignnone size-medium wp-image-788" title="Panorama Stitching shotA" src="http://blog.blackhc.net/wp-content/uploads/2010/07/shotA-300x225.png" alt="" width="300" height="225" /></a><a href="http://blog.blackhc.net/wp-content/uploads/2010/07/shotB.png"><img class="alignnone size-medium wp-image-789" title="Panorama Stitching shotB" src="http://blog.blackhc.net/wp-content/uploads/2010/07/shotB-300x225.png" alt="" width="300" height="225" /></a></p>
<p><a href="http://blog.blackhc.net/wp-content/uploads/2010/07/live.jpg"><img class="alignnone size-full wp-image-787" title="Panorama Stitching Panorama" src="http://blog.blackhc.net/wp-content/uploads/2010/07/live.jpg" alt="" width="797" height="480" /></a></p>
<p>(Note: the small misalignment on the right stems from moving the player position slightly. Usually you use a deghosting algorithm to remove such misalignments.)</p>
<p>I&#8217;ve used <a href="http://opencv.willowgarage.com/wiki/" target="_blank">OpenCV</a> for image processing and <a href="http://www.yaml.org/" target="_blank">yaml</a> for loading and storing settings (and also <a href="http://rapidxml.sourceforge.net/" target="_blank">rapidxml</a>). OpenCV&#8217;s C++ wrapper is pretty awesome. It&#8217;s not perfect but it makes life a lot easier.</p>
<p>Stay tuned for more code/project uploads soon <img src='http://blog.blackhc.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>PS: Here are the links to some papers which proved useful to me (I didn&#8217;t implement most of them though, and some are implemented in OpenCV already):</p>
<ul>
<li><a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.91.5822" target="_blank">Eliminating Ghosting and Exposure Artifacts in Image Mosaics</a></li>
<li><a href="http://robots.stanford.edu/cs223b04/algo_tracking.pdf" target="_blank">Pyramidal Implementation of the Lucas Kanade Feature Tracker &#8211; Description of the algorithm</a></li>
<li><a href="http://research.microsoft.com/apps/pubs/default.aspx?id=70092" target="_blank">Image Alignment and Stitching: A Tutorial</a></li>
<li><a href="http://www.google.de/url?sa=t&amp;source=web&amp;cd=1&amp;ved=0CBYQFjAA&amp;url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.96.3162%26rep%3Drep1%26type%3Dpdf&amp;ei=JQVDTNSNOeOJOIzamIYN&amp;usg=AFQjCNHmesBhRUp-0hpn6mxYjZwymax2Cw&amp;sig2=26VpkBOuLIZ2tW1V0VxPCQ" target="_blank">Seamless Image Stitching by Minimizing False Edges</a></li>
<li><a href="http://research.microsoft.com/pubs/75614/ShumSzeliski-IJCV00.pdf" target="_blank">Construction of Panoramic Image Mosaics with Global and Local Alignment</a></li>
<li><a href="Image Mosaicing for Tele-Reality Applications" target="_blank">Image Mosaicing for Tele-Reality Applications</a></li>
<li><a href="http://faculty.cs.tamu.edu/jchai/CPSC641/shi_tomasi_94.pdf" target="_blank">Good Features to Track</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.blackhc.net/2010/07/panorama-stitching/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rotation of Low Order Spherical Harmonics</title>
		<link>http://blog.blackhc.net/2010/06/rotation-of-low-order-spherical-harmonics/</link>
		<comments>http://blog.blackhc.net/2010/06/rotation-of-low-order-spherical-harmonics/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 23:10:05 +0000</pubDate>
		<dc:creator>BlackHC</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Maths]]></category>
		<category><![CDATA[Crytek]]></category>
		<category><![CDATA[Light Propagation Volume]]></category>
		<category><![CDATA[Rotation]]></category>
		<category><![CDATA[Spherical Harmonics]]></category>

		<guid isPermaLink="false">http://blog.blackhc.net/?p=740</guid>
		<description><![CDATA[I&#8217;m currently working at university on implementing Light Propagation Volumes. The paper makes extensive use of spherical harmonics while the implementation uses the first two bands. Below is a visualization of the first 4 bands of the SH basis functions &#8230; <a href="http://blog.blackhc.net/2010/06/rotation-of-low-order-spherical-harmonics/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently working at university on implementing <a href="http://www.crytek.com/technology/presentations/" target="_blank">Light Propagation Volumes</a>. The paper makes extensive use of <a href="http://en.wikipedia.org/wiki/Spherical_harmonics" target="_blank">spherical harmonics</a> while the implementation uses the first two bands.</p>
<p>Below is a visualization of the first 4 bands of the SH basis functions (created using <a href="http://code.enthought.com/projects/mayavi/" target="_blank">Mayavi</a>):</p>
<div id="attachment_742" class="wp-caption aligncenter" style="width: 629px"><a href="http://blog.blackhc.net/wp-content/uploads/2010/06/sh0to3.jpg"><img class="size-full wp-image-742" title="sh0to3" src="http://blog.blackhc.net/wp-content/uploads/2010/06/sh0to3.jpg" alt="sh0to3" width="619" height="283" /></a><p class="wp-caption-text">The first 4 bands of the spherical harmonic basis functions</p></div>
<p>As you can see the first two bands are 4 functions, so 4 coefficients to store which conveniently fits into one RGBA texture.</p>
<p>One of the main transformations that is performed in the LPV paper is the rotation of the spherical harmonics representation of a clamped cosine lobe (that represents surface lighting) onto a normal vector direction.  It took me a while to figure out, but actually it&#8217;s quite easy, which is why I write about it <img src='http://blog.blackhc.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The analytical presentation of the first four base functions is simple:</p>
<p style="text-align: left;"><img src="http://blog.blackhc.net/wp-content/cache/tex_706d2523bb7365dae8ac1eaa44f1734d.png" class="tex" alt="S_0 \left( x, y, z \right ) = \frac{1}{2 \sqrt{\pi}}" title="S_0 \left( x, y, z \right ) = \frac{1}{2 \sqrt{\pi}}" align="absmiddle" /><br />
<img src="http://blog.blackhc.net/wp-content/cache/tex_2a90a081c65c08627081aff156902440.png" class="tex" alt="S_1 \left( x, y, z \right ) = - \frac{\sqrt{3}}{2 \sqrt{\pi}} y" title="S_1 \left( x, y, z \right ) = - \frac{\sqrt{3}}{2 \sqrt{\pi}} y" align="absmiddle" /><br />
<img src="http://blog.blackhc.net/wp-content/cache/tex_f71c3646eaced6589b903fbc55202646.png" class="tex" alt="S_2 \left( x, y, z \right ) = \frac{\sqrt{3}}{2 \sqrt{\pi}} z " title="S_2 \left( x, y, z \right ) = \frac{\sqrt{3}}{2 \sqrt{\pi}} z " align="absmiddle" /><br />
<img src="http://blog.blackhc.net/wp-content/cache/tex_e62b566d079a3237f32e3e6a600d53f6.png" class="tex" alt="S_3 \left( x, y, z \right ) = - \frac{\sqrt{3}}{2 \sqrt{\pi}} x" title="S_3 \left( x, y, z \right ) = - \frac{\sqrt{3}}{2 \sqrt{\pi}} x" align="absmiddle" /></p>
<p style="text-align: left;">To evaluate lighting with SH for some direction v, you first determine the coefficients/weights of the SH basis functions and then sum them up.</p>
<p style="text-align: left;"><img src="http://blog.blackhc.net/wp-content/cache/tex_62efdb3cfc8367587aaa24daa5e54c20.png" class="tex" alt=" L = \sum_i s_i \, S_i \left( v \right ) " title=" L = \sum_i s_i \, S_i \left( v \right ) " align="absmiddle" /></p>
<p style="text-align: left;">Let&#8217;s assume we know the coefficients <img src="http://blog.blackhc.net/wp-content/cache/tex_1576a652d84c1978430a8247c5db798d.png" class="tex" alt=" s^z_0, s^z_1, ... " title=" s^z_0, s^z_1, ... " align="absmiddle" /> of the clamped cosine lobe around the z axis, then we can determine the lighting in direction v for the cosine lobe around the normal n by transforming it into the space where the normal coincides with the z axis (ie rotate n onto the z axis):</p>
<p style="text-align: left;"><img src="http://blog.blackhc.net/wp-content/cache/tex_a9d43578de309ca75a1ef416e635cb8e.png" class="tex" alt=" L = \sum_i s^z_i \, S_i \left( R_{n \to z} \, v \right ) " title=" L = \sum_i s^z_i \, S_i \left( R_{n \to z} \, v \right ) " align="absmiddle" /></p>
<p style="text-align: left;">where <img src="http://blog.blackhc.net/wp-content/cache/tex_72c05df713d9d70bd2c19005825c4654.png" class="tex" alt=" R_{n \to z} " title=" R_{n \to z} " align="absmiddle" /> is a rotation matrix that rotates n onto z.</p>
<p style="text-align: left;">The idea is to expand <img src="http://blog.blackhc.net/wp-content/cache/tex_9b51b7bfc7626af61c73fba376411b92.png" class="tex" alt=" S_i \left( R_{n \to z} \, v \right ) " title=" S_i \left( R_{n \to z} \, v \right ) " align="absmiddle" /> and rewrite it in terms of <img src="http://blog.blackhc.net/wp-content/cache/tex_9dca7e9f9901d704dbe0a9a640b1b9ef.png" class="tex" alt=" S_i \left ( v \right ) " title=" S_i \left ( v \right ) " align="absmiddle" />.</p>
<p style="text-align: left;">Before doing this, let&#8217;s first take a look at the coefficients of the clamped cosine lobe:</p>
<p style="text-align: left;"><img src="http://blog.blackhc.net/wp-content/cache/tex_d0a30d506fd071e950de9020a3682e3a.png" class="tex" alt="\begin{align*}<br />
s^z_0 &amp;=\frac{ \sqrt{ \pi } }{ 2 }<br />
s^z_1 &amp;= 0<br />
s^z_2 &amp;= \sqrt\frac{ \pi }{3}<br />
s^z_3 &amp;= 0<br />
\end{align*}" title="\begin{align*}<br />
s^z_0 &amp;=\frac{ \sqrt{ \pi } }{ 2 }<br />
s^z_1 &amp;= 0<br />
s^z_2 &amp;= \sqrt\frac{ \pi }{3}<br />
s^z_3 &amp;= 0<br />
\end{align*}" align="absmiddle" /></p>
<p style="text-align: left;">The y and x direction are 0 because the cosine lobe is centered isotropic around the z axis:</p>
<p style="text-align: left;">So let&#8217;s look at the expanded version of this formula if <img src="http://blog.blackhc.net/wp-content/cache/tex_21d8857e73e37ea774391e045332b63b.png" class="tex" alt=" r_1^T " title=" r_1^T " align="absmiddle" />, <img src="http://blog.blackhc.net/wp-content/cache/tex_34bef2d01462b580813b1c032d44a5f0.png" class="tex" alt=" r_2^T " title=" r_2^T " align="absmiddle" />, <img src="http://blog.blackhc.net/wp-content/cache/tex_498bc755e068ea1e03c36b7fd60344bf.png" class="tex" alt=" r_3^T " title=" r_3^T " align="absmiddle" /> are the row vectors of the matrix,<br />
<img src="http://blog.blackhc.net/wp-content/cache/tex_4583ab901f451d50856a4a981a165831.png" class="tex" alt=" v=\bigl(\begin{smallmatrix}<br />
x\\<br />
y\\<br />
z<br />
\end{smallmatrix}\bigr)" title=" v=\bigl(\begin{smallmatrix}<br />
x\\<br />
y\\<br />
z<br />
\end{smallmatrix}\bigr)" align="absmiddle" /> and <img src="http://blog.blackhc.net/wp-content/cache/tex_901880b2e0e491395415af47612607db.png" class="tex" alt=" R_{n \to z}=\left(\begin{smallmatrix}<br />
r_1^T\\<br />
r_2^T\\<br />
r_3^T<br />
\end{smallmatrix}\right ) " title=" R_{n \to z}=\left(\begin{smallmatrix}<br />
r_1^T\\<br />
r_2^T\\<br />
r_3^T<br />
\end{smallmatrix}\right ) " align="absmiddle" />, then:</p>
<p style="text-align: left;"><img src="http://blog.blackhc.net/wp-content/cache/tex_fbcdef97093c88c3b7ea82fff66bca39.png" class="tex" alt=" L = \sum_i s^z_i \, S_i \left( R_{n \to z} \, v \right ) = \sum_i s^z_i \, S_i \left( \left(\begin{smallmatrix}<br />
r_1^T \, v\\<br />
r_2^T \, v\\<br />
r_3^T \, v\end{smallmatrix}\right ) \right ) " title=" L = \sum_i s^z_i \, S_i \left( R_{n \to z} \, v \right ) = \sum_i s^z_i \, S_i \left( \left(\begin{smallmatrix}<br />
r_1^T \, v\\<br />
r_2^T \, v\\<br />
r_3^T \, v\end{smallmatrix}\right ) \right ) " align="absmiddle" /><br />
<img src="http://blog.blackhc.net/wp-content/cache/tex_7e039101c8e64ccaa0d41c9238db1a7e.png" class="tex" alt="\begin{align*} L &amp;= s^z_0 \, c_0\\<br />
&amp;+ s^z_1 \, (-c_1) \, r_2^T \, v \\<br />
&amp;+ s^z_2 \, c_1 \, r_3^T \, v\\<br />
&amp;+ s^z_3 \, (-c_1) \, r_1^T \, v<br />
\end{align*} " title="\begin{align*} L &amp;= s^z_0 \, c_0\\<br />
&amp;+ s^z_1 \, (-c_1) \, r_2^T \, v \\<br />
&amp;+ s^z_2 \, c_1 \, r_3^T \, v\\<br />
&amp;+ s^z_3 \, (-c_1) \, r_1^T \, v<br />
\end{align*} " align="absmiddle" /></p>
<p style="text-align: left;">Since <img src="http://blog.blackhc.net/wp-content/cache/tex_10080ca9d8790e9e105fe19a8207da6a.png" class="tex" alt=" s^z_1 = 0 " title=" s^z_1 = 0 " align="absmiddle" /> and <img src="http://blog.blackhc.net/wp-content/cache/tex_dfd368e9d908cd15e20b6b5c0f16ee95.png" class="tex" alt=" s^z_3 = 0 " title=" s^z_3 = 0 " align="absmiddle" />:</p>
<p style="text-align: left;"><img src="http://blog.blackhc.net/wp-content/cache/tex_db640f1bac2ea6839ae440f962a7d6e3.png" class="tex" alt=" L = s^z_0 \, c_0 + s^z_2 \, c_1 \, r_3^T \, v = s^z_0 \, c_0 + s^z_2 \, c_1 \, r_{31} \, x + s^z_2 \, c_1 \, r_{32} \, y + s^z_2 \, c_1 \, r_{33} \, z " title=" L = s^z_0 \, c_0 + s^z_2 \, c_1 \, r_3^T \, v = s^z_0 \, c_0 + s^z_2 \, c_1 \, r_{31} \, x + s^z_2 \, c_1 \, r_{32} \, y + s^z_2 \, c_1 \, r_{33} \, z " align="absmiddle" /></p>
<p style="text-align: left;"><img src="http://blog.blackhc.net/wp-content/cache/tex_d15e0f20255d1a7e36b4ef82f507bd97.png" class="tex" alt="  L = s^z_0 \, S_0 \left ( v \right ) - s^z_2 \, r_{32} \, S_1 \left ( v \right )+ s^z_2 \, r_{33} \, S_2 \left ( v \right ) - s^z_2 \, r_{31} \, S_3 \left ( v \right ) " title="  L = s^z_0 \, S_0 \left ( v \right ) - s^z_2 \, r_{32} \, S_1 \left ( v \right )+ s^z_2 \, r_{33} \, S_2 \left ( v \right ) - s^z_2 \, r_{31} \, S_3 \left ( v \right ) " align="absmiddle" /></p>
<p style="text-align: left;">Now the question is: what is the third row of <img src="http://blog.blackhc.net/wp-content/cache/tex_72c05df713d9d70bd2c19005825c4654.png" class="tex" alt=" R_{n \to z} " title=" R_{n \to z} " align="absmiddle" />? If we look at the inverse matrix instead: <img src="http://blog.blackhc.net/wp-content/cache/tex_6888161c8e42f0612159bf67a6ec5d1f.png" class="tex" alt=" R_{z \to n} " title=" R_{z \to n} " align="absmiddle" />, we can immediately see that its third column has to be n, because <img src="http://blog.blackhc.net/wp-content/cache/tex_259796b5da66c3e792a6091a40d1209e.png" class="tex" alt=" R_{n \to z} \, \bigl(\begin{smallmatrix}<br />
0\\<br />
0\\<br />
1<br />
\end{smallmatrix}\bigr) = n " title=" R_{n \to z} \, \bigl(\begin{smallmatrix}<br />
0\\<br />
0\\<br />
1<br />
\end{smallmatrix}\bigr) = n " align="absmiddle" /> by construction. Since rotations are orthogonal matrices, the inverse is the same as the transposed, so we can deduce that the third row of <img src="http://blog.blackhc.net/wp-content/cache/tex_72c05df713d9d70bd2c19005825c4654.png" class="tex" alt=" R_{n \to z} " title=" R_{n \to z} " align="absmiddle" /> is the same as the third column of <img src="http://blog.blackhc.net/wp-content/cache/tex_6888161c8e42f0612159bf67a6ec5d1f.png" class="tex" alt=" R_{z \to n} " title=" R_{z \to n} " align="absmiddle" />,  that is: n. Thus with <img src="http://blog.blackhc.net/wp-content/cache/tex_6a99ace36b4a4fc64870cc780adac7e5.png" class="tex" alt=" n = \bigl(\begin{smallmatrix}<br />
n_x\\<br />
n_y\\<br />
n_z<br />
\end{smallmatrix}\bigr) " title=" n = \bigl(\begin{smallmatrix}<br />
n_x\\<br />
n_y\\<br />
n_z<br />
\end{smallmatrix}\bigr) " align="absmiddle" /> we get:</p>
<p style="text-align: left;"><img src="http://blog.blackhc.net/wp-content/cache/tex_2540af4a2b20386cc6a543882c27434b.png" class="tex" alt="  L = s^z_0 \, S_0 \left ( v \right ) - s^z_2 \, n_y \, S_1 \left (  v \right )+ s^z_2 \, n_z \, S_2 \left ( v \right ) - s^z_2 \, n_x  \, S_3 \left ( v \right ) " title="  L = s^z_0 \, S_0 \left ( v \right ) - s^z_2 \, n_y \, S_1 \left (  v \right )+ s^z_2 \, n_z \, S_2 \left ( v \right ) - s^z_2 \, n_x  \, S_3 \left ( v \right ) " align="absmiddle" /></p>
<p style="text-align: left;">So the SH coefficients of the clamped cosine lobe along n are:</p>
<p style="text-align: left;"><img src="http://blog.blackhc.net/wp-content/cache/tex_ca9023bfa87b1ef326758d6dd4c594d1.png" class="tex" alt="<br />
s^n_0 = s^z_0 = \frac{ \sqrt{ \pi } }{ 2 } \\<br />
s^n_1 = - s^z_2 \, n_y =  -\sqrt{ \frac{ \pi }{3} } \, n_y \\<br />
s^n_2 = s^z_2 \, n_z = \sqrt{\frac{ \pi }{3} } \, n_z \\<br />
s^n_1 = - s^z_2 \, n_x = - \sqrt{\frac{ \pi }{3}} \, n_x<br />
" title="<br />
s^n_0 = s^z_0 = \frac{ \sqrt{ \pi } }{ 2 } \\<br />
s^n_1 = - s^z_2 \, n_y =  -\sqrt{ \frac{ \pi }{3} } \, n_y \\<br />
s^n_2 = s^z_2 \, n_z = \sqrt{\frac{ \pi }{3} } \, n_z \\<br />
s^n_1 = - s^z_2 \, n_x = - \sqrt{\frac{ \pi }{3}} \, n_x<br />
" align="absmiddle" />
</p>
<p style="text-align: left;">This is it <img src='http://blog.blackhc.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p style="text-align: left;">Cheers,<br />
Andreas</p>
<p style="text-align: left;">PS: a few screenshots from the LPV project:</p>
<p style="text-align: left;"><a href="http://blog.blackhc.net/wp-content/uploads/2010/06/GPUPropCopy-0616.jpeg"><img class="size-medium wp-image-770 alignnone" title="GPUPropCopy 0616" src="http://blog.blackhc.net/wp-content/uploads/2010/06/GPUPropCopy-0616-300x236.jpg" alt="GPUPropCopy 0616" width="300" height="236" /></a><a href="http://blog.blackhc.net/wp-content/uploads/2010/06/noLPV.JPG"><br />
<img class="size-medium wp-image-773 alignnone" title="noLPV" src="http://blog.blackhc.net/wp-content/uploads/2010/06/noLPV-300x210.jpg" alt="noLPV" width="300" height="210" /></a><a href="http://blog.blackhc.net/wp-content/uploads/2010/06/LPV32P128C.JPG"><img class="alignnone size-medium wp-image-771" title="LPV32P128C" src="http://blog.blackhc.net/wp-content/uploads/2010/06/LPV32P128C-300x210.jpg" alt="LPV32P128C" width="300" height="210" /></a></p>
<p style="text-align: left;"><a href="http://blog.blackhc.net/wp-content/uploads/2010/06/noLPV_2.JPG"><img class="alignnone size-medium wp-image-774" title="noLPV_2" src="http://blog.blackhc.net/wp-content/uploads/2010/06/noLPV_2-300x210.jpg" alt="noLPV_2" width="300" height="210" /></a><a href="http://blog.blackhc.net/wp-content/uploads/2010/06/LPV32P128C_2.JPG"><img class="alignnone size-medium wp-image-772" title="LPV32P128C_2" src="http://blog.blackhc.net/wp-content/uploads/2010/06/LPV32P128C_2-300x210.jpg" alt="LPV32P128C_2" width="300" height="210" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blackhc.net/2010/06/rotation-of-low-order-spherical-harmonics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rigid Body Motion</title>
		<link>http://blog.blackhc.net/2010/05/rigid-body-motion/</link>
		<comments>http://blog.blackhc.net/2010/05/rigid-body-motion/#comments</comments>
		<pubDate>Sun, 30 May 2010 15:10:11 +0000</pubDate>
		<dc:creator>BlackHC</dc:creator>
				<category><![CDATA[Maths]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[rigid body]]></category>
		<category><![CDATA[rigid body physics]]></category>

		<guid isPermaLink="false">http://blog.blackhc.net/?p=729</guid>
		<description><![CDATA[Last week I had to give a presentation about Rigid Body Motion (ie the basics of rigid body physics and some general mechanics). Here are two versions of my presentatio (one with less text and one with more): Rigid Body &#8230; <a href="http://blog.blackhc.net/2010/05/rigid-body-motion/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last week I had to give a presentation about Rigid Body Motion (ie the basics of rigid body physics and some general mechanics).</p>
<p>Here are two versions of my presentatio (one with less text and one with more):</p>
<p><a href="http://blog.blackhc.net/wp-content/uploads/2010/05/Rigid-Body-Motion-Presentation.pptx">Rigid Body Motion Presentation as PPTX</a>; <a href="http://blog.blackhc.net/wp-content/uploads/2010/05/Rigid-Body-Motion-Presentation.pdf">Rigid Body Motion Presentation as PDF<br />
</a><a href="http://blog.blackhc.net/wp-content/uploads/2010/05/Rigid-Body-Motion-Full-Version.pptm">Rigid Body Motion Full Version as PPTM</a>; <a href="http://blog.blackhc.net/wp-content/uploads/2010/05/Rigid-Body-Motion-Full-Version.pdf">Rigid Body Motion Full Version as PDF</a></p>
<p>If you are truly interested in learning about rigid body physics, here are some books/links:</p>
<ul>
<li> “Technische Mechanik 1 &amp; 3” by Gross, Hauger, Schröder &amp; Wall</li>
<li> <a href="http://www.pixar.com/companyinfo/research/pbm2001/" target="_blank">“Physically Based Modeling” by Pixar (SIGGRAPH 2001)</a></li>
<li> “Mathematics for 3D Game Programming &amp; Computer Graphics” by Eric Lengyel</li>
<li> “Physics for Game Developers” by David M. Bourg</li>
<li> “Game Physics” by David H. Eberly</li>
<li><a href="http://chrishecker.com/Rigid_Body_Dynamics" target="_blank">Chris Hecker&#8217;s Rigid Body Physics page</a></li>
</ul>
<p>Cheers,<br />
Andreas</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blackhc.net/2010/05/rigid-body-motion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PowerPoint LaTeX</title>
		<link>http://blog.blackhc.net/2010/05/powerpoint-latex/</link>
		<comments>http://blog.blackhc.net/2010/05/powerpoint-latex/#comments</comments>
		<pubDate>Sun, 30 May 2010 09:58:04 +0000</pubDate>
		<dc:creator>BlackHC</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Google Code]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[MiKTeX]]></category>
		<category><![CDATA[PowerPoint]]></category>
		<category><![CDATA[PowerPoint LaTeX]]></category>

		<guid isPermaLink="false">http://blog.blackhc.net/2010/05/powerpoint-latex/</guid>
		<description><![CDATA[Hey everybody I only wanted to point out that I&#8217;ve uploaded a new and improved version of PowerPoint LaTeX at http://code.google.com/p/powerpointtools/ &#8211; it now supports MiKTeX \o/ I&#8217;ve also finally added a project page for it to this blog. More &#8230; <a href="http://blog.blackhc.net/2010/05/powerpoint-latex/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hey everybody <img src='http://blog.blackhc.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
I only wanted to point out that I&#8217;ve uploaded a new and improved version of PowerPoint LaTeX at <a href="http://code.google.com/p/powerpointtools/">http://code.google.com/p/powerpointtools/</a> &#8211; it now supports MiKTeX \o/</p>
<p>I&#8217;ve also finally added a project page for it to this blog.<br />
More updates might follow soon if I find enough spare time <img src='http://blog.blackhc.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Cheers,<br />
 Andreas</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blackhc.net/2010/05/powerpoint-latex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A quick note on quantifiers: For almost all and there exist infinitely many</title>
		<link>http://blog.blackhc.net/2010/03/a-quick-note-on-quantifiers-for-almost-all-and-there-exist-infinitely-many/</link>
		<comments>http://blog.blackhc.net/2010/03/a-quick-note-on-quantifiers-for-almost-all-and-there-exist-infinitely-many/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 14:55:00 +0000</pubDate>
		<dc:creator>BlackHC</dc:creator>
				<category><![CDATA[Maths]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[Exists]]></category>
		<category><![CDATA[For All]]></category>
		<category><![CDATA[For Almost All]]></category>
		<category><![CDATA[Quantifiers]]></category>

		<guid isPermaLink="false">http://blog.blackhc.net/?p=712</guid>
		<description><![CDATA[It&#8217;s been a while since my last post and now it&#8217;s time for a mathematical post: I&#8217;m currently preparing for a math exam (calculus) and I&#8217;m thinking it would be nice if there was a way to avoid much of &#8230; <a href="http://blog.blackhc.net/2010/03/a-quick-note-on-quantifiers-for-almost-all-and-there-exist-infinitely-many/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since my last post and now it&#8217;s time for a mathematical post:</p>
<p>I&#8217;m currently preparing for a math exam (calculus) and I&#8217;m thinking it would be nice if there was a way to avoid much of the &#8220;for every <img src="http://blog.blackhc.net/wp-content/cache/tex_48cd3d9bc60a933438e6e151fcabafdf.png" class="tex" alt="\epsilon &gt; 0" title="\epsilon &gt; 0" align="absmiddle" /> there is an <img src="http://blog.blackhc.net/wp-content/cache/tex_c42a0e6c42f40626fb62587caa77429f.png" class="tex" alt="N \in \mathbb{N}" title="N \in \mathbb{N}" align="absmiddle" />, so that for all <img src="http://blog.blackhc.net/wp-content/cache/tex_bb453b8f91c47deeaf9bd5d7849872ec.png" class="tex" alt="n \ge N" title="n \ge N" align="absmiddle" /> some property &#8230; holds&#8221; stuff you find in textbooks. Some textbooks actually shorten it to &#8220;for every <img src="http://blog.blackhc.net/wp-content/cache/tex_48cd3d9bc60a933438e6e151fcabafdf.png" class="tex" alt="\epsilon &gt; 0" title="\epsilon &gt; 0" align="absmiddle" /> some property &#8230; holds for almost all <img src="http://blog.blackhc.net/wp-content/cache/tex_7b8b965ad4bca0e41ab51de7b31363a1.png" class="tex" alt="n" title="n" align="absmiddle" />&#8220;.<br />
However, I haven&#8217;t found a quantifier to express this anywhere yet, so I&#8217;m proposing to introduce a new one:</p>
<p><img src="http://blog.blackhc.net/wp-content/cache/tex_e3e9535b6be5e98db02a53b15c62f58a.png" class="tex" alt="\tilde{\forall} x \in M: P(x)" title="\tilde{\forall} x \in M: P(x)" align="absmiddle" /> should mean &#8220;for almost all <img src="http://blog.blackhc.net/wp-content/cache/tex_50f459b5ecb20bc2bdb8fefcef483b46.png" class="tex" alt="x \in M" title="x \in M" align="absmiddle" /> <img src="http://blog.blackhc.net/wp-content/cache/tex_c19f6b6a7bae1fd5b14f578c6edc3454.png" class="tex" alt="P(x)" title="P(x)" align="absmiddle" /> holds&#8221;, which suggests that there are only finitely many elements for which it does not hold.<br />
One can formalize this as:<br />
<img src="http://blog.blackhc.net/wp-content/cache/tex_bf28bf4fed82cc8f93b2eab6210c01f5.png" class="tex" alt="\tilde{\forall} x \in M: P(x) \equiv \exists n \in \mathbb{N}: \left | \left \{ x \in M \mid \neg P(x) \right \} \right | \le n " title="\tilde{\forall} x \in M: P(x) \equiv \exists n \in \mathbb{N}: \left | \left \{ x \in M \mid \neg P(x) \right \} \right | \le n " align="absmiddle" /> </p>
<p>Of course, a new existential quantifier is required then, too (for negation):<br />
<img src="http://blog.blackhc.net/wp-content/cache/tex_e54870464fe6cde68b61d27cef01da21.png" class="tex" alt="\tilde{\exists} x \in M: P(x)" title="\tilde{\exists} x \in M: P(x)" align="absmiddle" /> stands for &#8220;there exist infinitely many <img src="http://blog.blackhc.net/wp-content/cache/tex_50f459b5ecb20bc2bdb8fefcef483b46.png" class="tex" alt="x \in M" title="x \in M" align="absmiddle" />, for which <img src="http://blog.blackhc.net/wp-content/cache/tex_c19f6b6a7bae1fd5b14f578c6edc3454.png" class="tex" alt="P(x)" title="P(x)" align="absmiddle" /> holds&#8221;.<br />
And this can be formalized as:<br />
<img src="http://blog.blackhc.net/wp-content/cache/tex_9e0c734b4ab524a714517427dbbd828e.png" class="tex" alt="\tilde{\exists} x \in M: P(x) \equiv \forall n \in \mathbb{N}: \left | \left \{ x \in M \mid P(x) \right \} \right | &gt; n " title="\tilde{\exists} x \in M: P(x) \equiv \forall n \in \mathbb{N}: \left | \left \{ x \in M \mid P(x) \right \} \right | &gt; n " align="absmiddle" /></p>
<p>It&#8217;s easy to see that <img src="http://blog.blackhc.net/wp-content/cache/tex_1fdd16569e37aaf00fc1921d617617fe.png" class="tex" alt="\neg \left ( \tilde{\forall} x \in M: P(x) \right ) \equiv \tilde{\exists} x \in M: \neg P(x) " title="\neg \left ( \tilde{\forall} x \in M: P(x) \right ) \equiv \tilde{\exists} x \in M: \neg P(x) " align="absmiddle" /></p>
<p>Thus one can use the two quantifiers just as one would use <img src="http://blog.blackhc.net/wp-content/cache/tex_8b141f94d4371ad99206ca92a896986d.png" class="tex" alt="\forall" title="\forall" align="absmiddle" /> and <img src="http://blog.blackhc.net/wp-content/cache/tex_32ff223f4b9214ce44a3f7cac5abe8bf.png" class="tex" alt="\exists" title="\exists" align="absmiddle" /> usually. Note however than <img src="http://blog.blackhc.net/wp-content/cache/tex_8b141f94d4371ad99206ca92a896986d.png" class="tex" alt="\forall" title="\forall" align="absmiddle" /> and <img src="http://blog.blackhc.net/wp-content/cache/tex_c4513a0476f5fcb3cf3544dfcc8f2bcd.png" class="tex" alt="\tilde{\forall}" title="\tilde{\forall}" align="absmiddle" /> don&#8217;t interchange and neither do  <img src="http://blog.blackhc.net/wp-content/cache/tex_32ff223f4b9214ce44a3f7cac5abe8bf.png" class="tex" alt="\exists" title="\exists" align="absmiddle" /> and <img src="http://blog.blackhc.net/wp-content/cache/tex_e8bba45759530463d99840a9e2c41410.png" class="tex" alt="\tilde{\exists}" title="\tilde{\exists}" align="absmiddle" />.</p>
<p>One last note: it might be worth using a different notation, for example: <img src="http://blog.blackhc.net/wp-content/cache/tex_209a97792dc00e30ae0a859394f13808.png" class="tex" alt="\exists ^ \infty" title="\exists ^ \infty" align="absmiddle" /> might be easier to understand than <img src="http://blog.blackhc.net/wp-content/cache/tex_c6d62924951d67e36e51e9fe9c40262b.png" class="tex" alt=" \tilde{\exists} " title=" \tilde{\exists} " align="absmiddle" />, and <img src="http://blog.blackhc.net/wp-content/cache/tex_a930248701d2dc2963faa7833ff935c0.png" class="tex" alt="\forall ^ \approx" title="\forall ^ \approx" align="absmiddle" /> might be better than <img src="http://blog.blackhc.net/wp-content/cache/tex_c4513a0476f5fcb3cf3544dfcc8f2bcd.png" class="tex" alt="\tilde{\forall}" title="\tilde{\forall}" align="absmiddle" />.</p>
<p>I&#8217;ll try to formalize these quantifiers some more when I find some spare time.</p>
<p>Stay tuned for coding related updates soon <img src='http://blog.blackhc.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Cheers,<br />
 Andreas</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blackhc.net/2010/03/a-quick-note-on-quantifiers-for-almost-all-and-there-exist-infinitely-many/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random Things</title>
		<link>http://blog.blackhc.net/2009/11/random-things/</link>
		<comments>http://blog.blackhc.net/2009/11/random-things/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 16:56:20 +0000</pubDate>
		<dc:creator>BlackHC</dc:creator>
				<category><![CDATA[Maths]]></category>
		<category><![CDATA[Personal Rantings]]></category>

		<guid isPermaLink="false">http://blog.blackhc.net/?p=686</guid>
		<description><![CDATA[It&#8217;s been a while since the last update. Here&#8217;s a small update on what I&#8217;m thinking about various stuff. Prototype Gameplay is okay I guess. Nothing I would spent too much time on though. It looks a lot worse than &#8230; <a href="http://blog.blackhc.net/2009/11/random-things/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since the last update. Here&#8217;s a small update on what I&#8217;m thinking about various stuff.</p>
<h4>Prototype</h4>
<p>Gameplay is okay I guess. Nothing I would spent too much time on though. It looks a lot worse than GTA 4 though (same as Crackdown).</p>
<h4>Resident Evil</h4>
<p>Seems to be lots of fun and some nice graphics, too.</p>
<h4>Red Faction: Guerrilla</h4>
<p>Some weird texture filtering issues and the presentation doesn&#8217;t knock off my chair (terrain popping and other ugliness), but multiplayer is loads of fun with friends. Physics isn&#8217;t completely stable though. I played the game for one hour in MP with friends and there were quite a few cases where geometry dropped through the floor with enough pressure from above (after destroying a building).</p>
<h4>Brüno</h4>
<p>A bad and quite stupid movie (Ali G in Da House is probably the only movie I kinda like that stars Cohen). If you haven&#8217;t watched it already, don&#8217;t &gt;_&lt;</p>
<h4>Shadow Complex</h4>
<p>I bought shadow complex a few weeks ago and I have to say that it is an awesome game. I read somewhere that the developer used the Metroid series as inspiration and it shows. It&#8217;s really fun to play and quite addictive. The graphics are pretty awesome (it is using the Unreal 3 engine) and the whole presentation is pretty polished. It certainly is worth its 1200 gamerpoints</p>
<h3>Summing Formulas</h3>
<p>A month ago I was doing some exercises in an analysis book (Königsberger) and found a nice/interesting problem:</p>
<p>Prove that if we denote of the sum of the numbers 1 to n to the p-th power by <img src="http://blog.blackhc.net/wp-content/cache/tex_3c6cf5781b9f871308dd7095e01ea46d.png" class="tex" alt=" S_n^p = 1^p + 2^p + ... + n^p " title=" S_n^p = 1^p + 2^p + ... + n^p " align="absmiddle" />, then the following equation by Pascal holds: <img src="http://blog.blackhc.net/wp-content/cache/tex_131195a6c7f4bab1fa5e8a69eddcbd9e.png" class="tex" alt=" (p+1) S_n^p + \binom{ p + 1 }{ 2 } S_n^{p-1} + \binom{ p + 1 }{ 3 } S_n^{p-2} + ... + S_n^0 = (n+1)^{p+1} - 1 " title=" (p+1) S_n^p + \binom{ p + 1 }{ 2 } S_n^{p-1} + \binom{ p + 1 }{ 3 } S_n^{p-2} + ... + S_n^0 = (n+1)^{p+1} - 1 " align="absmiddle" /></p>
<p>It can be used to get recursively/iteratively get formulas for sums of higher powers of numbers.</p>
<p>This is interesting because the proof doesn&#8217;t need any advanced maths (like eg the Euler-MacLaurin formula, which can be used to show this, too).</p>
<p style="text-align: left;">You can download the proof and a few examples <a href="http://blog.blackhc.net/wp-content/uploads/2009/11/PascalSumFormula.pdf" target="_blank">here</a>.</p>
<p style="text-align: left;">Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blackhc.net/2009/11/random-things/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extracting Information from StudiVZ</title>
		<link>http://blog.blackhc.net/2009/10/extracting-information-from-studivz/</link>
		<comments>http://blog.blackhc.net/2009/10/extracting-information-from-studivz/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 18:34:42 +0000</pubDate>
		<dc:creator>BlackHC</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Personal Rantings]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Profiles]]></category>
		<category><![CDATA[Regex]]></category>
		<category><![CDATA[StudiVZ]]></category>

		<guid isPermaLink="false">http://blog.blackhc.net/?p=678</guid>
		<description><![CDATA[Some time ago somebody stole 1 million data records from StudiVZ, the German Facebook clone. I&#8217;m not exactly sure why people call the person a hacker who stole data, because it appears he simply wrote a tool that harvested the &#8230; <a href="http://blog.blackhc.net/2009/10/extracting-information-from-studivz/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some time ago somebody stole 1 million data records from <a href="http://www.studivz.net/" target="_blank">StudiVZ</a>, the German Facebook clone. I&#8217;m not exactly sure why people call the person a hacker who stole data, because it appears he simply wrote a tool that harvested the publicly available data from StudiVZ (which everyone with an account can view).</p>
<p>People on StudiVZ share all their data by default&#8212;contrary to Facebook which values a person&#8217;s private data a lot more. Thus by simply opening each profile from a dummy user and processing the HTML data from StudiVZ one can extract a lot and some more information from random people who probably don&#8217;t even know about it or don&#8217;t care.. so I&#8217;m not sure about the stealing part.</p>
<p>Apparently there are some captcha&#8217;s when you start browsing searches beyond a few pages. I guess that is where the hacking part comes in, because getting around a captcha probably constitutes hacking&#8212;maybe?</p>
<p>Anyway I think part of the media coverage is a bit ridiculous because anyone can write a simple harvester in an hour or two. It took me one and half hours, so I think I&#8217;m on the safe side with this estimate and I didn&#8217;t really have a clue about this stuff before either.</p>
<p>Since I don&#8217;t want to &#8220;hack&#8221;, I&#8217;ve only written a very tame harvester. It connects to your personal StudiVZ account, and retrieves the name and profile ID (and thus profile URL) of all your friends in the &#8220;Meine Freunde&#8221; pages.</p>
<p>It could do a lot more with that like retrieving everybody&#8217;s birthday or random pictures, but I&#8217;m too lazy to code that because you use the same pattern for extracting data over and over again and it stops being interesting quite fast.</p>
<p>You can download the project <a href="http://blog.blackhc.net/wp-content/uploads/2009/10/StudiVZExtractor.zip" target="_blank">here</a>. It is a one file C# project. I&#8217;m releasing it under GPL (whatever).</p>
<p>It&#8217;s really easy to explain how it works:</p>
<ul>
<li>It uses <strong>System.Net</strong>&#8216;s <strong>HttpWebRequest</strong> and <strong>HttpWebResponse</strong> to get (and post) web pages.</li>
<li>StudiVZ (like every other portal) uses cookies, so I create a <strong>CookieContainer </strong>and use it in every http request.</li>
<li>There are a few hidden values that StudiVZ expects during login. I&#8217;m retrieving them from the main page using custom built regular expressions. I&#8217;ve found a <a href="http://derekslager.com/blog/posts/2007/09/a-better-dotnet-regular-expression-tester.ashx" target="_blank">handy AJAX tester for .NET regular expressions</a>. It was really useful for building the expressions and debugging them. (BTW you can find all URLs I used in the comments.)</li>
<li>After login I use the same pattern: get page &amp; parse using regex for everything.</li>
<li>Visual Studio has an awesome &#8220;HTML Visualizer&#8221; for strings. It displays the content of a string as HTML page, which is really nifty if you&#8217;re doing anything related to HTML processing.</li>
</ul>
<p>The code is quite ugly. Well, it&#8217;s not production code and this is only meant as a proof of concept.</p>
<p>Also note that I have at most violated the AGB of StudiVZ and not committed any criminal acts and I&#8217;m not planning to sell my friend&#8217;s profile IDs or data either <img src='http://blog.blackhc.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Maybe someone can extend the code and make it more useful. I guess it would be fun to automatically download all your pictures (including tags) and feed them into flickr or picasa&#8230; but someone else can do that.</p>
<p>Cheers,<br />
Andreas</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blackhc.net/2009/10/extracting-information-from-studivz/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>My Bachelor Thesis</title>
		<link>http://blog.blackhc.net/2009/10/my-bachelor-thesis/</link>
		<comments>http://blog.blackhc.net/2009/10/my-bachelor-thesis/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 13:43:19 +0000</pubDate>
		<dc:creator>BlackHC</dc:creator>
				<category><![CDATA[Personal Rantings]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[Bachelor Thesis]]></category>
		<category><![CDATA[Equalizer]]></category>
		<category><![CDATA[Inkscape]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[Omondo]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[TikZ]]></category>

		<guid isPermaLink="false">http://blog.blackhc.net/?p=661</guid>
		<description><![CDATA[For the last two months I have been working on my bachelor thesis at the Chair of Computer Graphics and Visualization. It is about &#8220;Multi-Tile Terrain Rendering with OGL/Equalizer&#8221;&#180;. The chair has a very nice Direct3D 10 terrain rendering engine &#8230; <a href="http://blog.blackhc.net/2009/10/my-bachelor-thesis/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div id="attachment_664" class="wp-caption alignright" style="width: 310px"><a href="http://blog.blackhc.net/wp-content/uploads/2009/10/frontshot.png"><img class="size-medium wp-image-664 " title="Screenshot of Utah" src="http://blog.blackhc.net/wp-content/uploads/2009/10/frontshot-300x238.png" alt="Screenshot of Utah" width="300" height="238" /></a><p class="wp-caption-text">Screenshot of Utah</p></div>
<p>For the last two months I have been working on my bachelor thesis at the Chair of Computer Graphics and Visualization. It is about &#8220;Multi-Tile Terrain Rendering with OGL/Equalizer&#8221;<a class="annotation" title="the German title is &quot;Multi-Tile Terrain Rendering mit OGL/Equalizer&quot; :)" href="javascript:;"><strong>&#180;</strong></a>.<br />
The chair has a very nice Direct3D 10 terrain rendering engine and they want to run it at the newly founded KAUST (King Abdullah University of Science and Technology<a class="annotation" title="women are actually allowed to drive on the campus:" href="javascript:;"><strong>&#180;</strong></a>) in a massive CAVE environment. A CAVE is a room whose walls are actually screens.<br />
The CAVE at KAUST even supports stereoscopic rendering. Thus in total 12 views can be rendered to.</p>
<p>My job was to port said terrain engine from Direct3D to OpenGL and afterwards to the Equalizer framework, which is an open-source framework for parallelizing OpenGL applications.</p>
<p>You can find/download an online version of my bachelor thesis <a title="Multi-Tile Terrain Rendering with OGL/Equalizer" href="http://blog.blackhc.net/wp-content/uploads/2009/10/BachelorThesisOnline.pdf" target="_blank">here</a>. I&#8217;ll upload the LaTeX at a later date and update this post.</p>
<p>I&#8217;ve spent the last months writing about all this, so I don&#8217;t feel like talking about the thesis itself anymore. Instead the remainder of this post will contain a post-mortem of it.<br />
<span id="more-661"></span></p>
<h3>Post-Mortem</h3>
<h4>Preparations</h4>
<p>I think I did a good job at preparing myself for the thesis: I&#8217;m a LaTex noob, so I got lots<a class="annotation" title="4 to be exact" href="javascript:;"><strong>&#180;</strong></a> of LaTeX books; I&#8217;m a (paper-)writing noob, so I got lots<a class="annotation" title="3 in this case" href="javascript:;"><strong>&#180;</strong></a> of books about writing papers and writing good English.</p>
<p>The books have helped me a lot and it is always a good decision to get as many books as possible, because the more sources you have, the better.</p>
<p>I got all the LaTeX books from our university library:</p>
<ul>
<li><a href="http://www.amazon.de/gp/product/389842510X/ref=sib_rdr_dp" target="_blank">[Einstieg in] LaTeX</a><br />
A big book (696 pages) but not particularly helpful. The reviewer on Amazon is pretty much right: it contains lots of information., but always stops short of providing the really useful details/information.</li>
<li><a href="http://www.amazon.de/LATEX-GE-PACKT-Karsten-G%C3%BCnther/dp/3826615883/ref=sr_1_6?ie=UTF8&amp;s=books&amp;qid=1255775138&amp;sr=8-6" target="_blank">LaTeX &#8211; Ge-packt</a><br />
A small but thick pocket book (608 pages). I totally forgot I had it and it stood on my bookshelf until I found it yesterday. I&#8217;ve used it though while writing another paper last year, and it&#8217;s pretty neat. It&#8217;s a nifty reference, that&#8217;s what it is.</li>
<li><a href="http://www.amazon.de/LaTeX-Hacks-Techniken-professionellen-Textsatz/dp/3897214776/ref=pd_sim_b_5" target="_blank">LaTeX Hacks: Tipps und Techniken für professionellen Textsatz</a><br />
This book is very good. It contains 100 &#8220;LaTeX hacks&#8221; (on 416 pages). These are small, closed sections describing the solution to a specific problem you might encounter while using LaTeX.<br />
I&#8217;ve used the book a lot of times to look up solutions to my problems and it references many useful LaTeX packages, too&#8212;so it&#8217;s a good start for searches.</li>
<li><a href="http://www.amazon.de/Wissenschaftliche-Arbeiten-schreiben-LaTeX-CD-ROM/dp/3826658922/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1255777607&amp;sr=1-1" target="_blank">Wissenschaftliche Arbeiten schreiben mit LATEX</a><br />
<strong>Get this book</strong> if you want to write your thesis with LaTeX. It&#8217;s incredibly useful and covers most of what you&#8217;ll need. It takes you on a journey through all features of LaTeX that you will use and describes the most common use cases. It even has a section describing how to fix common LaTeX errors like overflowed hboxes and others.</li>
</ul>
<p>I&#8217;ve also bought some  books about writing papers and the English language in general:</p>
<ul>
<li><a href="http://www.amazon.com/Manual-Writers-Research-Dissertations-Seventh/dp/0226823377/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1255778175&amp;sr=1-1" target="_blank">A Manual for Writers of Research Papers, Theses, and Dissertations, Seventh Edition: Chicago Style for Students and Researchers</a><br />
This book covers everything you need to know about the style and format of a thesis. It has a huge chapter about how to add citations and what format the bibligraphy should use, etc.<br />
In retrospect reading it was probably overkill, because a bachelor thesis apparently doesn&#8217;t have very strict requirements (well, I&#8217;ll see about that when I get my feedback..).<br />
It, however, contains a few nice chapters about editing your text and improving its readability, and the punctuation and spelling chapters are nice, too.</li>
<li><a href="http://www.amazon.co.uk/Oxford-Guide-Effective-Writing-Speaking/dp/0192806130/ref=pd_sim_b_1" target="_blank">Oxford Guide to Effective Writing and Speaking</a><br />
I&#8217;ve only read this book in parts but it&#8217;s not bad. It contains a useful introduction to English grammar, if you want to refresh that knowledge.</li>
<li><a href="http://www.amazon.co.uk/Oxford-Guide-Plain-English-Martin/dp/0199233454/ref=sr_1_11?ie=UTF8&amp;s=books&amp;qid=1255779088&amp;sr=8-11" target="_blank">Oxford Guide to Plain English</a><br />
This book is simply awesome. Plain English refers to writing English in a simple and easily understood way. This book describes what makes a text &#8216;plain&#8217; and easy to read and how to transform your texts to improve readability. It contains lots and lots of examples of complicated texts an shows how easy it is to improve them with few changes.<br />
The book itself is a very nice read and in parts even funny. The author clearly knows what he is teaching and it helped me a lot while writing my bachelor thesis.</li>
</ul>
<h4>Writing the Thesis</h4>
<p>I had two months for the implementation of the project and for writing the thesis. The plan was to implement everything in August and write everything in September and be done at the beginning of October (before my birthday).</p>
<p>Instead last week I ended up being in crunch mode working 15 hours on it every day <img src='http://blog.blackhc.net/wp-includes/images/smilies/icon_neutral.gif' alt=':-|' class='wp-smiley' /> </p>
<p>The implementation went mostly as planned. I found a few driver bugs though, bought <a href="http://www.gremedy.com/" target="_blank">gDEBugger</a> for debugging shader issues and found some bugs in it, too. I think I reported 5-7 bugs in gDEBugger&#8217;s support forum in a matter of days and still have to write/extend a few reports.</p>
<p>I wrote my thesis in LaTeX and used the very good <a href="http://www.xm1math.net/texmaker/" target="_blank">Texmaker</a> as editor. It supports multiple file projects and allows you to select a main file (usually latex is called with the file that is currently being edited).</p>
<p><a href="http://www.jedit.org/" target="_blank">jEdit</a> also supports LaTeX editing through a plugin: <a href="http://plugins.jedit.org/plugins/?LaTeXTools" target="_blank">LaTeXTools</a>. It isn&#8217;t working as well as Texmaker though, but it has generally more text editing options and supports directory searches and regexp which is useful for a multi-file project.</p>
<p>I used subversion for version management, which proved useful at times, even though TortoiseSVN&#8217;s difference viewer doesn&#8217;t support line wrapping, which sucks a bit because I always write long blocks of text in Texmaker and it made diff&#8217;ing difficult.</p>
<p>For creating vector graphics, a very cool LaTeX package exists. It&#8217;s called <a href="http://sourceforge.net/projects/pgf/" target="_blank">TikZ</a> (&#8220;Tikz ist kein Zeichenprogramm&#8221;), and it allows you to create illustrations the LaTeX way: by coding them.<br />
See <a href="http://www.texample.net/tikz/examples/" target="_blank">http://www.texample.net/tikz/examples/</a> for some neat looking examples.</p>
<p>I really wanted to use it to create my illustrations, but due to time constraints I couldn&#8217;t read the whole manual (it&#8217;s huge!) and I think even then it would have been too difficult.<br />
You see, it suffers from the same problem TeX and LaTeX suffer from in general. It&#8217;s easy to write something that looks okay, but as soon as you want to tweak something to look exactly the way you imagine it and it is not a standard option, you end up reading weird package code and wishing you had a Phd in TeX editing.</p>
<p>TikZ has exactly the same problem. I&#8217;ve understood the tutorials and the manual well enough, but I wanted to create class diagrams with it. I got lost quickly and the 500 page manual didn&#8217;t offer a straight-forward way either.</p>
<p>In the end I installed the latest version of <a href="http://www.inkscape.org/" target="_blank">Inkscape</a> and created all my illustrations with it. Well, actually I always tried to create them with TikZ first, got frustrated after losing an hour or two, and spent another hour creating them in Inkscape.</p>
<p>While Inkscape makes it harder to change an illustration later on and there is no way to layout diagrams automatically, you can still become quite fast with it after learning a few hotkeys.</p>
<p>I wanted to use Eclipse and <a href="http://www.uml2.org/download_studio_eclipse_3.4.html" target="_blank">Omondo&#8217;s UML plugin</a> to create some diagrams of a Java subproject and it failed horribly..</p>
<blockquote><p>Having to wait 20 minutes, while it hogs your computer at 100% CPU usage and 400 MB memory usage, to create a UML model of a 5 classes project is quite unacceptable!</p></blockquote>
<p>Starting Eclipse later crashed it every time, too, by the way. I had to uninstall the damned plugin for Eclipse to start at all again.</p>
<p>In the end I recreated the classes in C++ and used Visual Studio&#8217;s class diagram viewer to display the classes. You can then print the diagram to PDF and edit it some more in Inkscape, which supports importing single-page PDFs.</p>
<p>I hope I&#8217;ll find time to write about game development related topics again in the next weeks. There are a few things I want to work on, but sadly university starts on Monday again and it will probably use up most of my time.</p>
<p>Cheers,<br />
 Andreas</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blackhc.net/2009/10/my-bachelor-thesis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sploidz Revisited (Unofficially)</title>
		<link>http://blog.blackhc.net/2009/08/sploidz-revisited/</link>
		<comments>http://blog.blackhc.net/2009/08/sploidz-revisited/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 09:08:26 +0000</pubDate>
		<dc:creator>BlackHC</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Game Projects]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Red Thumb Games]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[FlashDevelop]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Sploidz]]></category>

		<guid isPermaLink="false">http://blog.blackhc.net/?p=644</guid>
		<description><![CDATA[I&#8217;ve already written about the semi-conductor project and how I&#8217;ve written some Flash animations/applications for it. Of course, I&#8217;m more interested in making fun stuff&#180;, so I decided to put my knowledge to good use and write a small game &#8230; <a href="http://blog.blackhc.net/2009/08/sploidz-revisited/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve already written about the semi-conductor project and how I&#8217;ve written some Flash animations/applications for it. Of course, I&#8217;m more interested in making fun stuff<a class="annotation" title="of course, the math stuff is also fun from a different point of view" href="javascript:;"><strong>&#180;</strong></a>, so I decided to put my knowledge to good use and write a small game to see how difficult/awkward Flash actually is.</p>
<p>To sum it up, it is somewhat awkward, at least if you use the IDE itself. FlashDevelop still is as nice as ever, but you can quickly develop games nonetheless. I prefer Torque Game Builder though in retrospect.</p>
<p>Before I continue talking about the development itself, let&#8217;s take a look at the actual game. <a href="http://www.redthumbgames.com/sploidz/">Sploidz</a> was the first game I wrote using Torque Game Builder for Joshua Dallman, and since I still had all the assets in my subversion repository, it was an easy decision to try and port this game. If you want to play it, you can download it for <strong>free</strong> <a href="http://www.redthumbgames.com/sploidz/" target="_blank">here</a>.<br />
I haven&#8217;t ported everything: I&#8217;ve just rewritten the main characteristic features that make up Sploidz&#8217;s code in ActionScript.</p>
<p>Without further ado<a class="annotation" title="honestly I don't know why I know this expression.." href="javascript:;"><strong>&#180;</strong></a> here is the game:<br />
<object id="Sploidz" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="512" height="384" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="align" value="middle" /><param name="allowFullScreen" value="true" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="src" value="http://blog.blackhc.net/wp-content/uploads/2009/08/Sploidz.swf" /><param name="name" value="Sploidz" /><param name="allowfullscreen" value="true" /><embed id="Sploidz" type="application/x-shockwave-flash" width="512" height="384" src="http://blog.blackhc.net/wp-content/uploads/2009/08/Sploidz.swf" name="Sploidz" bgcolor="#ffffff" quality="high" allowfullscreen="true" align="middle"></embed></object><br />
<a href="http://blog.blackhc.net/wp-content/uploads/2009/08/Sploidz.swf" target="_blank">Click to open Sploidz in its own window</a></p>
<p>Because the art is still copyrighted and I haven&#8217;t heard back from Joshua yet <a class="annotation" title="and because I had too much spare time on Saturday night when everybody is having fun and partying and I'm sitting alone this wretched room.. just kidding" href="javascript:;"><strong>&#180;</strong></a>, I decided to create a free version that only uses &#8220;coder art&#8221; &#8211; in this hand-drawn coder art <img src='http://blog.blackhc.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Some<a class="annotation" title="Mr. jRAD" href="javascript:;"><strong>&#180;</strong></a> have said that this version looks cuter, decide for yourself:<br />
<object id="SploidzCC" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="512" height="384" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="align" value="middle" /><param name="allowFullScreen" value="true" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="src" value="http://blog.blackhc.net/wp-content/uploads/2009/08/SploidzCC.swf" /><param name="name" value="SploidzCC" /><param name="allowfullscreen" value="true" /><embed id="SploidzCC" type="application/x-shockwave-flash" width="512" height="384" src="http://blog.blackhc.net/wp-content/uploads/2009/08/SploidzCC.swf" name="SploidzCC" bgcolor="#ffffff" quality="high" allowfullscreen="true" align="middle"></embed></object><br />
<a href="http://blog.blackhc.net/wp-content/uploads/2009/08/SploidzCC.swf" target="_blank">Click to open SploidzCC in its own window</a></p>
<p>Below you&#8217;ll find a description of the development and at least one helpful trick and most importantly a link to the source code of the &#8220;copyright-free&#8221; version.</p>
<p><strong>Because the orginal version is way too difficult to be really fun, I actually sat down one more time and added code to make the platform slower if you&#8217;re in danger of losing (up to 3 times slower):</strong><br />
<object id="SploidzMoreFun" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="512" height="384" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="align" value="middle" /><param name="allowFullScreen" value="true" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="src" value="http://blog.blackhc.net/wp-content/uploads/2009/08/SploidzMoreFun.swf" /><param name="name" value="SploidzMoreFun" /><param name="allowfullscreen" value="true" /><embed id="SploidzMoreFun" type="application/x-shockwave-flash" width="512" height="384" src="http://blog.blackhc.net/wp-content/uploads/2009/08/SploidzMoreFun.swf" name="SploidzMoreFun" bgcolor="#ffffff" quality="high" allowfullscreen="true" align="middle"></embed></object><br />
<a href="http://blog.blackhc.net/wp-content/uploads/2009/08/SploidzMoreFun.swf" target="_blank">Click to open SploidzMoreFun in its own window</a></p>
<p><span id="more-644"></span></p>
<h3>Development</h3>
<p>I think I spent less than 20 hours on the project. It&#8217;s hard to say because I worked on it on three different days, but only probably less than 6 hours on each.</p>
<p>The main problems during the development were:</p>
<ul>
<li>How do I get the art assets into Flash?</li>
<li>How do I use the IDE and objects in a way that is helpful?</li>
</ul>
<p>Lessons learned:</p>
<p>Even though the project isn&#8217;t that big, it didn&#8217;t take long for annoying bugs to appear &#8211; mainly in the matching code, because it&#8217;s somewhat asynchronous and you have to make sure that an item doesn&#8217;t get removed between events, etc.<br />
So again, I can only say that assertions and lots of debug messages are your friend and are really useful for understanding the sometimes mysterious ways of non-obvious code interaction.</p>
<p>Again one of the biggest headache was how to make the game a game (so you don&#8217;t always and feel some reward while playing) and this resulted in implementing the platform game element from the original Sploidz game, although I wanted to avoid that in the beginning because of the added complexity.<br />
Someone<a class="annotation" title="Roy" href="javascript:;"><strong>&#180;</strong></a> pointed out though, that if you have 8 columns and only 5 different item types, the main idea of matching items becomes trivial. It&#8217;s obvious, but I didn&#8217;t think of it while coding the proof of concept code.<br />
Of course you have to somewhat tune the speed and animation durations of everything to make it playable. I think the game is really hard at the moment, but that&#8217;s better than too easy and I especially added the &#8220;survival timer&#8221; in the upper right panel to allow for some competition and personal best times.<br />
I might change the platform code at some point to be more player-friendly, but I have more pressing projects to do at the moment: my Bachelor Thesis&#8230; /o\.<br />
As said above, I actually sat down and added a time scaler to the platform. The code is quite simple but helps the game a bit (I managed to survive 2 minutes and it was more challenging and less depressing to play the game ^ ^). The code is quite simple:</p>
<pre>public function getPlatformTimeScale():Number {
	var maxRow:int = 0;
	for ( var column:int = 0 ; column &lt; Grid.numColumns ; column++ ) {
		var firstEmptyRow:int = grid.getFirstEmptyCellRow( column );
		if ( firstEmptyRow &gt; maxRow ) {
			maxRow = firstEmptyRow;
		}
	}

	const minScale:Number = 1.0;
	const maxScale:Number = 3.0;
	var scale:Number = minScale + (maxScale - minScale) * Math.pow( maxRow / (Grid.numRows - 1), 8 );
	trace( "Using platform scale: " + scale );
	return scale;
}
</pre>
<p>As you see, it uses a power function to make the platform slower only if really few empty rows are left.</p>
<h4>Interesting things to know</h4>
<ul>
<li>If you want to important a sequence of images (say you have an animation stored as picture frames diamond_black00.png to diamond_black15.png, only select the first image when &#8220;importing to stage&#8221; in Flash, otherwise you won&#8217;t get the dialog asking you whether you want to import an image sequence as animation.<br />
(Cost me a few hours of searching to find this out.)</li>
<li>If you have animations that stores multiple frames in one image, you&#8217;ll have to split the images up into the respective frames. To do this in Photoshop make use of &#8220;guides&#8221; and slicing and notice the &#8220;Slices from Guides&#8221; button that is offered. It&#8217;s really helpful.<br />
You can also store the creation of the guides and the slicing as action/macro and reuse it which also saves some time.</li>
<li>If you ever get the error &#8220;type was not defined or was not a compile-time constant&#8221;, you might have a symbol instance that has the same name and class name. Flash freaks out for some reason and displays this weird error message.</li>
</ul>
<p>For added fanciness, I&#8217;ve also included two older builds that show the evolution of the game code.</p>
<p>Note: There are bugs in these builds, so they are really just meant to show the progress on the first and second day.<br />
<object id="Sploidz0810" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="512" height="384" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="align" value="middle" /><param name="allowFullScreen" value="true" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="src" value="http://blog.blackhc.net/wp-content/uploads/2009/08/Sploidz0810.swf" /><param name="name" value="Sploidz0810" /><param name="allowfullscreen" value="true" /><embed id="Sploidz0810" type="application/x-shockwave-flash" width="512" height="384" src="http://blog.blackhc.net/wp-content/uploads/2009/08/Sploidz0810.swf" name="Sploidz0810" bgcolor="#ffffff" quality="high" allowfullscreen="true" align="middle"></embed></object><br />
<a href="http://blog.blackhc.net/wp-content/uploads/2009/08/Sploidz0810.swf" target="_blank">Click to open Sploidz0810 in its own window</a></p>
<p><object id="Sploidz0813" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="512" height="384" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="align" value="middle" /><param name="allowFullScreen" value="true" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="src" value="http://blog.blackhc.net/wp-content/uploads/2009/08/Sploidz0813.swf" /><param name="name" value="Sploidz0813" /><param name="allowfullscreen" value="true" /><embed id="Sploidz0813" type="application/x-shockwave-flash" width="512" height="384" src="http://blog.blackhc.net/wp-content/uploads/2009/08/Sploidz0813.swf" name="Sploidz0813" bgcolor="#ffffff" quality="high" allowfullscreen="true" align="middle"></embed></object><br />
<a href="http://blog.blackhc.net/wp-content/uploads/2009/08/Sploidz0813.swf" target="_blank">Click to open Sploidz0813 in its own window</a></p>
<p>Fun note: I implemented most of the fancy features (combo matches, the score bubbles, the platform) today in a few hours (a lot less than expected). I think ActionScript is an okay language, although it lacks quite a few comfort features of regular modern programming languages (function overloading, delegate types that actually check parameter type).</p>
<p>Last but not least here is the link to the code: <a href="http://blog.blackhc.net/wp-content/uploads/2009/08/FlashySploidz.zip">FlashySploidz Source</a><br />
I release the code itself under GPL and the art under Common Creative.</p>
<p>Over and out,<br />
Andreas</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blackhc.net/2009/08/sploidz-revisited/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
