I don't need to test my programs. I have an error-correcting modem.
Difference between revisions of "Legacy:T3D Brush"
(→Scaling up/down brushes) |
m (Adding extra info about PanU,PanV) |
||
Line 49: | Line 49: | ||
**Normal: normally, the perpendicular vector of the surface where the texture is applied | **Normal: normally, the perpendicular vector of the surface where the texture is applied | ||
**Texture U,V: contains information about scaling and texture rotation | **Texture U,V: contains information about scaling and texture rotation | ||
− | **PanU,PanV: only used in Unreal Tournament and Unreal 1 | + | **PanU,PanV: only used in Unreal Tournament and Unreal 1. Changes the texture origin coordinates. |
**Vertex: X,Y,Z coordinates of the specified vertex | **Vertex: X,Y,Z coordinates of the specified vertex | ||
Revision as of 01:35, 15 October 2009
A T3D Brush is geometry information contained into [T3D Files].
The following actors used as brushes in T3D files:
Actor structure
Begin Actor Class=Brush Name=Brush0 MainScale=(SheerAxis=SHEER_ZX) PostScale=(Scale=(X=0.250000,Y=8.000000,Z=3.000000),SheerAxis=SHEER_ZX) TempScale=(Scale=(X=0.250000,Y=8.000000,Z=3.000000),SheerAxis=SHEER_ZX) Level=LevelInfo'Entry.LevelInfo0' Tag=Brush Region=(Zone=ZoneInfo'Entry.ZoneInfo0',iLeaf=1,ZoneNumber=1) Location=(X=464.000000,Y=-16.000000,Z=64.000000) Rotation=(Yaw=49152) 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 Brush=Model'Entry.Brush' Name=Brush0 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
- Texture: texture applied to the current polygon with formatted string.
Note: NumTriangles = NumVertices-Floor(NumVertices/3)
Loading T3D brush geometry
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]) ENDFOR
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 rad = 65536. For more information about Yaw, Pitch, Roll rotation matrix see http://mathworld.wolfram.com/EulerAngles.html.
Scaling up/down brushes
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
Tools
- Python T3D loader (doesn't care about texture informations): http://carolina.mff.cuni.cz/~gib/ut_utils/unreal_t3d_loader.zip see readme.txt in zip file
- MapScale scales an entire .t3d file (only works for UT/U1 maps)