Once I get that upgrade to 36-hour days, I will tackle that. – Mychaeel

Legacy:T3D Brush

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

A T3D Brush is geometry information contained into [T3D Files].

The following actors used as brushes in T3D files:

Actor structure[edit]

Begin Actor Class=Brush Name=Brush0
    Begin Brush Name=Brush
       Begin PolyList
          Begin Polygon Item=OUTSIDE Texture=black1 Flags=4194304 Link=0
             Origin   -00160.000000,+00000.000000,+00128.000000
             Normal   +00000.000000,+00000.000000,+00001.000000
             TextureU +00004.000000,+00000.000000,+00000.000000
             TextureV +00000.000000,+00004.000000,+00000.000000
             Vertex   -00128.000000,-00128.000000,+00128.000000
             Vertex   +00128.000000,-00128.000000,+00128.000000
             Vertex   +00128.000000,+00128.000000,+00128.000000
             Vertex   -00128.000000,+00128.000000,+00128.000000
          End Polygon
       End PolyList
    End Brush
End Actor
  • MainScale: scales up or down current brush before make it rotate.
  • PostScale: scales up or down current brush after make it rotate.
  • TempScale: unknown effect
  • Location: where the brush is located in the map
  • Rotation: contains up to 3 values
    • Roll: X axis rotation
    • Pitch: Y axis rotation
    • Yaw: Z axis rotation
  • Begin Polygon Item=OUTSIDE Texture=black1 Flags=4194304 Link=0
    • Texture: texture applied to the current polygon with formatted string.
      • [TextureName] for Unreal 1 / Unreal Tournament maps
      • [PackageName.TextureName] for other UTx games.
    • Origin: where the texture is centered
    • Normal: normally, the perpendicular vector of the surface where the texture is applied
    • Texture U,V: contains information about scaling and texture rotation
    • PanU,PanV: only used in Unreal Tournament and Unreal 1. Changes the texture origin coordinates.
    • Vertex: X,Y,Z coordinates of the specified vertex

Note: NumTriangles = NumVertices-Floor(NumVertices/3)


Loading T3D brush geometry[edit]

You must parse those informations correctly: PrePivot, Location, Rotation, MainScale, PostScale, TempScale, Polygon / Vertexes

FOR each vertex of each polygon of parsed brush DO:
   do MainScale ... x *= MainScale[x], y *= MainScale[y], z *= MainScale[z]
   do translation (-PrePivot[x], -PrePivot[y], -PrePivot[z])
   do rotation Yaw, Pitch, Roll
   do PostScale ... x *= PostScale[x], y *= PostScale[y], z *= PostScale[z]
   do TempScale ... x *= TempScale[x], y *= TempScale[y], z *= TempScale[z]
   do translation (Location[x], Location[y], Location[z])

Note: For Unreal Engine 3.x based maps (Unreal Tournament 2004 and 2003),PostScale,MainScale,TempScale and Rotation values are always null as the editor automatically updates vertices,origin and normal values when scaling up/down or rotating a brush.

Rotation matrix are the following:

Roll Matrix-X Axis:
1, 0, 0, 0,
0, cos(roll),-sin(roll), 0,
0, sin(roll),cos(roll), 0,
0, 0, 0, 1
Pitch Matrix-Y Axis:
cos(pitch), 0, sin(pitch), 0,
0, 1, 0, 0,
-sin(pitch), 0,cos(pitch), 0,
0, 0, 0, 1)
Yaw Matrix-Z Axis:
cos(yaw), sin(yaw), 0, 0,
-sin(yaw), cos(yaw), 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
Global Rotation Matrix=(Roll Matrix)*(Pitch Matrix)*(Yaw Matrix)

Yaw, Roll and Pitch values are in radians. Original values from t3d files are in "Unreal format" where 2 pi rads = 65536. For more information about Yaw, Pitch, Roll rotation matrix see http://mathworld.wolfram.com/EulerAngles.html.

Scaling up/down brushes[edit]

This operation is mainly needed when you want to port Unreal 1 or Unreal Tournament map to Unreal Tournament 2004 or Unreal Tournament 3.

To do so,considering ScaleFactor:

set Location = ScaleFactor*Location
set PrePivot = ScaleFactor*PrePivot
For each polygon
    set Origin = ScaleFactor*Origin
    For each vertex
      set Vertex = ScaleFactor*Vertex

Usually scale factor values: Unreal 1/Unreal Tournament to UT2003/UT2004/UT3: 1.25