<?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>Messy Mind &#187; effects</title>
	<atom:link href="http://www.messy-mind.net/tag/effects/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.messy-mind.net</link>
	<description>Welcome to the tangle in my head.</description>
	<lastBuildDate>Wed, 09 Nov 2011 22:39:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fast GPU color transforms with XNA</title>
		<link>http://www.messy-mind.net/2008/fast-gpu-color-transforms/</link>
		<comments>http://www.messy-mind.net/2008/fast-gpu-color-transforms/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 18:11:19 +0000</pubDate>
		<dc:creator>Bicubic</dc:creator>
				<category><![CDATA[XNA]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[shaders]]></category>

		<guid isPermaLink="false">http://www.messy-mind.net/?p=359</guid>
		<description><![CDATA[Some time ago I came across a nice Siggraph paper on Using Lookup Tables to Accelerate Color Transformations and since then have been interested in seeing it at work. 
The basic premise is that a 3d texture is used as a lookup table where the input 3d coords represent the input colour. A nice and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.messy-mind.net/uploads/2008/10/color-transforms-2.jpg" rel="shadowbox[post-359];player=img;"><img src="http://www.messy-mind.net/uploads/2008/10/color-transforms-2-150x56.jpg" alt="" title="color-transforms-2" width="150" height="56" class="alignleft size-thumbnail wp-image-333" /></a>Some time ago I came across a nice Siggraph paper on <a href="http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter24.html">Using Lookup Tables to Accelerate Color Transformations</a> and since then have been interested in seeing it at work. </p>
<p>The basic premise is that a 3d texture is used as a lookup table where the input 3d coords represent the input colour. A nice and simple fragment shader is then used to access this lookup texture and return the transformed color. Any number of any complexity operations can be stored in the lookup texture as long as you&#8217;re mapping the single input pixel (that is, no neighbours). Gamma correction, contrast, saturation, colorisation, levels, colour keying etc, are all possible in any combination at a fixed small cost.<br />
<span id="more-359"></span></p>
<h4>The basics</h4>
<p>Here&#8217;s how I generate my lookup 3d texture.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #FF0000;">int</span> size <span style="color: #008000;">=</span> <span style="color: #FF0000;">32</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//size of lookup texture</span>
Color<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> colors <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Color<span style="color: #000000;">&#91;</span>size <span style="color: #008000;">*</span> size <span style="color: #008000;">*</span> size<span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
Texture3D tex <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Texture3D<span style="color: #000000;">&#40;</span>Device, size, size, size, <span style="color: #FF0000;">1</span>, TextureUsage.<span style="color: #0000FF;">Linear</span>, SurfaceFormat.<span style="color: #0000FF;">Color</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> r <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> r <span style="color: #008000;">&lt;</span> size<span style="color: #008000;">;</span> r<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> g <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> g <span style="color: #008000;">&lt;</span> size<span style="color: #008000;">;</span> g<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> b <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> b <span style="color: #008000;">&lt;</span> size<span style="color: #008000;">;</span> b<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            Vector3 inCol <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Vector3<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>r <span style="color: #008000;">/</span> size, <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>g <span style="color: #008000;">/</span> size, <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>b <span style="color: #008000;">/</span> size<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008080; font-style: italic;">//Manipulate the input color in some way here</span>
            Color col <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Color<span style="color: #000000;">&#40;</span>inCol<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            colors<span style="color: #000000;">&#91;</span>r <span style="color: #008000;">+</span> <span style="color: #000000;">&#40;</span>g <span style="color: #008000;">*</span> size<span style="color: #000000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #000000;">&#40;</span>b <span style="color: #008000;">*</span> size <span style="color: #008000;">*</span> size<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> col<span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
tex.<span style="color: #0000FF;">SetData</span><span style="color: #008000;">&lt;</span>Color<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span>colors<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Not rocket science, is it? We&#8217;ve just created a lookup table that simply maps output = input. Now, to display it. We have a pretty simple effect to do all out work for us. The only calculations it has to perform are the texel offsets explained in the article I linked. I&#8217;m assuming the reader knows enough about XNA to attach this effect so a SpriteBatch but even if not, you&#8217;ll find that in the sample code.</p>

<div class="wp_syntax"><div class="code"><pre class="glsl" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">half</span> lutSize <span style="color: #000066;">=</span> <span style="color: #0000ff;">32</span><span style="color: #000066;">;</span> <span style="color: #666666; font-style: italic;">//some default lookup table size, to be changed by app</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Sampler for texture currently being drawn</span>
<span style="color: #000066; font-weight: bold;">sampler2D</span> tex1 <span style="color: #000066;">:</span> register<span style="color: #000066;">&#40;</span>s0<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Sampler for lookup table</span>
<span style="color: #993333; font-weight: bold;">texture3D</span> cubeTex<span style="color: #000066;">;</span>
<span style="color: #000066; font-weight: bold;">sampler3D</span> cube <span style="color: #000066;">=</span> sampler_state
<span style="color: #000066;">&#123;</span>
Texture <span style="color: #000066;">=</span> <span style="color: #000066;">&lt;</span>cubeTex<span style="color: #000066;">&gt;;</span> 
<span style="color: #666666; font-style: italic;">//We really want triliniear filtering for this sort of thing</span>
MinFilter <span style="color: #000066;">=</span> linear<span style="color: #000066;">;</span>
MagFilter <span style="color: #000066;">=</span> linear<span style="color: #000066;">;</span>
MipFilter <span style="color: #000066;">=</span> linear<span style="color: #000066;">;</span> 
<span style="color: #000066;">&#125;</span><span style="color: #000066;">;</span>
&nbsp;
float4 Fragment<span style="color: #000066;">&#40;</span>float4 incol <span style="color: #000066;">:</span> COLOR<span style="color: #000066;">,</span> float2 UV <span style="color: #000066;">:</span> TEXCOORD0<span style="color: #000066;">&#41;</span> <span style="color: #000066;">:</span> COLOR0
<span style="color: #000066;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//Fetch input color</span>
	float4 inCol <span style="color: #000066;">=</span> tex2D<span style="color: #000066;">&#40;</span>tex1<span style="color: #000066;">,</span> UV<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Edge offset (see http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter24.html)</span>
	half3 scale <span style="color: #000066;">=</span> <span style="color: #000066;">&#40;</span>lutSize <span style="color: #000066;">-</span> <span style="color: #0000ff;">1.0</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">/</span> lutSize<span style="color: #000066;">;</span>
	half3 offset <span style="color: #000066;">=</span> <span style="color: #0000ff;">1.0</span> <span style="color: #000066;">/</span> <span style="color: #000066;">&#40;</span><span style="color: #0000ff;">2.0</span> <span style="color: #000066;">*</span> lutSize<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Transform</span>
	float4 outCol <span style="color: #000066;">=</span> tex3D<span style="color: #000066;">&#40;</span>cube<span style="color: #000066;">,</span> scale <span style="color: #000066;">*</span> inCol <span style="color: #000066;">+</span> offset<span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Lerp between input and transformed in RGB space based on input vertex alpha</span>
	<span style="color: #000000; font-weight: bold;">return</span> lerp<span style="color: #000066;">&#40;</span>inCol<span style="color: #000066;">,</span> outCol<span style="color: #000066;">,</span> incol<span style="color: #000066;">.</span><span style="color: #006600;">a</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
<span style="color: #000066;">&#125;</span>
&nbsp;
technique FastTransform
<span style="color: #000066;">&#123;</span>
    pass Pass1
    <span style="color: #000066;">&#123;</span>
        PixelShader <span style="color: #000066;">=</span> compile ps_2_0 Fragment<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">;</span>
    <span style="color: #000066;">&#125;</span>
<span style="color: #000066;">&#125;</span></pre></div></div>

<p>That&#8217;s it. After generating a lookup table and setting it on the effect, its ready to go. At the moment you&#8217;d see no difference because the lookup table outputs the input colour but you could try something simple like inCol*=2 to do a multiply2x.<br />
That&#8217;s great, but to actually do something meaningful with this you&#8217;ll probably at least want to be able to convert to HSL and back. I&#8217;ve spent some time to write a rudimentary library for performing colour transforms, you&#8217;ll find it in the sample. Still, to see actual use from this technique you&#8217;ll probably want photoshop grade effects; that&#8217;s what I had in mind when I started this. I scurried about the net looking for various algorithms to perform some of the photoshop tasks, like gamma correction, exposure, levels. I gave up on that notion pretty quickly. Some are fairly complex algorithms that make the lookup table generation slow, and I plain didn&#8217;t want to spend hours reinventing the wheel. There&#8217;s a better way.</p>
<h4>Generating the lookup table with image editing software</h4>
<p>Use photoshop for photoshop grade filters, of course! Its quite simple. To start, we need a 2d representation of the identity lookup table. I whipped up a quick routine to do this and figure out the nicest image sizes for me.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> Texture2D LutToTexture2D<span style="color: #000000;">&#40;</span>GraphicsDevice Device, Texture3D lut<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">//Calculate closest to square proportions for 2d table</span>
            <span style="color: #008080; font-style: italic;">//We assume power-of-two sides, otherwise I don't know</span>
            <span style="color: #FF0000;">int</span> size <span style="color: #008000;">=</span> lut.<span style="color: #0000FF;">Width</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">int</span> side1 <span style="color: #008000;">=</span> size <span style="color: #008000;">*</span> size<span style="color: #008000;">;</span>
            <span style="color: #FF0000;">int</span> side2 <span style="color: #008000;">=</span> size<span style="color: #008000;">;</span>
            <span style="color: #0600FF;">while</span> <span style="color: #000000;">&#40;</span>side1 <span style="color: #008000;">/</span> <span style="color: #FF0000;">2</span> <span style="color: #008000;">&gt;=</span> side2 <span style="color: #008000;">*</span> <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                side1 <span style="color: #008000;">/=</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">;</span>
                side2 <span style="color: #008000;">*=</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Dump 3d texture into 2d texture</span>
            Color<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> colors <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Color<span style="color: #000000;">&#91;</span>size <span style="color: #008000;">*</span> size <span style="color: #008000;">*</span> size<span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
            Texture2D tex <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Texture2D<span style="color: #000000;">&#40;</span>Device, side1, side2, <span style="color: #FF0000;">1</span>, TextureUsage.<span style="color: #0000FF;">Linear</span>, SurfaceFormat.<span style="color: #0000FF;">Color</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            lut.<span style="color: #0000FF;">GetData</span><span style="color: #008000;">&lt;</span>Color<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span>colors<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            tex.<span style="color: #0000FF;">SetData</span><span style="color: #008000;">&lt;</span>Color<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span>colors<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF;">return</span> tex<span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span></pre></div></div>

<p>A 64px cube unfolds to a nice 512&#215;512 image like this:<br />
<a href="http://www.messy-mind.net/uploads/2008/10/tex.png" rel="shadowbox[post-359];player=img;"><img src="http://www.messy-mind.net/uploads/2008/10/tex-300x300.png" alt="" title="2d lut" width="300" height="300" class="alignnone size-medium wp-image-325" /></a><br />
<a href="http://www.messy-mind.net/uploads/2008/10/color-transforms-1.jpg" rel="shadowbox[post-359];player=img;"><img src="http://www.messy-mind.net/uploads/2008/10/color-transforms-1-150x105.jpg" alt="" title="color-transforms-1" width="150" height="105" class="alignleft size-thumbnail wp-image-328" /></a> Once you have that, feel free to throw it into your favourite image editor and apply any colour transforms you want to it. For the results to be actually meaningful, I took a screenshot of my game, applied adjustment layers to make it look how I want, and then threw them on the lookup table. You can see my setup in the screenshot here.<br />
Finally we load the modified lookup table back in by reversing the above process (see sample), and voila! Lightning fast photoshop grade filters.</p>
<h4>Limitations</h4>
<p>This cake is obviously not free. The lookup tables take up video memory. For compatibility reasons I use SurfaceFormat.Color to represent them which means that one channel (alpha) is wasted; which doesn&#8217;t help either. A 32px cube is negligible, a 64px cube takes up 1mb, a 128px cube takes up 8mb, and the full 256px deal takes up a whopping 64mb. What size should you be using? That depends on the complexity of the transformations you&#8217;re doing. The higher frequency the changes in your function are, the higher resolution table you&#8217;ll need. I find that 64 is acceptable for most stuff. 128 may be needed sometimes (once so far) to closely match photoshop. I find that 8mb is still acceptable today, just make sure that your effect warrants it.</p>
<p>The other limitation is that the procedure is pretty static. If you wanted to change some settings, you&#8217;d have to rebuild the table. One way around this is to create multiple tables with different settings and interpolate between them, but be careful to make sure that your vram expenditure and shader complexity (with the new interpolation which may not look nice in rgb space) are really worth using this for rather than just writing a shader to do the job traditionally.<br />
Alternatively you could have a two step system where you execute a complex shader on the lookup table and use that to do the rest of the work. This would be nice where settings change every once in a while, and you have existing shader code to do the task.</p>
<p>So is this terribly useful at the end of the day? For the inept like me, yes! I like the idea of going into photoshop and making the look I want a lot more than writing fiddly shader code. Its pretty hard to picture this sort of math without actually seeing it at work.</p>
<p><a href='http://www.messy-mind.net/uploads/2008/10/colortransforms.zip'>Download Sample</a></p>
<img src="http://www.messy-mind.net/?ak_action=api_record_view&id=359&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.messy-mind.net/2008/fast-gpu-color-transforms/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Lumines type &#8217;scanner&#8217; with fireflies</title>
		<link>http://www.messy-mind.net/2007/fireflies/</link>
		<comments>http://www.messy-mind.net/2007/fireflies/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 05:43:52 +0000</pubDate>
		<dc:creator>GearGOD</dc:creator>
				<category><![CDATA[Game Maker]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://gear.64digits.com/blog/game-maker/fireflies/</guid>
		<description><![CDATA[Something neat I ran into today; a little proof of concept for a Lumines kind of effect. Only, prettier.
Fireflies
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.messy-mind.net/blog/wp-content/uploads/2007/10/scanner.jpg" rel="shadowbox"><img src="http://messy-mind.net/blog/wp-content/uploads/2007/10/scanner.thumbnail.jpg"/></a><br />
Something neat I ran into today; a little proof of concept for a Lumines kind of effect. Only, prettier.</highslide></p>
<p><a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/scanner.gm6" title="Scanner">Fireflies</a></p>
<img src="http://www.messy-mind.net/?ak_action=api_record_view&id=86&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.messy-mind.net/2007/fireflies/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Realtime Dynamic Light</title>
		<link>http://www.messy-mind.net/2007/realtime-dynamic-light/</link>
		<comments>http://www.messy-mind.net/2007/realtime-dynamic-light/#comments</comments>
		<pubDate>Sun, 07 Oct 2007 01:28:19 +0000</pubDate>
		<dc:creator>GearGOD</dc:creator>
				<category><![CDATA[Game Maker]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://gear.64digits.com/blog/game-maker/realtime-dynamic-light/</guid>
		<description><![CDATA[This is a little bit of history, the very first lighting system for game maker. Prior it was thought impossible to achieve. It works quite different from its modern cousins because surfaces didn&#8217;t exist back in the day. It&#8217;s obviously not for actual use, I thought thought it would be nice a post a page [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/realtimedynamic.jpg" rel="shadowbox"><img src="http://messy-mind.net/blog/wp-content/uploads/2007/10/realtimedynamic.thumbnail.jpg"/></a><br />
This is a little bit of history, the very first lighting system for game maker. Prior it was thought impossible to achieve. It works quite different from its modern cousins because surfaces didn&#8217;t exist back in the day. It&#8217;s obviously not for actual use, I thought thought it would be nice a post a page in GM history. Although several people have emailed me about it, one even intending to use it. I&#8217;m not sure why, but here you go.</p>
<p>While the thing itself is outdated, it still shows some good things to learn from like drawing smooth outlines around sprites and some uses for luminance scan, which you&#8217;ll find in every modern lighting engine.</p>
<p><a HREF="http://messy-mind.net/downloads/dynamic.gm6">Realtime Dynamic Light</a></p>
<img src="http://www.messy-mind.net/?ak_action=api_record_view&id=73&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.messy-mind.net/2007/realtime-dynamic-light/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Smooth loading bar</title>
		<link>http://www.messy-mind.net/2007/smooth-loading-bar/</link>
		<comments>http://www.messy-mind.net/2007/smooth-loading-bar/#comments</comments>
		<pubDate>Thu, 04 Oct 2007 19:44:31 +0000</pubDate>
		<dc:creator>GearGOD</dc:creator>
				<category><![CDATA[Game Maker]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://gear.64digits.com/blog/uncategorized/smooth-loading-bar/</guid>
		<description><![CDATA[

You might have seen this as part of an older GUI demo I posted. It&#8217;s a really smooth circular progressbar type thing. I just ran into it and thought it&#8217;d be nice to share. I still have to figure out what to do with my smaller creations.
Incidentally, I went and found the demo in question [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/loady.png" rel="shadowbox"><img src="http://messy-mind.net/blog/wp-content/uploads/2007/10/loady.thumbnail.png"/></a><br />
<br />
<a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/oldgui.jpg" rel="shadowbox"><img src="http://messy-mind.net/blog/wp-content/uploads/2007/10/oldgui.thumbnail.jpg"/></a></p>
<p>You might have seen this as part of an older GUI demo I posted. It&#8217;s a really smooth circular progressbar type thing. I just ran into it and thought it&#8217;d be nice to share. I still have to figure out what to do with my smaller creations.<br />
Incidentally, I went and found the demo in question and linked it here, even though I&#8217;ve lost the source to that particular build and can only offer an exe. I still think its a good little demo to look at as it demonstrates a number of things I takled about working in concert: interface, eyecandy, my object importer (here it is used to fetch content from the web and run it). You&#8217;ll find the demo at <a HREF="http://64digits.com/users/GearGOD/moreUltimate.zip">64digits</a>.</p>
<p>As for the sample itself&#8230; <a TITLE="Progress ring" HREF="http://messy-mind.net/blog/wp-content/uploads/2007/10/fader-ring.gm6">Progress ring.<br />
</a>And don&#8217;t fret, the editable for my GUI in it&#8217;s latest form is coming.</p>
<img src="http://www.messy-mind.net/?ak_action=api_record_view&id=62&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.messy-mind.net/2007/smooth-loading-bar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fake environment mapping</title>
		<link>http://www.messy-mind.net/2007/fake-enviroment-mapping/</link>
		<comments>http://www.messy-mind.net/2007/fake-enviroment-mapping/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 01:04:47 +0000</pubDate>
		<dc:creator>GearGOD</dc:creator>
				<category><![CDATA[Game Maker]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http://gear.64digits.com/blog/?p=48</guid>
		<description><![CDATA[A little trick I did to show that some limitations of d3d can be cheated around. Here we have a reflective surface. This is achieved by resolving a model&#8217;s vertices into screenspace (once again game maker limits and provides no transform functions so I had to pretty much duplicate d3d output with scripts). It is [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://messy-mind.net/blog/wp-content/uploads/2007/10/reflection.jpg" /></p>
<p>A little trick I did to show that some limitations of d3d can be cheated around. Here we have a reflective surface. This is achieved by resolving a model&#8217;s vertices into screenspace (once again game maker limits and provides no transform functions so I had to pretty much duplicate d3d output with scripts). It is however, very limited and only shows the idea. To make it work in a game with a camera, you&#8217;ll need to do a bit more in the way of transforms.</p>
<p>Oh yeah. The i3d format it uses is produced by my mesh exporter also available here.</p>
<p><a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/reflection.zip" title="Reflections">Reflections</a></p>
<img src="http://www.messy-mind.net/?ak_action=api_record_view&id=48&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.messy-mind.net/2007/fake-enviroment-mapping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2D Metaballs</title>
		<link>http://www.messy-mind.net/2007/2d-metaballs/</link>
		<comments>http://www.messy-mind.net/2007/2d-metaballs/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 00:00:35 +0000</pubDate>
		<dc:creator>GearGOD</dc:creator>
				<category><![CDATA[Game Maker]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[eyecandy]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://gear.64digits.com/blog/?p=42</guid>
		<description><![CDATA[The challange was to draw a 2d fluid. The solution was very interesting. Because actually solving marching cubes or similar was too slow in Game Maker, I designed an &#8216;analog&#8217; approach. This works on a surface. First we draw whatever the fluid &#8216;world&#8217; may be &#8211; that is, what the fluid area will actually show. [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://img215.imageshack.us/img215/8047/metaballs6mj.jpg" height="240" width="320" /><br />
<img src="http://img359.imageshack.us/img359/9276/metablood7rq.jpg" height="240" width="320" />The challange was to draw a 2d fluid. The solution was very interesting. Because actually solving marching cubes or similar was too slow in Game Maker, I designed an &#8216;analog&#8217; approach. This works on a surface. First we draw whatever the fluid &#8216;world&#8217; may be &#8211; that is, what the fluid area will actually show. Like a liquidy red version of the screen for blood, or a gradienty blue version for water, etc. Then we do a bit of magic and overwrite the alpha of that surface with the alpha of particles representing the fluid area. Last but not least, we achieve thresholding without alpha testing which is unsvailable in game maker by multiplying the alpha values by themselves several times much like the contrast ramp phase of a bloom filter.</p>
<p>The technique of overwriting a surface&#8217;s alpha chanel alone is useful in many other applications, but I&#8217;ll let you think about that.<br />
Oh yeah one more thing. The demo itself looks different from both these screenshots. And probably less pretty. Fiddle with it yourself to achieve the style you want. You&#8217;ll be wanting to play with the step script, which is sufficiently commented to navigate.</p>
<p><a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/metaball.gm6" title="Metaballs!">Metaballs!</a></p>
<img src="http://www.messy-mind.net/?ak_action=api_record_view&id=42&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.messy-mind.net/2007/2d-metaballs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Advanced Seeking Missiles</title>
		<link>http://www.messy-mind.net/2007/advanced-seeking-missiles/</link>
		<comments>http://www.messy-mind.net/2007/advanced-seeking-missiles/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 23:14:59 +0000</pubDate>
		<dc:creator>GearGOD</dc:creator>
				<category><![CDATA[Game Maker]]></category>
		<category><![CDATA[ai]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[effects]]></category>

		<guid isPermaLink="false">http://gear.64digits.com/blog/?p=40</guid>
		<description><![CDATA[Another bit of deliciousness from my GM folder. I made it after watching Battlestar Galactica. I learned a lot about homing missiles, like the fact that the tracking system isn’t as important as target selection. Anyway, it’s all there. With not much help or comments as usual  .
Clicking the mouse will launch a few [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/missiles3.JPG" rel="shadowbox"><img src="http://messy-mind.net/blog/wp-content/uploads/2007/10/missiles3.thumbnail.JPG"/></a></p>
<p>Another bit of deliciousness from my GM folder. I made it after watching Battlestar Galactica. I learned a lot about homing missiles, like the fact that the tracking system isn’t as important as target selection. Anyway, it’s all there. With not much help or comments as usual <img src='http://www.messy-mind.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> .</p>
<p>Clicking the mouse will launch a few missiles in concert. Their super cool advanced AI will have each pick a target which can be hit in the least amount of time, and avoid designating more than one missile per target unless there are more missiles launched than targets to pick from. After that a tracking algo kicks in which simulates a limited amount of fuel which is used up by turning. The tracking algo is deadly efficient and predicts where the target is going to be. If the missile runs out of fuel before hitting, it’ll just keep flying in a straight line. If its target is destroyed by another missile, it’ll intelligently try to pick another target which its most likley to be able to hit. Not only is this a good demo to learn from, it’s also good for actually putting ideas to a test. With a bit of work you can make a much larger room and spawn a lot more enemies and have it launch missiles automatically. What you’ll end up with is an equilibirum of targets being spawned and shot down. As you tweak the AI the number of targets onscreen at any time will go down if you made a good change or up if it was a bad one.</p>
<p>Oh and if you haven&#8217;t realized, the ribbon trails here are the same ones as you&#8217;ll find in my ribbon trail sample. Only, that one is nice and commented and stuff.</p>
<p><a TITLE="Fire Ze Missiles!" HREF="http://messy-mind.net/blog/wp-content/uploads/2007/10/missiles.gmk">Fire Ze Missiles!</a><br />
<a TITLE="Compiled EXE version" HREF="http://messy-mind.net/downloads/missiles.zip">Compiled EXE by popular demand.</a></p>
<img src="http://www.messy-mind.net/?ak_action=api_record_view&id=40&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.messy-mind.net/2007/advanced-seeking-missiles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shockwave</title>
		<link>http://www.messy-mind.net/2007/shockwave/</link>
		<comments>http://www.messy-mind.net/2007/shockwave/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 22:57:53 +0000</pubDate>
		<dc:creator>GearGOD</dc:creator>
				<category><![CDATA[Game Maker]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[eyecandy]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://messy-mind.net/blog/?p=36</guid>
		<description><![CDATA[This is a little distorting shockwave effect. You might remember it from my very impressive Kill Catalyst screenshots on 64digits.  It&#8217;s not quite so impressive in the demo, but if tweaked a bit and used right, will be awesome.
Shockwaves

]]></description>
			<content:encoded><![CDATA[<p><a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/shock.jpg" rel="shadowbox[post-36];player=img;" ><img src="http://messy-mind.net/blog/wp-content/uploads/2007/10/shock.thumbnail.jpg"/></a><br />
This is a little distorting shockwave effect. You might remember it from my very impressive Kill Catalyst screenshots on 64digits.  It&#8217;s not quite so impressive in the demo, but if tweaked a bit and used right, will be awesome.</p>
<p><a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/shock-ring.gm6" title="Shockwaves">Shockwaves</a></p>
<p><a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/shock-ring.gm6" title="Shockwaves"></a></p>
<img src="http://www.messy-mind.net/?ak_action=api_record_view&id=36&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.messy-mind.net/2007/shockwave/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Distorting Energy Beams</title>
		<link>http://www.messy-mind.net/2007/distorting-energy-beams/</link>
		<comments>http://www.messy-mind.net/2007/distorting-energy-beams/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 22:51:51 +0000</pubDate>
		<dc:creator>GearGOD</dc:creator>
				<category><![CDATA[Game Maker]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[eyecandy]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://messy-mind.net/blog/?p=33</guid>
		<description><![CDATA[
This is really neat. It&#8217;s a few things in one. First and foremost it handles linear screenspace distortions. We&#8217;ve done shockwave rings, but lines turned out to be a bit more tricky. This shows two methods of doing it. One very pretty but slow one by creating several point distortions, and one fast but less [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/beams.jpg" rel="shadowbox[post-33];player=img;"><img src="http://messy-mind.net/blog/wp-content/uploads/2007/10/beams.thumbnail.jpg"/></a><br />
<a class="hidden" href="http://messy-mind.net/blog/wp-content/uploads/2007/10/distortion.png" rel="shadowbox[post-33];player=img;"></a><br />
This is really neat. It&#8217;s a few things in one. First and foremost it handles linear screenspace distortions. We&#8217;ve done shockwave rings, but lines turned out to be a bit more tricky. This shows two methods of doing it. One very pretty but slow one by creating several point distortions, and one fast but less pretty one with a few quads. It also shows how to do lightning that follows a linear path, and how to go about making awesome energy beams in general.</p>
<p>As with must stuff coming out of my GM folder, there&#8217;s no help file or explanations. If you want to use this, you&#8217;re going to have to pull it out yourself.</p>
<p><a href="http://messy-mind.net/blog/wp-content/uploads/2007/10/linear-distortion.gmk">Linear distortion</a></p>
<img src="http://www.messy-mind.net/?ak_action=api_record_view&id=33&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.messy-mind.net/2007/distorting-energy-beams/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Textured ribbon trails</title>
		<link>http://www.messy-mind.net/2007/textured-ribbon-trails/</link>
		<comments>http://www.messy-mind.net/2007/textured-ribbon-trails/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 14:25:29 +0000</pubDate>
		<dc:creator>GearGOD</dc:creator>
				<category><![CDATA[Game Maker]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[eyecandy]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://messy-mind.net/blog/?p=19</guid>
		<description><![CDATA[Ribbon trails are very pretty if used right. In fact even if used wrong they&#8217;re still pretty most of the time. I don&#8217;t know why no one has done this before. I saw scripts that drew them with circles which gets slow or ugly if you go fast, and with lines, which is limited to [...]]]></description>
			<content:encoded><![CDATA[<p><img ALT="ribbons" SRC="http://messy-mind.net/blog/wp-content/uploads/2007/10/trails.jpg" /></p>
<p>Ribbon trails are very pretty if used right. In fact even if used wrong they&#8217;re still pretty most of the time. I don&#8217;t know why no one has done this before. I saw scripts that drew them with circles which gets slow or ugly if you go fast, and with lines, which is limited to 1px in width. The obvious thing to do of course is to use a primitive.<br />
So we make a list containing coords of where we&#8217;ve been for the past N steps, and then draw it. I&#8217;m not going to explain the intricacies of the drawing script but everything is very straightforward and you shouldn&#8217;t have problems figuring out how to use it.</p>
<p>When doing mouse decorations or trails, never have them snap to the mouse position! The mouse is a precise input device which is good most of the time but in the land of eyecandy it means jerky, ugly movements. Instead have the decoration follow slowly as I do here. It makes a world of difference.</p>
<p><a TITLE="Ribbon trails" HREF="http://messy-mind.net/blog/wp-content/uploads/2007/10/trails.gmk">Ribbon trails</a></p>
<img src="http://www.messy-mind.net/?ak_action=api_record_view&id=19&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.messy-mind.net/2007/textured-ribbon-trails/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

