Friday, January 05, 2007

Simulating the Large-Scale Structure of the Cosmos

In my previous article, we discussed Perlin Noise and how it can generate textures that seem very natural. In this article, we're going to see how we can use Perlin Noise to generate a convincing image of the large-scale structure of the cosmos.

What is this large scale structure? Wikipedia states:
"In physical cosmology, the term large-scale structure refers to the characterization of observable distributions of matter and light on the largest scales (typically on the order of billions of light-years). Sky surveys and mappings of the various wavelength bands of electromagnetic radiation (in particular 21-cm emission) have yielded much information on the content and character of the universe's structure. The organization of structure appears to follow as a hierarchical model with organization up to the scale of superclusters and filaments. Larger than this, there seems to be no continued structure, a phenomenon which has been referred to as the End of Greatness." - http://en.wikipedia.org/wiki/Large-scale_structure_of_the_cosmos - Jan 5th 2007
These "superclusters" and "filaments" together create a structure that looks like a piece of open-cell foam or nerve cells. For example:



Now if you can remember back to what we discussed about Perlin Noise, when we output a representation of a 2 dimensional slice of it, it looks like a fractal terrain map.


This above image is taken with a $size factor of 42. It isn't very helpful in creating something that has nodes, filaments and voids inbetween. However, your standard Perlin Noise algorithm, like the one we use in this project, returns a value between 1 and -1. This means that there's a 0 in the middle somewhere that occurs regularly, so if we take the absolute value of the noise we get the following:


Which, if you look at the picture of the redshift survey, this looks closer to a negative image. If we flip the noise (1-|noise|) we get the following:


Much closer to what we're after, but still not quite it. Fiddling around with adding in some contrast, we can eventually arrive at a very nice model:


The above image is based off of the quantity of one minus the absolute value of noise to the 8th power (1-|noise|)8. If we zoom out a bit (bringing the $size down to 16) we can see how it mimics the distribution of clusters, filaments, and voids rather well:


Using this noise technique as our base, we can make a very nice looking large-scale structure. Keeping the $size to around 40-ish (I'm rather partial to 42) leaves each [x,y,z] coordinate to the scale of approximately 1 megaparsec.

In the next article, I'll show how we can use this distribution to mimic the appropriate number of galaxies in each megaparsec along with their distribution and a way to display them on the fly through a simple point-and-click web interface. Furthermore, I'll show you how to do it in such a way that it won't cause the PHP script to slow to a grinding halt.

Peace,
-Steve

Labels: , , , , ,

Procedural Universe

Finally, I've decided to get back to the purpose that this blog was originally constructed for and that is generating a procedural universe.

What is a "procedural universe" you may ask? In short, it is a convincing enough representation of a fictional universe that is mathematically defined. This would allow for a computer program to generate an entire universe on the fly, only calculating the pieces you're currently looking at rather than having to construct everything at once and then sift through the data.

Imagine: You're viewing an image of the large scale structure of the cosmos. You click on a cluster of galaxies and you zoom in. You then click on a single galaxy and zoom in to where you can see individual stars. Click on a star, and if there are planets around it, they'll display on the screen. Click on a planet, and you'll be able to walk across its terrain. From there, you could, say, click on a city on the planet's map and zoom in to where you can see individual buildings, and from there, click on individual inhabitants of each building.... Or do it in reverse... Whew. :-)

Many people may say, "Well, isn't that something similar to what Maxis is doing with their new game Spore?" ... Similar, I admit. My work on procedural universes started many years before Spore was announced, and its scope was more confined to how it would help out with traditional "pen and paper" roleplaying games (you know, the kind that actually have a storyteller rather than a computer who tells you what happens). As such, the level and attention to detail that I've been going for is much higher than one would find in your average video game.

In the next two articles I post here, I'll be going over the most important tool towards procedural universe generation known to man: Perlin Noise. I'll then follow it up with how to decently simulate the large-scale structure of the cosmos.

From there, my path is still a bit fuzzy, but I promise I'll incorporate random galaxy generation (from elliptical to spiral to irregular), star generation, planet generation using dole's accretion algorithm and other methods, fractal terrain generation with a section on how to calculate map projections and color schemes, city generation, building generation, and many more.

Peace,
-Steve Caruso

Labels: ,