TRN (FileFormat)

From SWGANH Wiki
Revision as of 14:43, 2 May 2007 by Mugly (Talk | contribs) ('''<font color="orange">????</font>''' - Shader Child)

Jump to: navigation, search

TGEN - Terrain Generator

The rules in the terrain generation system are also referred to as affectors,and
are organized into layers. Boundaries refer to terrain designer- or artist-defined
regions of virtual terrain for which the desired rules have effect. Filters refer 
to conditions to be considered when applying affectors. Layers can be arranged 
in a hierarchy with a parent-child or tree-leaf relationship. Examples of boundaries 
include circles, rectangles, and polygons. Examples of filters include filtering 
by slope, height, shader, direction and fractal. Examples of affectors include 
those that affect height, color, shader, flora, and radial flora. Boundaries, filters 
and layers are described in greater detail below.

The terrain generation system also includes families, which refer to groups of 
assets such as textures, geometry or even algorithms. Families can include children 
with weights. This could involve choosing an asset by selecting a one weighted child. 
For example, this could allow the users to choose a "grass" family for a region, but 
when the terrain system generates the grass family, it can choose one of the children 
of the grass family, which results in the rendering of a single grass shader.

Examples of families include shader families, blend families, flora families, 
radial flora families, and fractal families. Shader families refer to grouping 
shaders for placing textures. Blend families refer to grouping shaders for selecting 
alpha blend masks. Flora families refer to grouping geometry for selecting flora. 
Radial flora families refer to grouping shaders for placing radial flora. 
Fractal families refer to grouping fractals for reuse within different rules.


Terrain generator (form name : TGEN) There are 6 different sections.

- The Shader family          (SGRP)
- The Flora family           (FRGP)
- The Radial Flora family    (RGRP)
- The Environment family     (EGRP)
- The Fractal family         (MGRP)
- The Layers family          (LYRS)

SGRP - Shader Family Group

Shader families refer to grouping shaders for placing textures


It's sub-divied into multiple surface families (SFAM). Each one of them declare mutliple shaders using a surface file.

53 46 41 4D 00 00 00 70 04 00 00 00 66 72 73 74 5F 64 65 63 	SFAM...p....frst.dec
64 5F 72 6F 63 6B 6D 75 64 00 61 62 73 74 72 61 63 74 2F 74 	d.rockmud.abstract.t
65 72 72 61 69 6E 5F 73 75 72 66 61 63 65 2F 68 61 72 64 64 	errain.surface.hardd
69 72 74 2E 69 66 66 00 C7 AA 83 00 00 00 40 00 00 80 3F 02 	irt.iff.............
00 00 00 64 69 72 74 5F 72 6F 63 6B 6D 75 64 00 00 00 20 41 	...dirt.rockmud....A
64 69 72 74 5F 72 6F 63 6B 6D 75 64 5F 61 31 00 00 00 A0 40 	dirt.rockmud.a1.....

Here its declares 2 shaders: dirt.rockmud, dirt.rockmund.a1 using abstract/terrain_surface/harddirt.iff


FGRP - Flora Family Group

Flora families refer to grouping geometry -apt files- for selecting flora. (Select flora group properties, including flora family data)

Each one of them decalre one flora group using multiple appearance files.

46 46 41 4D 00 00 01 CE 01 00 00 00 47 72 61 6E 69 74 65 20 	FFAM........Granite.
52 6F 63 6B 73 31 00 00 80 FF 00 00 80 3F 00 00 00 00 07 00 	Rocks1..............
00 00 72 6F 63 6B 5F 67 72 61 6E 69 74 65 73 6C 61 62 5F 6C 	..rock.graniteslab.l
61 72 67 65 2E 61 70 74 00 00 00 80 3F 00 00 00 00 0A D7 23 	arge.apt............
3C CD CC CC 3D 01 00 00 00 00 00 00 00 00 00 80 3F 00 00 80 	....................
                        [...]                                           [...]
00 00 80 3F 00 00 80 3F 72 6F 63 6B 5F 67 72 61 6E 69 74 65 	........rock.granite
73 6C 61 62 5F 73 6D 61 6C 6C 5F 61 31 2E 61 70 74 00 00 00 	slab.small.a1.apt...
A0 40 00 00 00 00 0A D7 23 3C CD CC CC 3D 01 00 00 00 00 00 	....................
00 00 00 00 80 3F 00 00 80 3F 	                                 ..........

Here it declares a group named 'Granite.Rocks1' wich contains graniteslab of different sizes.

???? - Flora Child

