TriColl #106
Replies: 9 comments 9 replies
-
RoyalBlue in the Northstar Discord recently figured out struct TricollTriangle {
uint32_t A: 10; // indexes header.first_vertex + A
uint32_t B: 7; // indexes header.first_vertex + A + B
uint32_t C: 7; // indexes header.first_vertex + A + C
uint32_t flags: 8; // tracks a lot of state. e.g. longest axis, orientation
} Flags will probably take lots of visualising & cataloguing to pin down |
Beta Was this translation helpful? Give feedback.
-
@r-ex provided structs a while back identifying TricollHeaderstruct TricollHeader {
int16_t flags; // always 0?
int16_t texture_flags; // copy of flags from indexed TextureData
int16_t texture_data; // TextureData; surfaceproperty for sounds & texture for decals / impact fx
int16_t num_vertices; // number of Vertices
int16_t num_triangles; // number of TricollTriangles
int16_t num_bevel_indices; // number of TricollBevelIndices (unsure of format & purpose)
int32_t first_vertex; // added TricollTriangle.A etc. to calculate indices into Vertices
int32_t first_triangle; // first TricollTriangle
int32_t first_node; // first TricollNode; search the tree until it terminates?
int32_t first_bevel_index; // first TricollBevelIndex
Vector origin; // ??? copied from misc_model?
float scale; // ??? copied from misc_model?
}; TricollNodestruct TricollNode {
struct { int16_t x, y, z; } mins;
struct { int16_t x, y, z; } maxs; // doesn't look like origin & extents
int16_t unknown[2]; // indexed children w/ -ve indices for leaves/triangles?
}; size derived from Footnotes
|
Beta Was this translation helpful? Give feedback.
-
Interesting PatternsThe first When looking for a Mesh w/ the same tris as a TricollHeader, I noticed not every MaterialSort is indexed by Meshes >>> sorted({m.material_sort for m in box.MESHES})
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 25, 27, 28]
>>> len(box.MATERIAL_SORT)
29 NVM I found some >>> box.TRICOLL_HEADERS[0].texture_data, box.TEXTURE_DATA_STRING_DATA[box.TEXTURE_DATA[11].name_index]
(11, 'WORLD\\DEV\\WEAPON_RANGE_TARGET')
>>> [i for i, ms in enumerate(box.MATERIAL_SORT) if ms.texture_data == 11]
[9, 10]
>>> [i for i, m in enumerate(box.MESHES) if m.material_sort in (9, 10)]
[9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27] |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Tricoll crashes in ported maps (r1 -> r2) seems to happen in a function that looks up Tricoll bevels |
Beta Was this translation helpful? Give feedback.
-
Earls' Extreme SIMD References12 Footnotes
|
Beta Was this translation helpful? Give feedback.
-
Cleaned up snippet of a // data collection
low_11_bits = v70 & 0x7FF;
bitsRead += 11; bevelReadData.buffer = bevelReadData.buffer >> 11;
if (bitsRead >= 32) { // need more data?
bevelReadData.buffer |= static_cast<uint64_t>(lumpCursor->val) << (64 - bitsRead);
bevelReadData.bitsReadFromBuffer = bitsRead - 32;
lumpCursor++; bevelReadData.fillBuffer = &lumpCursor->val;
} high_11_bits = bevelReadData.buffer & 0x7FF;
bitsRead += 11; bevelReadData.buffer = bevelReadData.buffer >> 11;
bevelReadData.bitsReadFromBuffer = bitsRead;
if (bitsRead >= 32) { // need more data?
bevelReadData.buffer |= static_cast<uint64_t>(lumpCursor->val) << (64 - bitsRead);
bevelReadData.bitsReadFromBuffer = bitsRead - 32;
lumpCursor++; bevelReadData.fillBuffer = &lumpCursor.val;
} // processing
full_22_bits = (high_11_bits << 11) | low_11_bits;
bevelCount = full_22_bits & 0x7F; // 7 from the bottom
tricollIndex = full_22_bits >> 7; // 15 from the top
v85 = a1->tricollPointer[tricollIndex];
v86 = v85->num_triangles;
// get the node of our TricollTriangle
v87 = static_cast<TricollTriangle*>(v86 > 3 ? &v85->Nodes[(4 * (v86 - (v86 + 3) % 6 + 5)/ 2) / 3]
: &v85->Nodes[0]);
if(!getBeveIndices(a6, a11, v87, v85, bevelCount, a7, v60, &bevelReadData)) {
return;
} v60 += bevelCount;
if (v85 == tricoll) { goto LABEL_80; } // keep looking?
// resetting? setting up a jump back?
// probably reflects what these vars are used before where we start
v69 = static_cast<TricollBevelIndices*>(bevelReadData.fillBuffer);
v64 = bevelReadData.bitsReadFromBuffer;
v70 = bevelReadData.buffer; So each bevel is a stream of Have yet to add a branch script method for parsing this data |
Beta Was this translation helpful? Give feedback.
-
Mostly have the formats & relations worked out now, but need to bring the relevant math / functions to python
Also having trouble trying to port r1 Tricoll to r2, need to convert TricollBevelIndices |
Beta Was this translation helpful? Give feedback.
-
TricollHeader’s num_bevel_indices member seems to count the number of 10/11 bit numbers (r1/r2) TricollBevelStarts appears to index the starting uint32_t of a given TriCollTriangles BevelIndices |
Beta Was this translation helpful? Give feedback.
-
What is TriColl?
Triangle Collision data, for non-brushwork surfaces.
TriColl lumps are used in
respawn.titanfall
&respawn.titanfall2
(deprecated inapex_legends
)Presumably compiled from patches,
misc_model
& other non-brush geoIn Titanfall, most Tricoll is used for terrain, other examples include curved building exteriors on Runoff
In Titanfall 2, maps are mostly made of TriColl (curved surfaces, more terrain. complex bespoke geo)
Porting
Attempting to port Titanfall maps to Titanfall 2, we have found crashes when players touch TriColl geo
The logs indicate some out of bounds indexing
All we know for sure if that the lumps have changed.
Lumps
Connections
Beta Was this translation helpful? Give feedback.
All reactions