Planet surface rendering info
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1365 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
Planet surface rendering code
|
||||
--------------------------------------------------------------
|
||||
|
||||
The way the planets appear on the screen (based on planet type
|
||||
definition in plandata.c) is determined by several factors:
|
||||
|
||||
1. Topography algorithm (PlanetFrame.Type)
|
||||
2. Color map (PlanetFrame.CMapInstance)
|
||||
3. Elevation -> colormap index xlat table (PlanetFrame.XLatTabInstance)
|
||||
4. Base elevation (PlanetFrame.base_elevation)
|
||||
5. Several others not covered here: faults, craters (blemishes)
|
||||
|
||||
First, the planet topography is generated according to the algorithm
|
||||
selected for the planet: TOPO_ALGO, CRATERED_ALGO, GAS_GIANT_ALGO.
|
||||
TOPO_ALGO and CRATERED_ALGO use a fractal algorithm to pseudo-randomly
|
||||
generate a surface, then 'craters' are added and, at the end, the map is
|
||||
dithered for CRATERED_ALGO. GAS_GIANT_ALGO is of course different
|
||||
because it needs to produce a series of ring-like structures with
|
||||
'storms' added at the end.
|
||||
|
||||
The topographical map is a rectangle with each pixel representing an
|
||||
elevation level relative to 0, so the topography is expressed in terms
|
||||
of elevation relative to base elevation. Base elevation is applied to
|
||||
the generated map.
|
||||
|
||||
At this point, the elevation levels are translated to the actual colors
|
||||
using the xlat table and color map. First, the elevation is translated
|
||||
to an index into the colormap using the xlat table (.xlt files), and
|
||||
after that, the actual RGB color is drawn from the colormap (.ct files)
|
||||
at this index.
|
||||
|
||||
There are 3 colormaps per instance specified in PlanetFrame. The active
|
||||
colormap is selected from these 3 based on the surface temperature of
|
||||
the planet: cold, normal and hot. The framework is also laid down for
|
||||
3 xlat tables (one per surface temperature), but, AFAIK, distinct xlat
|
||||
tables are never actually used. Currently, there is only 1 xlat table
|
||||
per instance in each file.
|
||||
|
||||
The colormap files (.ct) seem to be in original DOS format. Probably
|
||||
because they do not translate to the CLUT system very well. The colormaps
|
||||
are carefully crafted and synchronized across all planet types to make
|
||||
the entire system function properly.
|
||||
Reference in New Issue
Block a user