Select flora child rule properties, including flora family name, child weight data, swaying displacement and period, scaling min/max value.

RGRP - Radial Flora Family Group

Radial flora families refer to grouping shaders for placing radial flora.

52 46 41 4D 00 00 00 FB 01 00 00 00 62 61 73 65 20 67 72 61 	RFAM........base.gra
73 73 6C 61 6E 64 73 00 FB D7 8C 00 00 80 3F 04 00 00 00 72 	sslands............r
61 64 6C 5F 67 72 61 73 73 5F 79 65 6C 6C 6F 77 00 00 00 80 	adl.grass.yellow....
3F 00 00 20 41 00 00 80 3F 66 66 E6 3F 01 00 00 00 14 AE C7 	....A....ff.........
3E CD CC 4C 3E 01 00 00 00 00 00 00 00 72 61 64 6C 5F 66 6C 	...L.........radl.fl
6F 77 5F 6A 65 62 77 61 00 CD CC CC 3D 00 00 A0 41 00 00 00 	ow.jebwa........A...
3F 00 00 40 3F 01 00 00 00 8F C2 F5 3D EC 51 38 3E 01 00 00 	..............Q8....
00 00 00 00 00 72 61 64 6C 5F 67 72 61 73 73 5F 79 65 6C 6C 	.....radl.grass.yell
6F 77 5F 61 31 00 00 00 80 3F 00 00 A0 41 00 00 80 3F 66 66 	ow.a1........A....ff
E6 3F 01 00 00 00 9A 99 99 3E 29 5C 8F 3E 01 00 00 00 00 00 	....................
00 00 72 61 64 6C 5F 66 6C 6F 77 5F 73 74 61 72 66 6C 6F 77 	..radl.flow.starflow
65 72 00 CD CC 4C 3D 00 00 20 41 9A 99 19 3F CD CC 4C 3F 01 	er...L....A......L..
00 00 00 9A 99 19 3E CD CC 4C 3E 01 00 00 00 01 00 00 00 	    .........L.........

???? - Radial Child

(Select Radial child rule properties, including family name data, child weight, distance, width and height data, and swaying displacment and period data.)

EGRP - Environment Family Group

Declares the environement

45 46 41 4D 44 41 54 41 00 00 00 19 01 00 00 00 74 61 61 6E 	EFAMDATA........taan
61 62 5F 67 6C 6F 62 61 6C 00 FF FF 00 00 00 80 3F 	        ab.global........

MGRP - Fractal Family Group

Fractal families refer to grouping fractals for reuse within different rules. It's sub-divied into multiple groups (MFAM). Each one of them declare a labelled fractal.

4D 46 41 4D 44 41 54 41 00 00 00 27 01 00 00 00 2E 30 30 31 	MFAMDATA.........001
35 5F 6F 63 74 31 5F 6E 62 69 61 73 5F 42 61 73 65 52 6F 6C 	5.oct1.nbias.BaseRol
6C 69 6E 67 48 65 69 67 68 74 00 46 4F 52 4D 00 00 00 4C 4D 	lingHeight.FORM...LM
46 52 43 46 4F 52 4D 00 00 00 40 30 30 30 31 44 41 54 41 00 	FRCFORM....0001DATA.
00 00 34 A0 11 00 00 00 00 00 00 79 E9 E6 3E 00 00 00 00 00 	..4........y........
00 80 3F 01 00 00 00 C1 CA 61 40 FC A9 71 3D A6 9B C4 3A FA 	.........a...q......
ED EB 3A 00 00 00 00 00 00 00 00 00 00 00 00 	                ...............

This one decalres a fractal labeled 'oct1.nbias.BaseRolling Height' TODO: Add fractal notes here.

LYRS - Layers

Layers & Affectors

Basically the role of layers is to affect the data contained in the different families. They can contain any number of other sub-layers. Their order is important.

Trn layers.jpg

A layer deals with the families trough Affectors. There are different types of them, each one has it's own role. Can have Affector for texturing, flora, areas...

Boundaries, filters, and affectors can be defined in layers and sublayers,
such that a single location in the terrain can have multiple terrain rules.
A layer without boundaries (or filters) is "unbounded," and can affect as much
as the entire landscape. A layer with a boundary allows the affectors in the
layer and sublayers to be applied to the region specified by the boundary.

Affectors

