<?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>Skitten &#187; flame</title>
	<atom:link href="http://skitten.org/blog/tag/flame/feed/" rel="self" type="application/rss+xml" />
	<link>http://skitten.org/blog</link>
	<description>Blog for stuff that isn't food, drink or not having a car</description>
	<lastBuildDate>Tue, 20 Jul 2010 05:22:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>My first plugin</title>
		<link>http://skitten.org/blog/2009/06/05/my-first-plugin/</link>
		<comments>http://skitten.org/blog/2009/06/05/my-first-plugin/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 04:01:11 +0000</pubDate>
		<dc:creator>skitten</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[flame]]></category>
		<category><![CDATA[old stuff]]></category>

		<guid isPermaLink="false">http://skitten.org/blog/?p=12</guid>
		<description><![CDATA[My first vfx job was with Smoke &#38; Mirrors in London—I use the word &#8216;job&#8217; in the loosest sense, as they were actually part-sponsoring my doctorate and part of the deal was that they had to employ me for three months over the three years (it was actually more complicated than that, involving a subsidiary that went [...]]]></description>
			<content:encoded><![CDATA[<p>My first vfx job was with <a href="http://smoke-mirrors.com" onclick="pageTracker._trackPageview('/outgoing/smoke-mirrors.com?referer=');">Smoke &amp; Mirrors</a> in London—I use the word &#8216;job&#8217; in the loosest sense, as they were actually part-sponsoring my doctorate and part of the deal was that they had to employ me for three months over the three years (it was actually more complicated than that, involving a subsidiary that went bust, but that&#8217;s a story for another day).</p>
<p>S&amp;M was your typical Soho post-production boutique; five <a href="http://usa.autodesk.com/adsk/servlet/item?siteID=123112&amp;id=10243429" onclick="pageTracker._trackPageview('/outgoing/usa.autodesk.com/adsk/servlet/item?siteID=123112_amp_id=10243429&amp;referer=');">flame</a> suites and a bunch of crazy people rushing around.  Me, fresh-faced post graduate who&#8217;d seen A Bug&#8217;s Life and thought he&#8217;d like to work in computer graphics, is dumped in front of the engineering flame (i.e. unlicensed), handed the thousand page manual and asked to write a rack defocus plugin so that they didn&#8217;t have to buy another copy of a <a href="http://www.genarts.com/product/sapphire/autodesk/features" onclick="pageTracker._trackPageview('/outgoing/www.genarts.com/product/sapphire/autodesk/features?referer=');">commercial one</a>.</p>
<p>The flame API is actually very simple; you effectively get a buffer of pixels in and some parameters then have to produce a buffer of pixels out.  The hard parts were finding my way around the flame interface and working out what a rack defocus is.</p>
<p>I knew enough about optics and image processing to know that there&#8217;s not enough information in the 2d image to do a defocus properly.  So I spent a good while looking at what the commercial plugin did and googling stuff until I hit the in-retrospect obvious key—convolve the image with a kernel the shape of the lens aperture you want to see, and boost the highlights so that they don&#8217;t go flat and disappear when they are blurred.</p>
<p>So to get those nice hexagonal, octagonal and circular <a href="http://en.wikipedia.org/wiki/Bokeh" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Bokeh?referer=');">bokeh</a> effects that people love so much I just needed to write a routine to draw a polygon with the appropriate number of sides into the kernel and then convolve it with the image (after first boosting any pixels above a certain threshold).  For the convolution I converted the image to floating point and used the <a href="http://www.fftw.org" onclick="pageTracker._trackPageview('/outgoing/www.fftw.org?referer=');">FFTW</a> library to do a fourier convolution, and believe me on an old <a href="http://en.wikipedia.org/wiki/SGI_Octane" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/SGI_Octane?referer=');">SGI Octane</a> it was slow.</p>
<p>Sure it&#8217;s simple and everyone knows how to do it, but it was a big deal to me at the time.  And here&#8217;s a little animation I found on my old pc, a still photo of Hong Kong with a foreground matte and animated defocus.</p>
<p><object width="425" height="344" data="http://www.youtube.com/v/pypSxoWbI5g&amp;hl=en&amp;fs=1&amp;rel=0" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/pypSxoWbI5g&amp;hl=en&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://skitten.org/blog/2009/06/05/my-first-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
