Difference between revisions of "User:Zeracles/Background"

From Ultronomicon
Jump to navigation Jump to search
Line 2: Line 2:
 
All of these codes are written in matlab, and I can probably run them for you if you like.
 
All of these codes are written in matlab, and I can probably run them for you if you like.
 
=Generating Point Distributions=
 
=Generating Point Distributions=
 +
*[[User:Zeracles/Background/Code/Structures|Code]]
 +
==Description==
 +
This creates three-dimensional structures made of discrete points.
 +
The available structures are single points, gaussians, hard-edged spheres, sheets / discs and filaments.
 +
Their properties (density, scale size, position) are input via a text file (called ``structureproperties") with the format listed in the code.
 +
 +
I'd also like to add the fractal generator to this at some point, not sure when I'll get around to it.
 +
 
=Stars=
 
=Stars=
 
*[[User:Zeracles/Background/Code/Stars|Code]]
 
*[[User:Zeracles/Background/Code/Stars|Code]]

Revision as of 03:56, 17 September 2009

This is some procedurally generated art I worked on for Dragon's SC1 remake. All of these codes are written in matlab, and I can probably run them for you if you like.

Generating Point Distributions

Description

This creates three-dimensional structures made of discrete points. The available structures are single points, gaussians, hard-edged spheres, sheets / discs and filaments. Their properties (density, scale size, position) are input via a text file (called ``structureproperties") with the format listed in the code.

I'd also like to add the fractal generator to this at some point, not sure when I'll get around to it.

Stars

Code Description

A number of things get set through lines 6-42.

  • n = number of points for the smoothing
  • resolution = a smaller number here means more detail
  • xmin, etc. = set image dimensions
  • spokethreshold = fraction of stars without spokes. To smooth without spokes, set spokethreshold=1
  • spokes = number of spokes
  • anglemagnificationbase, anglemagnificationindex, anglecutoffradiusfactor = stuff to mess with the spokes on the stars
  • xposns, yposns = random points to be smoothed . . . comment these out to import a set of one's choosing

All the action is in the nested for loop, lines 44-102. An image is generated for each point in the distribution (for i=...), and all these images are added together. Lines 68-93 actually calculate the pixel value, littlexgaussiancontribution. The condition at 75 says if a pixel is sufficiently far from the position of the point being smoothed, make its pixel value zero because it will be awfully close to zero anyway. Else, line 79 calculates the pixel value for a gaussian (a different function could easily be substituted here). If this star is going to have spokes (a fate determined by lines 20, 57 and 59), lines 81-90 modify the gaussian into something stellar. This is done by making the pixel value a function of angle, multiplying it by an angle-dependent variable, anglemagnification on line 86. The pixel value is thus modified on line 90.

Nebulae