Boundaries
BREC Boundary Rectangle Delimits a rectangle using 4 float: X1, Y1, X2, Y2 (Select rectangle boundary rule properties, including feathering distance, boundary left/right and near/far coords and local water table height, shader and sahder size.)
BCIR Boundary Circle Delimits a circle using 3 float: Xo, Yo, Radius (Select circle boundary rule properties, including feathering distance, boundary center coords, and boundary radius.)
BPOL Boundary Polygon Delimits a n-sided closed polygon area using 2 floats (Xo,Yo) for each point. (Select polygon boundary rule properties, includibng feathering distance and including local water table height, shader and shader size.)
BPLN Boundary PolyLine Delimits a n-sided line area using 2 floats (Xo,Yo) for each point and a float for the width. (Select polyline boundary rule properties, including feathering distance and width.)
ACCN Affector Color Constant Select color for rule.


Texture / Shaders Affectors
ASCN Affector Shader Constant Affect a shader using the family_id and the shader_id this family. (Select rule shader and family and feathering parameters.)
ASCR Affector Shader Replace Replace a shader with another shader (Select rule shader replace families, including source family (the family to be replaced), destination family (the family to replace with), and feathering parameters.)
FSHD Filter Shader Select filter shader rule properties, including shader family.


Terrain Affectors
AHCN Affector Height Constant Raises or lowers the ground using float for delta and float(scalar?) for slope-smooting. (Select terrain height value for rule.)
AHFR Affector Height Fractal Raises or lowers the ground irregulary using a fractal type from the Fractal Family.Float for delta and float(scalar?) (Select terrain height value for rule for fractal family.)
AHFT Affector Height Terrace Select terrace height and flat ratio values for rule. (Select terrance height and flat ratio values for rule.)


Flora Affectors
AFSC Affector Flora Static Collidable Sets the amount of collidable flora. (Select to add/remove flora, specify flora tpe and set flora density for static collidable flora.)
AFSN Affector Flora Static Non-Collidable Sets the amount of Non-collidable flora. (Select to add/remove flora, specify flora tpe and set flora density for static non-collidable flora.)
AFDN Affector Flora Dynamic Near I don't know much about those yet. Seems like they change the near/far radial displaying. They're often coupled to the flora affectors, for instance when cleaning an area for a city. (Select to add/remove flora, specify flora type and set flora destiny for dynamic near flora.)
AFDF Affector Flora Dynamic Far (Select to add/remove flora, specify flora type and set flora destiny for dynamic far flora.)
Radials
AFDF Affector Radial Far Constant This one shows up on the Patent App (same as Affector Flora Dynamic Far).


Unknown
AENV Environment Select enviroment group rule properties.
???? Filter Direction Select filter direction rule properties, including feathering distance, and min and max angle settings for filter setting to have effect.
FFRA Filter Fractal Delimits an area generated by a 2d fractal on the ground. (Select filter fractal rule properties incuding fractal family, low and high fractal settings and feathering distance.)
FHGT Filter Height Select filter height rule properties, including feathering, distance, filter low height, and filter high height.
FSLP Filter Slope Select filter slope rule properties, including feathering distance, filter min angle, and filter max angle.
AEXC Affector Exclude This one shows up on the Patent App.
AROA Affector Road Select road rule properties, including width, shader, feathering height distance, and feathering shader distance.
???? Affector River Select river rule properties, including width, trench depth, flow velocity, bank and bottom shaders, water shader, water depth, water width, feathering distance.
ACRF Affector Color Ramp Fractal Select rule family and color ramp.
ACRH Affector Color Ramp Height Select rule color ramp and height low/high values.

Example


1. Layer

    a. AffectorHeightConstant, 10

    b. AffectorShaderConstant, Rock

2. Layer

    a. BoundaryCircle, x=500, y=500, r=500, feather=InOut

    b. AffectorHeightConstant, 0

    c. AffectorShaderConstant, Mud

    d. Layer

        i. FilterHeightmin=13,max=17

        ii. AffectorColorConstant, BLACK

3. Layer

    a. BoundaryRectangle, min=-500, -500, max=500, 500

    b. AffectorFloraStaticCollidableConstant, Conifer

    c. AffectorFloraDynamicNearConstant, Dead grass

Description

Using the example rules listed above, the corresponding rule 
description can perform the following:

1. Set the height of the terrain everywhere to 10 meters(1a) and assign the rock shader(1b). 

2. Then, in a 500 meter circle(2a) originating from coordinates (500, 500),
gradually decrease the height from 10 meters to 0 meters(2b), place the mud shader(2c),
and create a black band where the height of the terrain at a given sample point is between 13 and 17 meters.(2d, 2di, 2dii) 

3. Finally, in a rectangle(3a) from coordinates (-500, -500) to (500, 500), place 
conifer trees(3b) and dead grass(3c) within the rectangle.