Difference between revisions of "Sims 3:0x01D0E723"
m (→Element Formats) |
|||
(5 intermediate revisions by one user not shown) | |||
Line 25: | Line 25: | ||
|- | |- | ||
!Id | !Id | ||
− | !Type | + | ![http://msdn.microsoft.com/en-us/library/bb172534%28v=VS.85%29.aspx Type] |
!Element Formats | !Element Formats | ||
|- | |- | ||
− | |0x00 || Position || | + | |0x00 || Position || Float3, Short4 |
|- | |- | ||
|0x01 || Normal || ColorUByte4 | |0x01 || Normal || ColorUByte4 | ||
|- | |- | ||
− | |0x02 || UV || | + | |0x02 || UV || Float2, Float4, Short2, Short4 |
|- | |- | ||
− | |0x03 || BlendIndex|| UByte4 | + | |0x03 || BlendIndex || UByte4 |
|- | |- | ||
− | |0x04 || BlendWeight|| ColorUByte4 | + | |0x04 || BlendWeight || ColorUByte4 |
|- | |- | ||
− | |0x05 || Tangent|| ColorUByte4 | + | |0x05 || Tangent || ColorUByte4 |
|- | |- | ||
− | |0x06 || Color|| ColorUByte4 | + | |0x06 || Color || ColorUByte4 |
|} | |} | ||
Line 48: | Line 48: | ||
|- | |- | ||
!Id | !Id | ||
− | !Type | + | !Used by |
+ | ![http://msdn.microsoft.com/en-us/library/bb172533%28v=VS.85%29.aspx Type] | ||
! | ! | ||
![[Sims 3:0x01D0E6FB#Swizzle Commands|SwizzleCommands]] | ![[Sims 3:0x01D0E6FB#Swizzle Commands|SwizzleCommands]] | ||
|- | |- | ||
− | |0x00 || Float || 1 float || 1x(Swizzle32) | + | |0x00 || || Float || 1 float || 1x(Swizzle32) |
|- | |- | ||
− | |0x01 || Float2 || 2 floats || 2x(Swizzle32) | + | |0x01 || UV || Float2 || 2 floats || 2x(Swizzle32) |
|- | |- | ||
− | |0x02 || Float3 || 3 floats || 3x(Swizzle32) | + | |0x02 || Position || Float3 || 3 floats || 3x(Swizzle32) |
|- | |- | ||
− | |0x03 || Float4 || 4 floats || 4x(Swizzle32) | + | |0x03 || UV || Float4 || 4 floats || 4x(Swizzle32) |
|- | |- | ||
− | |0x04 || UByte4 || 4 bytes || 1x(Swizzle32) | + | |0x04 || BlendIndex || UByte4 || 4 bytes || 1x(Swizzle32) |
|- | |- | ||
− | |0x05 || ColorUByte4 || 3 floats in 4 bytes. Order is little-endian, use the low order byte (4th) as an unsigned scaler value. For each remaining signed byte, if negative, add it, if positive, subtract it, then multiple the result by 1/scaler, or by 1/127 if scaler is 0 | + | |0x05 || Normal, BlendWeight, Tangent, Color || ColorUByte4 || 3 floats in 4 bytes. Order is little-endian, use the low order byte (4th) as an unsigned scaler value. For each remaining signed byte, if negative, add it, if positive, subtract it, then multiple the result by 1/scaler, or by 1/127 if scaler is 0 |
This entry needs explaining more clearly. | This entry needs explaining more clearly. | ||
Line 70: | Line 71: | ||
[[User:Pljones|Pljones]] 23:07, 17 January 2011 (UTC) | [[User:Pljones|Pljones]] 23:07, 17 January 2011 (UTC) | ||
− | OK, here's my explanation (this generates values that match Wes Howe's tool): | + | OK, here's my explanation (this generates values that match Wes Howe's tool fairly well): |
:There are two methods, a general one and one for BlendWeight only, that are slightly different. | :There are two methods, a general one and one for BlendWeight only, that are slightly different. | ||
:*The order of the three floats is the reverse order of the first three bytes, with the fourth byte being a scaling factor. | :*The order of the three floats is the reverse order of the first three bytes, with the fourth byte being a scaling factor. | ||
Line 78: | Line 79: | ||
|| 1x(Swizzle32) | || 1x(Swizzle32) | ||
|- | |- | ||
− | |0x06 || Short2 || 2 floats in two words. | + | |0x06 || UV || Short2 || |
+ | 2 floats in two words. | ||
+ | :*Non-UV usage: Divide by 32767. | ||
+ | :*UV usage: See below. | ||
+ | || 1x(Swizzle16x2) | ||
|- | |- | ||
− | |0x07 || Short4 || 3 floats in | + | |0x07 || Position, UV || Short4 || |
+ | 3 floats in four words. | ||
+ | :*Non-UV usage: The fourth word is an unsigned scalar (or use 32767 if zero). Divide by this scalar. | ||
+ | :*UV usage: See below. | ||
|| 2x(Swizzle16x2) | || 2x(Swizzle16x2) | ||
|- | |- | ||
− | |0x08 || UByte4N|| || 1x(Swizzle32) | + | |0x08 || || UByte4N || || 1x(Swizzle32) |
|- | |- | ||
− | |0x09 || Short2N|| || 1x(Swizzle16x2) | + | |0x09 || || Short2N || || 1x(Swizzle16x2) |
|- | |- | ||
− | |0x0A || Short4N|| || 2x(Swizzle16x2) | + | |0x0A || || Short4N || || 2x(Swizzle16x2) |
|- | |- | ||
− | |0x0B || UShort2N || || 1x(Swizzle16x2) | + | |0x0B || || UShort2N || || 1x(Swizzle16x2) |
|- | |- | ||
− | |0x0C || UShort4N || || 2x(Swizzle16x2) | + | |0x0C || || UShort4N || |
+ | 3 floats in four words. | ||
+ | :*Non-UV usage: The fourth word is an unsigned scalar (or use 512 if zero). Divide by this scalar. | ||
+ | :*UV usage: See below. | ||
+ | || 2x(Swizzle16x2) | ||
|- | |- | ||
− | |0x0D || Dec3N || || 1x(Swizzle32) | + | |0x0D || || Dec3N || || 1x(Swizzle32) |
|- | |- | ||
− | |0x0E || UDec3N || || 1x(Swizzle32) | + | |0x0E || || UDec3N || || 1x(Swizzle32) |
|- | |- | ||
− | |0x0F || Float16_2 || || 1x(Swizzle16x2) | + | |0x0F || || Float16_2 || || 1x(Swizzle16x2) |
|- | |- | ||
− | |0x10 || Float16_4 || || 2x(Swizzle16x2) | + | |0x10 || || Float16_4 || || 2x(Swizzle16x2) |
|- | |- | ||
|} | |} | ||
+ | For UV usage, multiply by the [[Sims 3:0x01D0E75D|MATD]] ShaderData entry for UVScales, element 0. If no such value exists, divide by 32767. | ||
Latest revision as of 12:23, 26 March 2011
Modding Reference by Category | |
---|---|
Sims 3 :DBPF | File Types | RCOL(Scene) | Catalog Resource | String Table | Key Table | TS3 Programmer's Reference |
Vertex Format - VRTF | ||
---|---|---|
TypeID: | 0x01D0E723 | |
Game Version: | The Sims 3 |
[edit] Format
This is a Sims 3:RCOL chunk found embedded in MODL and MLOD resources.
DWORD Tag // 'VRTF' DWORD Version // 00000002 DWORD Stride // Vertex data length (Bytes per vertex) DWORD Count DWORD IsExtendedFormat// boolean, always false but were it true the byte fields ahead would be DWORDs --repetition Count packed D3DVERTEXELEMENT: BYTE Usage BYTE UsageIndex //some elements can appear more than once, each time the index increases BYTE Format BYTE Offset // Offset into the vertex declaration for the data
[edit] Element Usages
Usages, and the formats they are usually paired with.
Id | Type | Element Formats |
---|---|---|
0x00 | Position | Float3, Short4 |
0x01 | Normal | ColorUByte4 |
0x02 | UV | Float2, Float4, Short2, Short4 |
0x03 | BlendIndex | UByte4 |
0x04 | BlendWeight | ColorUByte4 |
0x05 | Tangent | ColorUByte4 |
0x06 | Color | ColorUByte4 |
[edit] Element Formats
List of formats, and how to read them
Id | Used by | Type | SwizzleCommands | |
---|---|---|---|---|
0x00 | Float | 1 float | 1x(Swizzle32) | |
0x01 | UV | Float2 | 2 floats | 2x(Swizzle32) |
0x02 | Position | Float3 | 3 floats | 3x(Swizzle32) |
0x03 | UV | Float4 | 4 floats | 4x(Swizzle32) |
0x04 | BlendIndex | UByte4 | 4 bytes | 1x(Swizzle32) |
0x05 | Normal, BlendWeight, Tangent, Color | ColorUByte4 | 3 floats in 4 bytes. Order is little-endian, use the low order byte (4th) as an unsigned scaler value. For each remaining signed byte, if negative, add it, if positive, subtract it, then multiple the result by 1/scaler, or by 1/127 if scaler is 0
This entry needs explaining more clearly. In Little-endian, the low order byte is first, not fourth. The statements "add it" and "subtract it" do not explain what "it" is. Here and subsequently: "multiply by 1/xxx" - why not just "divide by xxx"? Pljones 23:07, 17 January 2011 (UTC) OK, here's my explanation (this generates values that match Wes Howe's tool fairly well):
Pljones 22:08, 18 January 2011 (UTC) |
1x(Swizzle32) |
0x06 | UV | Short2 |
2 floats in two words.
|
1x(Swizzle16x2) |
0x07 | Position, UV | Short4 |
3 floats in four words.
|
2x(Swizzle16x2) |
0x08 | UByte4N | 1x(Swizzle32) | ||
0x09 | Short2N | 1x(Swizzle16x2) | ||
0x0A | Short4N | 2x(Swizzle16x2) | ||
0x0B | UShort2N | 1x(Swizzle16x2) | ||
0x0C | UShort4N |
3 floats in four words.
|
2x(Swizzle16x2) | |
0x0D | Dec3N | 1x(Swizzle32) | ||
0x0E | UDec3N | 1x(Swizzle32) | ||
0x0F | Float16_2 | 1x(Swizzle16x2) | ||
0x10 | Float16_4 | 2x(Swizzle16x2) |
For UV usage, multiply by the MATD ShaderData entry for UVScales, element 0. If no such value exists, divide by 32767.
Based on contributions from delphy, karybdis and atavera
Modding Reference by Category | |
---|---|
Sims 3 :DBPF | File Types | RCOL(Scene) | Catalog Resource | String Table | Key Table | TS3 Programmer's Reference |