<?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>Memory Leak &#187; Aldahar</title>
	<atom:link href="http://chromus.kajigger.com/blog/category/development/aldahar/feed/" rel="self" type="application/rss+xml" />
	<link>http://chromus.kajigger.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 11 Jul 2008 00:45:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Procedural textures; take two</title>
		<link>http://chromus.kajigger.com/blog/2006/03/16/procedural-textures-take-two/</link>
		<comments>http://chromus.kajigger.com/blog/2006/03/16/procedural-textures-take-two/#comments</comments>
		<pubDate>Thu, 16 Mar 2006 15:50:48 +0000</pubDate>
		<dc:creator>chromus</dc:creator>
				<category><![CDATA[Aldahar]]></category>

		<guid isPermaLink="false">http://chromus.kajigger.com/?p=30</guid>
		<description><![CDATA[So, Rick and I came up with a new pseudo-random number distribution:

double random_pow(int power)
{
	double num = 2.0 * rand() / RAND_MAX - 1;
	return (copysign(pow(num, power), num) + 1) / 2;
}

I&#8217;m using the standard C library versions of rand() and RAND_MAX, so this function generates a random number in [0, 1] biased towards 0.5 using the [...]]]></description>
			<content:encoded><![CDATA[<p>So, Rick and I came up with a new pseudo-random number distribution:</p>
<code>
double random_pow(int power)
{
	double num = 2.0 * rand() / RAND_MAX - 1;
	return (copysign(pow(num, power), num) + 1) / 2;
}
</code>
<p>I&#8217;m using the standard C library versions of <code>rand()</code> and <code>RAND_MAX</code>, so this function generates a random number in [0, 1] biased towards 0.5 using the exponent <code>power</code>. I thought it might be useful in making most of my field green but having a few brown or yellow flecks at the end points, but I&#8217;m not sure it worked out correctly. <a class="imagelink" href="wp-content/uploads/aldahar/procedural-grass-texture-1.png" title="Procedural textures: Grass 1">Grass 1</a> and <a href="wp-content/uploads/aldahar/procedural-grass-texture-2.png" title="Procedural textures: Grass 2">Grass 2</a> are my tries using this system. The code for the first one is:</p>
<code>
Color lawn_grass(int x, int y)
{
	static color darkGreen(23, 90, 0);
	static color lightGreen(51, 175, 15);
	static color brown(87, 67, 6);
	color green = clint(darkGreen, lightGreen, rand_double());
	return clint(green, brown, rand_double()).convert();
}
</code>
<p>For the second one, it&#8217;s:</p>
<code>
Color lawn_grass(int x, int y)
{
	static color darkGreen(27, 81, 0);
	staric color lightGreen(75, 150, 25);
	static color brown(90, 97, 16);
	color green = clint(darkGreen, lightGreen, rand_double());
	return clint(green, brown, rand_double()).convert();
}
</code>
<p>Crap. It occurs to me that neither of my grass functions use my <code>random_pow()</code> function. I&#8217;ll have to look around to see if I saved the originals.</p>]]></content:encoded>
			<wfw:commentRss>http://chromus.kajigger.com/blog/2006/03/16/procedural-textures-take-two/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Procedural textures</title>
		<link>http://chromus.kajigger.com/blog/2006/03/15/procedural-textures/</link>
		<comments>http://chromus.kajigger.com/blog/2006/03/15/procedural-textures/#comments</comments>
		<pubDate>Wed, 15 Mar 2006 22:33:36 +0000</pubDate>
		<dc:creator>chromus</dc:creator>
				<category><![CDATA[Aldahar]]></category>

		<guid isPermaLink="false">http://chromus.kajigger.com/wordpress/?p=5</guid>
		<description><![CDATA[Generating an 8192 by 4096 pixel canvas on the fly takes a while, but I&#8217;m putting up with it over and over again to see if I can come up with a good algorithm to make a forest-grass field. The old algorithm created a field that was almost perfect and meshed almost invisibly with our [...]]]></description>
			<content:encoded><![CDATA[<p>Generating an 8192 by 4096 pixel canvas on the fly takes a while, but I&#8217;m putting up with it over and over again to see if I can come up with a good algorithm to make a forest-grass field. The old algorithm created a field that was almost perfect and meshed almost invisibly with our current tiles, but Justin said that it didn&#8217;t have enough brown flecks to represent leaves, so I&#8217;ve been trying something new. <a class="imagelink" href="wp-content/uploads/aldahar/procedural-grass-texture-0.png">This</a> is my first try, but I can&#8217;t remember the color values that I used for the life of me.</p>]]></content:encoded>
			<wfw:commentRss>http://chromus.kajigger.com/blog/2006/03/15/procedural-textures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
