|Modding Reference by Category|
|Object Model - MLOD|
|Game Version:||The Sims 4|
This is an RCOL chunk. LOD means Level of detail. This chunk is found in both MLOD and MODL files, and it is the key that maps each mesh group to the appropriate parts of VRTF, VBUF, IBUF, SKIN and MATD chunks. It is the one ring to rule them all.
DWORD Tag // 'MLOD' DWORD Version // 0x00000201 DWORD // group_count repeat group_count times: DWORD // subset_bytes number of bytes after here in this repetition DWORD NameHash // FNV32 of the group name DWORD Material // MATD or MTST Private index DWORD VertexFormat // VRTF Private index DWORD VertexBuffer // VBUF Private index DWORD IndexBuffer // IBUF Private index DWORD Flags // PrimitiveType | (MeshFlags << 8) DWORD StreamOffset // VBUF offset in bytes DWORD StartVertex // 0 DWORD StartIndex // IBUF index DWORD MinVertexIndex // 0 DWORD VertexCount // DWORD PrimitiveCount // FLOAT BoundingBox // MinX/MinY/MinZ/MaxX/MaxY/MaxZ for this group DWORD SkinController // SKIN Private index DWORD // bone_count repeat bone_count times: DWORD // bone hash name DWORD // MATD Private index //Special MATD that only has UVScale/UVOffset/PosScale/PosOffset and no ShaderName DWORD // geo_st_count repeat geo_st_count times: DWORD // geo_st name hash DWORD // VBUF starting index index of the first vertex of the geo_st DWORD // (IBUF starting index) * 3 index of the first polygon face of the geo_st DWORD // VBUF count number of vertices in the geo_st DWORD // IBUF count number of polygon faces in the geo_st if (version > 0x00000201) DWORD ParentNameHash // FNV32 of the ParentName, always 0 FLOAT MirrorPlaneNormal // 3d normal vector specifying the direction of a mirror's reflection FLOAT MirrorPlaneOffset //offset along the normal vector if (version > 0x00000203) DWORD // So far always zero, but could be a count for a new list.
Geometry states are basically a way to make part of an object's mesh visible while the rest of it becomes invisible. The polygons and vertices that are visible in the geometry state are determined by the state's poly and vertex offsets and counts.
The purpose of geometry states is to sub-divide the mesh of a given group, allowing the model's visibility to be dynamically changed by the game through the function:
ScriptCore.World.ObjectSetGeometryVisibilityState(ObjectGuid objId, string geometryVisibilityState);
For most objects with geometry states, this function is commonly accessed through this function:
For some objects, the string argument is fnv32 hashed and matched to the corresponding geo_st name hash. However, in some cases, such as for the musicalInstrumentGuitar, it is unknown how some geometry states are located for the game. In the case of the guitar, two geometry states are given in the MLOD block:
0x4A9A1FD1 "guitarOnly" 0x019C3651 "standOnly"
However, the guitar's code uses the string "guitarAndStand" to combine the two states and get the complete mesh. How this is done is still unknown.
- The current theory is that when the hash of a geometry state name does not explicitly match any of the geometry states in the mesh's model, the entire model becomes visible.
- Also, the geometry state only effects the group that it is in. All other groups remain completely visible despite the current geometry state of one of the group.
- By creating what can be called a "zero" geometry state, with offset and count values all equal to zero, the group that the geometry state is an can be hidden in the game when that state is entered.
- An example is the garden sprinkler, which has two groups, one of which contains the sprinkler and the "dome" that you see in build/buy mode, and the other containing only the dome itself.
- The group that contains only the dome has a single geometry state, "domeOff", which is a zero geometry state. When this state is entered, the dome disappears, and the scripts enter it whenever Live Mode is entered.
- When Build or Buy Mode is entered, the scripts enter the "domeOn" geometry state. Since this state is not explicitly defined in the model, entering this state causes the entire model, including the dome, to become visible.
- Based on contributions from karybdis, atavera and ChaosMageX
|Modding Reference by Category|