<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>General discussion. (new posts)</title>
		<link>http://pcg.wikidot.com/forum/c-42082/general-discussion</link>
		<description>Posts in the forum category &quot;General discussion.&quot; - General discussion about game development and PCG techniques.</description>
				<copyright></copyright>
		<lastBuildDate></lastBuildDate>
		
					<item>
				<guid>http://pcg.wikidot.com/forum/t-79282#post-487519</guid>
				<title>multiplicative cascades(ish): Re: multiplicative cascades(ish)</title>
				<link>http://pcg.wikidot.com/forum/t-79282/multiplicative-cascades-ish#post-487519</link>
				<description></description>
				<pubDate>Fri, 22 May 2009 18:51:46 +0000</pubDate>
				<wikidot:authorName>droid</wikidot:authorName>				<wikidot:authorUserId>171383</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Another image, actually I found it almost a year ago, just havent posted it yet. I was searching for something else, and a typo gave this. Looks kinda cool.<br /> <a href="http://pcg.wdfiles.com/local--files/pcg-algorithm:fractal/marrowlike" >marrowlike</a></p> <p>Starting with a black pixel, the following function is applied to each pixel:</p> <div class="code"> <pre> <code>#value is the value of the current pixel, 0 to 255 #n_per_level is how many subdivisions per step #x is a random value between 0 and 1, straight out of the random number generator def foo(value,n_per_level,x): v = value/255. if v &gt; 1./n_per_level**2: v = 1+math.log(v,4) return int(255 * v + .5) else: return int(255 * x + .5)</code> </pre></div> <br /> The resulting image is then doubled in size (or scaled by n_per_value, that is usually 2) by linear interpolation. <p>These two steps are repeated until the image is large enough. I cropped the output image to yield my desktop resolution.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://pcg.wikidot.com/forum/t-79282#post-250241</guid>
				<title>multiplicative cascades(ish): Re: multiplicative cascades(ish)</title>
				<link>http://pcg.wikidot.com/forum/t-79282/multiplicative-cascades-ish#post-250241</link>
				<description></description>
				<pubDate>Mon, 01 Sep 2008 08:43:43 +0000</pubDate>
				<wikidot:authorName>andrewdoull</wikidot:authorName>				<wikidot:authorUserId>125736</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I see you figured out that wikidot does image hosting (to an extent)… thanks for the code.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://pcg.wikidot.com/forum/t-79282#post-234079</guid>
				<title>multiplicative cascades(ish): multiplicative cascades(ish)</title>
				<link>http://pcg.wikidot.com/forum/t-79282/multiplicative-cascades-ish#post-234079</link>
				<description></description>
				<pubDate>Mon, 04 Aug 2008 19:12:02 +0000</pubDate>
				<wikidot:authorName>droid</wikidot:authorName>				<wikidot:authorUserId>171383</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I was looking at <a href="http://en.wikipedia.org/wiki/Multiplicative_Cascade">multiplicative cascades</a> and thinking of a method from "the fractal geometry of nature" by BB Mandelbrot. I would like a way of generating a set of points that have a certain dimension and lacunarity, and remember something similar to this in the book. This is the closest I can come up with.</p> <p>The basic idea is to divide the unit square into a grid and randomly choose squares from it, the probability for each square being determined by dimension d:</p> <span class="equation-number">(1)</span> <div class="math-equation" id="equation-20572-1"><img src="http://pcg.wikidot.com/local--math/eqs/b960ad52009967a56d56c5805db91ca2.png" alt="n ^ d/n ^ 2" /></div> <p>This is done recursively for each square selected.<br /> The only way of varying the lacunarity that I can remember is to use finer grids per step (n). If anyone has a better way of doing this, let me know.</p> <p>Also, is there a good definition of lacunarity? I think it was described as proportional to the maximum circle that could fit in the gaps and that doesn't contain any points of the set (averaged across all possible seeds for generating the set).</p> <p>I would attach an output image (and add it to <a href="http://pcg.wikidot.com/pcg-algorithm:fractal">Fractal</a> to illustrate dimension), but I do not have a flikr account.</p> <p>Python, with <a href="http://www.pythonware.com/library/pil/handbook/image.htm">Python Image Library</a> for image stuff:</p> <div class="code"> <pre> <code>import random import math import PIL.Image import PIL.ImageFilter #seed the random generator for repeatable output seed = 42 rng = random.Random(seed) def expand(image, dimension, n_per_level=2): '''expand the image by n_per_level, adding detail ''' p_per_pixel = (n_per_level ** dimension)/(n_per_level ** 2) #note: using a filter when scaling (such as BILINEAR or BICUBIC) removes # artifacts along division edges, if care is taken the output is seamless and tileable. # for the sake of brevity, these are removed. #scale the image output = image.resize( (image.size[0]*n_per_level, image.size[1]*n_per_level)) #add detail pixels = output.load() for i in range(output.size[0]): for j in range(output.size[1]): #black are the points of the set value = 1 - pixels[i,j] / 255. p = p_per_pixel * value if rng.random() &lt; p: pixels[i,j] = 0 else: pixels[i,j] = 255. return output #start with one black pixel, greyscale image image = PIL.Image.new('L',(1,1)) dimension = 1.5 #expand the image 'till it's big enough while image.size[0] &lt; 1024: image = expand(image, dimension) image.show() image.save('fractal%d_%d.png' % (dimension*100,seed))</code> </pre></div> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>