<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://gtamods.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Seggaeman</id>
	<title>GTAMods Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://gtamods.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Seggaeman"/>
	<link rel="alternate" type="text/html" href="https://gtamods.com/wiki/Special:Contributions/Seggaeman"/>
	<updated>2026-04-12T01:20:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>https://gtamods.com/mediawiki/index.php?title=RpGeometry&amp;diff=9773</id>
		<title>RpGeometry</title>
		<link rel="alternate" type="text/html" href="https://gtamods.com/mediawiki/index.php?title=RpGeometry&amp;diff=9773"/>
		<updated>2011-04-20T16:50:42Z</updated>

		<summary type="html">&lt;p&gt;Seggaeman: Ok &amp;quot;0 based&amp;quot; was redundant, but I feel the point that attribute and material index are the same thing is correct.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RW Section|Geometry|0x000F}}&lt;br /&gt;
&lt;br /&gt;
'''Geometry''' is a container section used in [[model file|DFF files]] as child of a [[Geometry List (RW Section)|Geometry List]] section. The section itself does not store any data at all. All additional information get stored inside a [[Struct (RW Section)|struct section]] which directly follows this one as a child. ''Geometry'' is one of the most important sections inside a &amp;lt;code&amp;gt;.dff&amp;lt;/code&amp;gt; model file. It stores geometry information for models (like the mesh and the texture maps).&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
The structure differs for most files, but it always gets introduced by the following set of values:&lt;br /&gt;
&lt;br /&gt;
 2b - WORD   - Flags (See [[Geometry (RW Section)#Flags|below]])&lt;br /&gt;
 1b - BYTE   - Number of UV coordinates used (GTA default is 1)&lt;br /&gt;
 1b - BYTE   - Unknown (usually 0 and 1 on PS2)&lt;br /&gt;
 4b - DWORD  - Triangle count&lt;br /&gt;
 4b - DWORD  - Vertex count&lt;br /&gt;
 4b - DWORD  - Frame count&lt;br /&gt;
&lt;br /&gt;
For all [[RenderWare_binary_stream_file#Common_RW_Version_IDs|versions]] below '''3.4''' also some lightning color values are stored.&lt;br /&gt;
&lt;br /&gt;
 4b - DWORD  - Ambient color (Represents an DirectX &amp;lt;code&amp;gt;D3DCOLOR&amp;lt;/code&amp;gt; value {{ref|1}})&lt;br /&gt;
 4b - DWORD  - Diffuse color (Represents an DirectX &amp;lt;code&amp;gt;D3DCOLOR&amp;lt;/code&amp;gt; value)&lt;br /&gt;
 4b - DWORD  - Specular color (Represents an DirectX &amp;lt;code&amp;gt;D3DCOLOR&amp;lt;/code&amp;gt; value)&lt;br /&gt;
&lt;br /&gt;
=== Flags ===&lt;br /&gt;
&lt;br /&gt;
The following flags descripe the behaviour of the mesh during the rendering progress. Some of the flags indicate the existance of data inside the following file format.&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable}} width=&amp;quot;100%&amp;quot; class=&amp;quot;collapsible&amp;quot;&lt;br /&gt;
!width=&amp;quot;120px&amp;quot;|Flag&lt;br /&gt;
!width=&amp;quot;25%&amp;quot;|Binary&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;1&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 0001&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Is [[wikipedia:Triangle_strip|triangle strip]] (if disabled it will be an triangle list)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;2&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 0010&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Vertex translation (&amp;lt;code&amp;gt;D3DFVF_XYZ&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;4&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 0100&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Texture coordinates 1 (&amp;lt;code&amp;gt;D3DFVF_TEX1&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;8&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 1000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Vertex colors (&amp;lt;code&amp;gt;D3DFVF_DIFFUSE&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;16&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0001 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Store normals (&amp;lt;code&amp;gt;D3DFVF_NORMAL&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;32&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0010 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Dynamic vertex lightning ''(?)''&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;64&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0100 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Modulate material color&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;128&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 1000 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Texture coordinates 2 (&amp;lt;code&amp;gt;D3DFVF_TEX2&amp;lt;/code&amp;gt;)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All of those flags (except the first) are used to build up the ''flexible vertex format (FVF)'' {{ref|2}}.&lt;br /&gt;
&lt;br /&gt;
=== Prelightning/Vertex colors ===&lt;br /&gt;
&lt;br /&gt;
If '''flag 8''' is enabled vertex color information for each vertex get stored up next:&lt;br /&gt;
&lt;br /&gt;
 4b - DWORD  - Vertex color (D3DCOLOR)&lt;br /&gt;
&lt;br /&gt;
The default value is 0x00FFFFFF (representing non-transparent white).&lt;br /&gt;
&lt;br /&gt;
With ''San Andreas'' Rockstar's engine is able to change the vertex colors for ingame nights. Therefor there is an [[List of RW section IDs#Rockstar.27s_Custom_Sections|custom section]] called [[Night Vertex Colors (RW Section)|Night Vertex Colors]]. This prevents the game from loading new models at different times and increments the performance of the engine. Previous games stored copies of the model with different prelightning information and defined it inside the [[TOBJ]] [[IDE]] section.&lt;br /&gt;
&lt;br /&gt;
=== Texture/UV coordinates ===&lt;br /&gt;
&lt;br /&gt;
If '''flag 4''' or '''128''' is set texture coordinates are following next. If both are set then the texture coordinates for the first texture of all vertices are listed before the texture coordinates for the second chanel of all vertices (By default no GTA game ever uses more than 1 UV coordinate at one time).&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Texture coordinate U&lt;br /&gt;
 4b - FLOAT  - Texture coordinate V&lt;br /&gt;
&lt;br /&gt;
=== Indices/Attributes ===&lt;br /&gt;
&lt;br /&gt;
The following array holds indices and attributes for each triangle. The number of indices is represented by the third multiple of the triangle count value. So for each triangle the following format gets used:&lt;br /&gt;
&lt;br /&gt;
 2b - WORD   - Index of first vertex&lt;br /&gt;
 2b - WORD   - Index of second vertex&lt;br /&gt;
 2b - WORD   - Attribute for line/triangle&lt;br /&gt;
 2b - WORD   - Index of third vertex&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Attribute&amp;quot; is the material index which appears again in the [[Bin Mesh PLG (RW Section)|Bin Mesh PLG]] section.&lt;br /&gt;
=== Bounding information ===&lt;br /&gt;
&lt;br /&gt;
The bounding information are used to check weather the mesh is visible for the camera, or not. It only exists once per geometry section.&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Center X&lt;br /&gt;
 4b - FLOAT  - Center Y&lt;br /&gt;
 4b - FLOAT  - Center Z&lt;br /&gt;
 4b - FLOAT  - Radius of bounding sphere&lt;br /&gt;
 4b - DWORD  - Has position&lt;br /&gt;
 4b - DWORD  - Has normals&lt;br /&gt;
&lt;br /&gt;
The central vector (&amp;lt;code&amp;gt;D3DXVECTOR3&amp;lt;/code&amp;gt;) describes the center of the bounding sphere as an offset from the [[IPL|placement]] of the object inside the real world.&lt;br /&gt;
&lt;br /&gt;
=== Vertex translation info ===&lt;br /&gt;
&lt;br /&gt;
The number of vertices gets defined inside the geometry structure. If '''flag 2''' is set the translation information gets stored for each vertex as a &amp;lt;code&amp;gt;D3DXVECTOR3&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Position X&lt;br /&gt;
 4b - FLOAT  - Position Y&lt;br /&gt;
 4b - FLOAT  - Position Z&lt;br /&gt;
&lt;br /&gt;
The position values are an offset relative to the mesh pivot.&lt;br /&gt;
&lt;br /&gt;
=== Normals ===&lt;br /&gt;
&lt;br /&gt;
In case '''flag 16''' is set the [[wikipedia:Surface_normal|normal vectors]] are the last part of the geometry data structure. They are also stored as a &amp;lt;code&amp;gt;D3DXVECTOR3&amp;lt;/code&amp;gt; for each vertex:&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Direction X&lt;br /&gt;
 4b - FLOAT  - Direction Y&lt;br /&gt;
 4b - FLOAT  - Direction Z&lt;br /&gt;
&lt;br /&gt;
== Child sections ==&lt;br /&gt;
&lt;br /&gt;
* [[Material List (RW Section)|Material List]]&lt;br /&gt;
&lt;br /&gt;
=== Extension ===&lt;br /&gt;
&lt;br /&gt;
The [[Extension (RW Section)|extension]] of an geometry usually holds the following sections in the order they are listed in here:&lt;br /&gt;
&lt;br /&gt;
* [[Bin Mesh PLG (RW Section)|Bin Mesh PLG]]&lt;br /&gt;
* [[Native Data PLG (RW Section)|Native Data PLG]] &amp;amp;ndash; (Only for consoles)&lt;br /&gt;
* [[Skin PLG (RW Section)|Skin PLG]]&lt;br /&gt;
* [[Mesh Extension (RW Section)|Mesh Extension]]&lt;br /&gt;
* [[Night Vertex Colors (RW Section)|Night Vertex Colors]]&lt;br /&gt;
* [[Morph PLG (RW Section)|Morph PLG]]&lt;br /&gt;
* [[2dfx (RW Section)|2dfx]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Geometry List (RW Section)|Geometry List]]&lt;br /&gt;
* [[RenderWare_binary_stream_file|RW file format specification]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Note|1}} * http://msdn.microsoft.com/en-us/library/bb172518%28VS.85%29.aspx&amp;lt;br&amp;gt;&lt;br /&gt;
{{Note|2}} * http://msdn.microsoft.com/en-us/library/bb172559%28VS.85%29.aspx&lt;br /&gt;
&lt;br /&gt;
{{N|SA|VC}}&lt;br /&gt;
[[Category:GTA_3]]&lt;/div&gt;</summary>
		<author><name>Seggaeman</name></author>
		
	</entry>
	<entry>
		<id>https://gtamods.com/mediawiki/index.php?title=RpGeometry&amp;diff=9725</id>
		<title>RpGeometry</title>
		<link rel="alternate" type="text/html" href="https://gtamods.com/mediawiki/index.php?title=RpGeometry&amp;diff=9725"/>
		<updated>2011-03-23T19:50:19Z</updated>

		<summary type="html">&lt;p&gt;Seggaeman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RW Section|Geometry|0x000F}}&lt;br /&gt;
&lt;br /&gt;
'''Geometry''' is a container section used in [[model file|DFF files]] as child of a [[Geometry List (RW Section)|Geometry List]] section. The section itself does not store any data at all. All additional information get stored inside a [[Struct (RW Section)|struct section]] which directly follows this one as a child. ''Geometry'' is one of the most important sections inside a &amp;lt;code&amp;gt;.dff&amp;lt;/code&amp;gt; model file. It stores geometry information for models (like the mesh and the texture maps).&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
The structure differs for most files, but it always gets introduced by the following set of values:&lt;br /&gt;
&lt;br /&gt;
 2b - WORD   - Flags (See [[Geometry (RW Section)#Flags|below]])&lt;br /&gt;
 1b - BYTE   - Number of UV coordinates used (GTA default is 1)&lt;br /&gt;
 1b - BYTE   - Unknown (usually 0 and 1 on PS2)&lt;br /&gt;
 4b - DWORD  - Triangle count&lt;br /&gt;
 4b - DWORD  - Vertex count&lt;br /&gt;
 4b - DWORD  - Frame count&lt;br /&gt;
&lt;br /&gt;
For all [[RenderWare_binary_stream_file#Common_RW_Version_IDs|versions]] below '''3.4''' also some lightning color values are stored.&lt;br /&gt;
&lt;br /&gt;
 4b - DWORD  - Ambient color (Represents an DirectX &amp;lt;code&amp;gt;D3DCOLOR&amp;lt;/code&amp;gt; value {{ref|1}})&lt;br /&gt;
 4b - DWORD  - Diffuse color (Represents an DirectX &amp;lt;code&amp;gt;D3DCOLOR&amp;lt;/code&amp;gt; value)&lt;br /&gt;
 4b - DWORD  - Specular color (Represents an DirectX &amp;lt;code&amp;gt;D3DCOLOR&amp;lt;/code&amp;gt; value)&lt;br /&gt;
&lt;br /&gt;
=== Flags ===&lt;br /&gt;
&lt;br /&gt;
The following flags descripe the behaviour of the mesh during the rendering progress. Some of the flags indicate the existance of data inside the following file format.&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable}} width=&amp;quot;100%&amp;quot; class=&amp;quot;collapsible&amp;quot;&lt;br /&gt;
!width=&amp;quot;120px&amp;quot;|Flag&lt;br /&gt;
!width=&amp;quot;25%&amp;quot;|Binary&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;1&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 0001&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Is [[wikipedia:Triangle_strip|triangle strip]] (if disabled it will be an triangle list)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;2&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 0010&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Vertex translation (&amp;lt;code&amp;gt;D3DFVF_XYZ&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;4&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 0100&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Texture coordinates 1 (&amp;lt;code&amp;gt;D3DFVF_TEX1&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;8&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 1000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Vertex colors (&amp;lt;code&amp;gt;D3DFVF_DIFFUSE&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;16&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0001 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Store normals (&amp;lt;code&amp;gt;D3DFVF_NORMAL&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;32&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0010 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Dynamic vertex lightning ''(?)''&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;64&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0100 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Modulate material color&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;128&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 1000 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Texture coordinates 2 (&amp;lt;code&amp;gt;D3DFVF_TEX2&amp;lt;/code&amp;gt;)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All of those flags (except the first) are used to build up the ''flexible vertex format (FVF)'' {{ref|2}}.&lt;br /&gt;
&lt;br /&gt;
=== Prelightning/Vertex colors ===&lt;br /&gt;
&lt;br /&gt;
If '''flag 8''' is enabled vertex color information for each vertex get stored up next:&lt;br /&gt;
&lt;br /&gt;
 4b - DWORD  - Vertex color (D3DCOLOR)&lt;br /&gt;
&lt;br /&gt;
The default value is 0x00FFFFFF (representing non-transparent white).&lt;br /&gt;
&lt;br /&gt;
With ''San Andreas'' Rockstar's engine is able to change the vertex colors for ingame nights. Therefor there is an [[List of RW section IDs#Rockstar.27s_Custom_Sections|custom section]] called [[Night Vertex Colors (RW Section)|Night Vertex Colors]]. This prevents the game from loading new models at different times and increments the performance of the engine. Previous games stored copies of the model with different prelightning information and defined it inside the [[TOBJ]] [[IDE]] section.&lt;br /&gt;
&lt;br /&gt;
=== Texture/UV coordinates ===&lt;br /&gt;
&lt;br /&gt;
If '''flag 4''' or '''128''' is set texture coordinates are following next. If both are set then the texture coordinates for the first texture of all vertices are listed before the texture coordinates for the second chanel of all vertices (By default no GTA game ever uses more than 1 UV coordinate at one time).&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Texture coordinate U&lt;br /&gt;
 4b - FLOAT  - Texture coordinate V&lt;br /&gt;
&lt;br /&gt;
=== Indices/Attributes ===&lt;br /&gt;
&lt;br /&gt;
The following array holds indices and attributes for each triangle. The number of indices is represented by the third multiple of the triangle count value. So for each triangle the following format gets used:&lt;br /&gt;
&lt;br /&gt;
 2b - WORD   - Index of first vertex&lt;br /&gt;
 2b - WORD   - Index of second vertex&lt;br /&gt;
 2b - WORD   - Attribute for line/triangle&lt;br /&gt;
 2b - WORD   - Index of third vertex&lt;br /&gt;
The &amp;quot;attribute&amp;quot; is the 0 based material index for that triangle.&lt;br /&gt;
=== Bounding information ===&lt;br /&gt;
&lt;br /&gt;
The bounding information are used to check weather the mesh is visible for the camera, or not. It only exists once per geometry section.&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Center X&lt;br /&gt;
 4b - FLOAT  - Center Y&lt;br /&gt;
 4b - FLOAT  - Center Z&lt;br /&gt;
 4b - FLOAT  - Radius of bounding sphere&lt;br /&gt;
 4b - DWORD  - Has position&lt;br /&gt;
 4b - DWORD  - Has normals&lt;br /&gt;
&lt;br /&gt;
The central vector (&amp;lt;code&amp;gt;D3DXVECTOR3&amp;lt;/code&amp;gt;) describes the center of the bounding sphere as an offset from the [[IPL|placement]] of the object inside the real world.&lt;br /&gt;
&lt;br /&gt;
=== Vertex translation info ===&lt;br /&gt;
&lt;br /&gt;
The number of vertices gets defined inside the geometry structure. If '''flag 2''' is set the translation information gets stored for each vertex as a &amp;lt;code&amp;gt;D3DXVECTOR3&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Position X&lt;br /&gt;
 4b - FLOAT  - Position Y&lt;br /&gt;
 4b - FLOAT  - Position Z&lt;br /&gt;
&lt;br /&gt;
The position values are an offset relative to the mesh pivot.&lt;br /&gt;
&lt;br /&gt;
=== Normals ===&lt;br /&gt;
&lt;br /&gt;
In case '''flag 16''' is set the [[wikipedia:Surface_normal|normal vectors]] are the last part of the geometry data structure. They are also stored as a &amp;lt;code&amp;gt;D3DXVECTOR3&amp;lt;/code&amp;gt; for each vertex:&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Direction X&lt;br /&gt;
 4b - FLOAT  - Direction Y&lt;br /&gt;
 4b - FLOAT  - Direction Z&lt;br /&gt;
&lt;br /&gt;
== Child sections ==&lt;br /&gt;
&lt;br /&gt;
* [[Material List (RW Section)|Material List]]&lt;br /&gt;
&lt;br /&gt;
=== Extension ===&lt;br /&gt;
&lt;br /&gt;
The [[Extension (RW Section)|extension]] of an geometry usually holds the following sections in the order they are listed in here:&lt;br /&gt;
&lt;br /&gt;
* [[Bin Mesh PLG (RW Section)|Bin Mesh PLG]]&lt;br /&gt;
* [[Native Data PLG (RW Section)|Native Data PLG]] &amp;amp;ndash; (Only for consoles)&lt;br /&gt;
* [[Skin PLG (RW Section)|Skin PLG]]&lt;br /&gt;
* [[Mesh Extension (RW Section)|Mesh Extension]]&lt;br /&gt;
* [[Night Vertex Colors (RW Section)|Night Vertex Colors]]&lt;br /&gt;
* [[Morph PLG (RW Section)|Morph PLG]]&lt;br /&gt;
* [[2dfx (RW Section)|2dfx]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Geometry List (RW Section)|Geometry List]]&lt;br /&gt;
* [[RenderWare_binary_stream_file|RW file format specification]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Note|1}} * http://msdn.microsoft.com/en-us/library/bb172518%28VS.85%29.aspx&amp;lt;br&amp;gt;&lt;br /&gt;
{{Note|2}} * http://msdn.microsoft.com/en-us/library/bb172559%28VS.85%29.aspx&lt;br /&gt;
&lt;br /&gt;
{{N|SA|VC}}&lt;br /&gt;
[[Category:GTA_3]]&lt;/div&gt;</summary>
		<author><name>Seggaeman</name></author>
		
	</entry>
	<entry>
		<id>https://gtamods.com/mediawiki/index.php?title=RpGeometry&amp;diff=9604</id>
		<title>RpGeometry</title>
		<link rel="alternate" type="text/html" href="https://gtamods.com/mediawiki/index.php?title=RpGeometry&amp;diff=9604"/>
		<updated>2011-02-01T05:41:09Z</updated>

		<summary type="html">&lt;p&gt;Seggaeman: /* Flags */ Modulate material color flag in wrong position.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RW Section|Geometry|0x000F}}&lt;br /&gt;
&lt;br /&gt;
'''Geometry''' is a container section used in [[model file|DFF files]] as child of a [[Geometry List (RW Section)|Geometry List]] section. The section itself does not store any data at all. All additional information get stored inside a [[Struct (RW Section)|struct section]] which directly follows this one as a child. ''Geometry'' is one of the most important sections inside a &amp;lt;code&amp;gt;.dff&amp;lt;/code&amp;gt; model file. It stores geometry information for models (like the mesh and the texture maps).&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
The structure differs for most files, but it always gets introduced by the following set of values:&lt;br /&gt;
&lt;br /&gt;
 2b - WORD   - Flags (See [[Geometry (RW Section)#Flags|below]])&lt;br /&gt;
 1b - BYTE   - Number of UV coordinates used (GTA default is 1)&lt;br /&gt;
 1b - BYTE   - Unknown (usually 0 and 1 on PS2)&lt;br /&gt;
 4b - DWORD  - Triangle count&lt;br /&gt;
 4b - DWORD  - Vertex count&lt;br /&gt;
 4b - DWORD  - Frame count&lt;br /&gt;
&lt;br /&gt;
For all [[RenderWare_binary_stream_file#Common_RW_Version_IDs|versions]] below '''3.4''' also some lightning color values are stored.&lt;br /&gt;
&lt;br /&gt;
 4b - DWORD  - Ambient color (Represents an DirectX &amp;lt;code&amp;gt;D3DCOLOR&amp;lt;/code&amp;gt; value {{ref|1}})&lt;br /&gt;
 4b - DWORD  - Diffuse color (Represents an DirectX &amp;lt;code&amp;gt;D3DCOLOR&amp;lt;/code&amp;gt; value)&lt;br /&gt;
 4b - DWORD  - Specular color (Represents an DirectX &amp;lt;code&amp;gt;D3DCOLOR&amp;lt;/code&amp;gt; value)&lt;br /&gt;
&lt;br /&gt;
=== Flags ===&lt;br /&gt;
&lt;br /&gt;
The following flags descripe the behaviour of the mesh during the rendering progress. Some of the flags indicate the existance of data inside the following file format.&lt;br /&gt;
&lt;br /&gt;
{|{{Prettytable}} width=&amp;quot;100%&amp;quot; class=&amp;quot;collapsible&amp;quot;&lt;br /&gt;
!width=&amp;quot;120px&amp;quot;|Flag&lt;br /&gt;
!width=&amp;quot;25%&amp;quot;|Binary&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;1&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 0001&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Is [[wikipedia:Triangle_strip|triangle strip]] (if disabled it will be an triangle list)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;2&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 0010&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Vertex translation (&amp;lt;code&amp;gt;D3DFVF_XYZ&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;4&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 0100&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Texture coordinates 1 (&amp;lt;code&amp;gt;D3DFVF_TEX1&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;8&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0000 1000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Vertex colors (&amp;lt;code&amp;gt;D3DFVF_DIFFUSE&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;16&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0001 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Store normals (&amp;lt;code&amp;gt;D3DFVF_NORMAL&amp;lt;/code&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;32&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0010 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Dynamic vertex lightning ''(?)''&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;64&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 0100 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Modulate material color&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;128&amp;lt;/center&amp;gt;||&amp;lt;center&amp;gt;&amp;lt;code&amp;gt;0000 0000 1000 0000&amp;lt;/code&amp;gt;&amp;lt;/center&amp;gt;||Texture coordinates 2 (&amp;lt;code&amp;gt;D3DFVF_TEX2&amp;lt;/code&amp;gt;)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All of those flags (except the first) are used to build up the ''flexible vertex format (FVF)'' {{ref|2}}.&lt;br /&gt;
&lt;br /&gt;
=== Prelightning/Vertex colors ===&lt;br /&gt;
&lt;br /&gt;
If '''flag 8''' is enabled vertex color information for each vertex get stored up next:&lt;br /&gt;
&lt;br /&gt;
 4b - DWORD  - Vertex color (D3DCOLOR)&lt;br /&gt;
&lt;br /&gt;
The default value is 0x00FFFFFF (representing non-transparent white).&lt;br /&gt;
&lt;br /&gt;
With ''San Andreas'' Rockstar's engine is able to change the vertex colors for ingame nights. Therefor there is an [[List of RW section IDs#Rockstar.27s_Custom_Sections|custom section]] called [[Night Vertex Colors (RW Section)|Night Vertex Colors]]. This prevents the game from loading new models at different times and increments the performance of the engine. Previous games stored copies of the model with different prelightning information and defined it inside the [[TOBJ]] [[IDE]] section.&lt;br /&gt;
&lt;br /&gt;
=== Texture/UV coordinates ===&lt;br /&gt;
&lt;br /&gt;
If '''flag 4''' or '''128''' is set texture coordinates are following next. If both are set then the texture coordinates for the first texture of all vertices are listed before the texture coordinates for the second chanel of all vertices (By default no GTA game ever uses more than 1 UV coordinate at one time).&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Texture coordinate U&lt;br /&gt;
 4b - FLOAT  - Texture coordinate V&lt;br /&gt;
&lt;br /&gt;
=== Indices/Attributes ===&lt;br /&gt;
&lt;br /&gt;
The following array holds indices and attributes for each triangle. The number of indices is represented by the third multiple of the triangle count value. So for each triangle the following format gets used:&lt;br /&gt;
&lt;br /&gt;
 2b - WORD   - Index of first vertex&lt;br /&gt;
 2b - WORD   - Index of second vertex&lt;br /&gt;
 2b - WORD   - Attribute for line/triangle&lt;br /&gt;
 2b - WORD   - Index of third vertex&lt;br /&gt;
&lt;br /&gt;
=== Bounding information ===&lt;br /&gt;
&lt;br /&gt;
The bounding information are used to check weather the mesh is visible for the camera, or not. It only exists once per geometry section.&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Center X&lt;br /&gt;
 4b - FLOAT  - Center Y&lt;br /&gt;
 4b - FLOAT  - Center Z&lt;br /&gt;
 4b - FLOAT  - Radius of bounding sphere&lt;br /&gt;
 4b - DWORD  - Has position&lt;br /&gt;
 4b - DWORD  - Has normals&lt;br /&gt;
&lt;br /&gt;
The central vector (&amp;lt;code&amp;gt;D3DXVECTOR3&amp;lt;/code&amp;gt;) describes the center of the bounding sphere as an offset from the [[IPL|placement]] of the object inside the real world.&lt;br /&gt;
&lt;br /&gt;
=== Vertex translation info ===&lt;br /&gt;
&lt;br /&gt;
The number of vertices gets defined inside the geometry structure. If '''flag 2''' is set the translation information gets stored for each vertex as a &amp;lt;code&amp;gt;D3DXVECTOR3&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Position X&lt;br /&gt;
 4b - FLOAT  - Position Y&lt;br /&gt;
 4b - FLOAT  - Position Z&lt;br /&gt;
&lt;br /&gt;
The position values are an offset relative to the mesh pivot.&lt;br /&gt;
&lt;br /&gt;
=== Normals ===&lt;br /&gt;
&lt;br /&gt;
In case '''flag 16''' is set the [[wikipedia:Surface_normal|normal vectors]] are the last part of the geometry data structure. They are also stored as a &amp;lt;code&amp;gt;D3DXVECTOR3&amp;lt;/code&amp;gt; for each vertex:&lt;br /&gt;
&lt;br /&gt;
 4b - FLOAT  - Direction X&lt;br /&gt;
 4b - FLOAT  - Direction Y&lt;br /&gt;
 4b - FLOAT  - Direction Z&lt;br /&gt;
&lt;br /&gt;
== Child sections ==&lt;br /&gt;
&lt;br /&gt;
* [[Material List (RW Section)|Material List]]&lt;br /&gt;
&lt;br /&gt;
=== Extension ===&lt;br /&gt;
&lt;br /&gt;
The [[Extension (RW Section)|extension]] of an geometry usually holds the following sections in the order they are listed in here:&lt;br /&gt;
&lt;br /&gt;
* [[Bin Mesh PLG (RW Section)|Bin Mesh PLG]]&lt;br /&gt;
* [[Native Data PLG (RW Section)|Native Data PLG]] &amp;amp;ndash; (Only for consoles)&lt;br /&gt;
* [[Skin PLG (RW Section)|Skin PLG]]&lt;br /&gt;
* [[Mesh Extension (RW Section)|Mesh Extension]]&lt;br /&gt;
* [[Night Vertex Colors (RW Section)|Night Vertex Colors]]&lt;br /&gt;
* [[Morph PLG (RW Section)|Morph PLG]]&lt;br /&gt;
* [[2dfx (RW Section)|2dfx]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Geometry List (RW Section)|Geometry List]]&lt;br /&gt;
* [[RenderWare_binary_stream_file|RW file format specification]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Note|1}} * http://msdn.microsoft.com/en-us/library/bb172518%28VS.85%29.aspx&amp;lt;br&amp;gt;&lt;br /&gt;
{{Note|2}} * http://msdn.microsoft.com/en-us/library/bb172559%28VS.85%29.aspx&lt;br /&gt;
&lt;br /&gt;
{{N|SA|VC}}&lt;br /&gt;
[[Category:GTA_3]]&lt;/div&gt;</summary>
		<author><name>Seggaeman</name></author>
		
	</entry>
	<entry>
		<id>https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9560</id>
		<title>Bin Mesh PLG (RW Section)</title>
		<link rel="alternate" type="text/html" href="https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9560"/>
		<updated>2011-01-20T10:10:09Z</updated>

		<summary type="html">&lt;p&gt;Seggaeman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RW Section|Bin Mesh PLG|0x50E}}&lt;br /&gt;
The '''Bin Mesh PLG''' section stores face data split according to material indices. It is typically stored inside the [[Extension_(RW_Section)|extension]] of a [[Geometry (RW Section)|geometry section]] and does not hold any child sections.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
 4b - DWORD  - Face type (Apparently always 1, representing a triangle strip)&lt;br /&gt;
 4b - DWORD  - Number of material splits&lt;br /&gt;
 4b - DWORD  - Number of faces&lt;br /&gt;
&lt;br /&gt;
The number of material splits defines the size of an array which directly follows the structure above. The structure of the array elements (''TMaterialSplitData'') links the material split index to the vertices of the geometry:&lt;br /&gt;
&lt;br /&gt;
 4b - DWORD  - Number of vertices&lt;br /&gt;
 4b - DWORD  - Material index&lt;br /&gt;
 Xb -        - Array of DWORDs, each entry representing an vertex index. &lt;br /&gt;
               Array size gets defined by the number of vertices&lt;br /&gt;
&lt;br /&gt;
Material and vertex indices are zero based.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[RenderWare_binary_stream_file|RW file format specification]]&lt;br /&gt;
&lt;br /&gt;
{{N|SA|VC}}&lt;br /&gt;
[[Category:GTA_3]]&lt;/div&gt;</summary>
		<author><name>Seggaeman</name></author>
		
	</entry>
	<entry>
		<id>https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9559</id>
		<title>Bin Mesh PLG (RW Section)</title>
		<link rel="alternate" type="text/html" href="https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9559"/>
		<updated>2011-01-20T10:07:29Z</updated>

		<summary type="html">&lt;p&gt;Seggaeman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RW Section|Bin Mesh PLG|0x50E}}&lt;br /&gt;
The '''Bin Mesh PLG''' section stores face data split according to material indices. It is typically stored inside the [[Extension_(RW_Section)|extension]] of a [[Geometry (RW Section)|geometry section]] and does not hold any child sections.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
&lt;br /&gt;
 4b - DWORD  - Face type (Apparently always 1, representing a triangle strip)&lt;br /&gt;
 4b - DWORD  - Number of material splits&lt;br /&gt;
 4b - DWORD  - Number of faces&lt;br /&gt;
&lt;br /&gt;
The number of material splits defines the size of an array which directly follows the structure above. The structure of the array elements (''TMaterialSplitData'') links the material split index to the vertices of the geometry:&lt;br /&gt;
&lt;br /&gt;
 4b - DWORD  - Number of vertices&lt;br /&gt;
 4b - DWORD  - Material index&lt;br /&gt;
 Xb -        - Array of DWORDs, each entry representing an vertex index. Array size gets defined by the number of vertices&lt;br /&gt;
&lt;br /&gt;
Material and vertex indices are zero based.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[RenderWare_binary_stream_file|RW file format specification]]&lt;br /&gt;
&lt;br /&gt;
{{N|SA|VC}}&lt;br /&gt;
[[Category:GTA_3]]&lt;/div&gt;</summary>
		<author><name>Seggaeman</name></author>
		
	</entry>
	<entry>
		<id>https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9549</id>
		<title>Bin Mesh PLG (RW Section)</title>
		<link rel="alternate" type="text/html" href="https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9549"/>
		<updated>2011-01-19T14:07:55Z</updated>

		<summary type="html">&lt;p&gt;Seggaeman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This section stores face data split according to material ID. Bin Mesh PLG has an extension section (ID 0x00000003) as its immediate parent and appears once in every geometry item.&lt;br /&gt;
&lt;br /&gt;
Introduced as follows&lt;br /&gt;
SectionID: 0x0000500E (4 bytes)&lt;br /&gt;
Size of data: &amp;lt;size&amp;gt; (4 bytes, relative to after RW fileversion)&lt;br /&gt;
RW file version: &amp;lt;fileversion&amp;gt; (4 bytes)&lt;/div&gt;</summary>
		<author><name>Seggaeman</name></author>
		
	</entry>
	<entry>
		<id>https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9548</id>
		<title>Bin Mesh PLG (RW Section)</title>
		<link rel="alternate" type="text/html" href="https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9548"/>
		<updated>2011-01-19T14:07:35Z</updated>

		<summary type="html">&lt;p&gt;Seggaeman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This section stores face data split according to material ID. Bin Mesh PLG has an extension section (ID 0x00000003) as its immediate parent and appears once in every geometry item.&lt;br /&gt;
&lt;br /&gt;
Introduced as follows&lt;br /&gt;
SectionID: 0x0000500E (4 bytes)&lt;br /&gt;
Size of data: &amp;lt;size&amp;gt; (4 bytes, relative to after RW fileversion)&lt;br /&gt;
RW file version: &amp;lt;fileversion&amp;gt; (4 bytes)&lt;br /&gt;
&lt;br /&gt;
{| {{Prettytable}}&lt;br /&gt;
|&lt;br /&gt;
|Introduced as follows:&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Seggaeman</name></author>
		
	</entry>
	<entry>
		<id>https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9547</id>
		<title>Bin Mesh PLG (RW Section)</title>
		<link rel="alternate" type="text/html" href="https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9547"/>
		<updated>2011-01-19T14:06:45Z</updated>

		<summary type="html">&lt;p&gt;Seggaeman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This section stores face data split according to material ID. Bin Mesh PLG has an extension section (ID 0x00000003) as its immediate parent and appears once in every geometry item.&lt;br /&gt;
&lt;br /&gt;
Introduced as follows&lt;br /&gt;
SectionID: 0x0000500E (4 bytes)&lt;br /&gt;
Size of data: &amp;lt;size&amp;gt; (4 bytes, relative to after RW fileversion)&lt;br /&gt;
RW file version: &amp;lt;fileversion&amp;gt; (4 bytes)&lt;/div&gt;</summary>
		<author><name>Seggaeman</name></author>
		
	</entry>
	<entry>
		<id>https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9546</id>
		<title>Bin Mesh PLG (RW Section)</title>
		<link rel="alternate" type="text/html" href="https://gtamods.com/mediawiki/index.php?title=Bin_Mesh_PLG_(RW_Section)&amp;diff=9546"/>
		<updated>2011-01-19T14:05:29Z</updated>

		<summary type="html">&lt;p&gt;Seggaeman: Created page with 'This section stores face data split according to material ID. Bin Mesh PLG has an extension section (ID 0x00000003) as its immediate parent and appears once in every geometry ite…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This section stores face data split according to material ID. Bin Mesh PLG has an extension section (ID 0x00000003) as its immediate parent and appears once in every geometry item.&lt;br /&gt;
&lt;br /&gt;
{| {{Introduced as follows:}}&lt;br /&gt;
| SectionID: 0x0000500E (4 bytes)&lt;br /&gt;
| Size of data: (4 bytes, relative to after RW fileversion)&lt;br /&gt;
| RW file version (4 bytes)&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Seggaeman</name></author>
		
	</entry>
	<entry>
		<id>https://gtamods.com/mediawiki/index.php?title=Collision_File&amp;diff=9505</id>
		<title>Collision File</title>
		<link rel="alternate" type="text/html" href="https://gtamods.com/mediawiki/index.php?title=Collision_File&amp;diff=9505"/>
		<updated>2010-12-31T06:17:47Z</updated>

		<summary type="html">&lt;p&gt;Seggaeman: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;All GTA3 games (GTA III, Vice City and San Andreas) have separate files for the visual and physical representations of their [[Wikipedia:Model (computer games)|models]]. '''Collision models''' are often simply an optimized equivalent of the visual model, reduced in poly count and complexity. The [[Wikipedia:game engine|game engine]] uses them for [[Wikipedia:Collision detection|collision]] and [[Wikipedia:Dynamical simulation|physics]] calculations.  Unlike graphics meshes, they are comprised not only of triangles but also spheres and boxes, for which exist faster and more accurate collision algorithms.&lt;br /&gt;
&lt;br /&gt;
One or more collision models are packaged to a '''collision file''', denoted by the [[Wikipedia:file extension |file extension]] &amp;lt;code&amp;gt;.col&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Each collision model is identified by a name, which must be the same as the [[model file]] and the [[item definition]].&lt;br /&gt;
&lt;br /&gt;
== Version Differences ==&lt;br /&gt;
&lt;br /&gt;
The col format was first introduced with [[GTA 3]], referred to as ''version 1'' here. The game's successor [[Vice City]] used exactly the same format.&lt;br /&gt;
&lt;br /&gt;
In the PS2 version of [[GTA San Andreas]], however, a new version was used (''version 2''), which was later updated for the PC and XBOX releases (''version 3'').&lt;br /&gt;
&lt;br /&gt;
=== Feature Matrix ===&lt;br /&gt;
&lt;br /&gt;
The following matrix is supposed to give an in-depth feature overview of the 3 known versions of the GTA collision file format.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;4&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
!Feature&lt;br /&gt;
!Version 1&lt;br /&gt;
!Version 2&lt;br /&gt;
!Version 3&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; |''Supported by games:''&lt;br /&gt;
|-&lt;br /&gt;
|'''GTA III'''||'''Y'''||N||N&lt;br /&gt;
|-&lt;br /&gt;
|'''GTA Vice City'''||'''Y'''||N||N&lt;br /&gt;
|-&lt;br /&gt;
|'''GTA San Andreas (PS2)'''||'''Y'''||'''Y'''||N&lt;br /&gt;
|-&lt;br /&gt;
|'''GTA San Andreas (PC/XBOX)'''||'''Y'''||'''Y'''||'''Y'''&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; | ''Geometric shapes:''&lt;br /&gt;
|-&lt;br /&gt;
|'''Collision spheres'''||'''Y'''||'''Y'''||'''Y'''&lt;br /&gt;
|-&lt;br /&gt;
|'''Collision boxes'''||'''Y'''||'''Y'''||'''Y'''&lt;br /&gt;
|-&lt;br /&gt;
|'''Collision mesh'''||'''Y'''||'''Y'''||'''Y'''&lt;br /&gt;
|-&lt;br /&gt;
|'''Face groups'''||N||'''Y'''||'''Y'''&lt;br /&gt;
|-&lt;br /&gt;
|'''Shadow mesh'''||N||N||'''Y'''&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; | ''Miscellaneous:''&lt;br /&gt;
|-&lt;br /&gt;
|'''Light intensity:'''||N||'''Y'''||'''Y'''&lt;br /&gt;
|-&lt;br /&gt;
|'''Data compression'''||N||'''Y'''||'''Y'''&lt;br /&gt;
|-&lt;br /&gt;
|'''Four character code'''||COLL||COL2||COL3&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Explanation ===&lt;br /&gt;
&lt;br /&gt;
The main difference between the old version 1 format and the new version 2 and 3 formats is the reduced file size. Faces and vertices are only half as big, shrinking models without spheres and boxes to almost 50%.&lt;br /&gt;
&lt;br /&gt;
Also, face groups have been introduced, which should speed up collision tests for large models, provided they are calculated properly.&lt;br /&gt;
&lt;br /&gt;
Another new feature are the light intensity values, which are a simple but effective way to achieve realtime lighting. You can define a 1 byte lighting value per face, which causes characters and vehicles to change their brightness when they step onto the face. This is used to simulate darkness in places where the sun cannot reach, such as under buildings, etc.&lt;br /&gt;
&lt;br /&gt;
And finally version 3 introduces a shadow mesh, which is used to create projected shadows. They only include the faces you want to cast a shadow (like bridges); spheres and boxes are not possible.&lt;br /&gt;
&lt;br /&gt;
You can '''mix''' all formats within one collision file as you wish, just make sure the target game does support all of them (see matrix above).&lt;br /&gt;
&lt;br /&gt;
== File Format ==&lt;br /&gt;
&lt;br /&gt;
As mentioned above, the collision files are containers for one or more collision models. They do not have a header; models are stored linearly without any padding.&lt;br /&gt;
&lt;br /&gt;
So basically, collision files are simply [[archive]]s of collision models.&lt;br /&gt;
&lt;br /&gt;
=== Structures ===&lt;br /&gt;
&lt;br /&gt;
The following data types and structures are used within this article:&lt;br /&gt;
* '''INT8/UINT8''' - signed/unsigned 8 bit integer ''(1 byte)''&lt;br /&gt;
* '''INT16/UINT16''' - signed/unsigned 16 bit integer ''(2 byte)''&lt;br /&gt;
* '''INT32/UINT32''' - signed/unsigned 32 bit integer ''(4 byte)''&lt;br /&gt;
* '''FLOAT''' - single precision floating point number ''(4 byte)''&lt;br /&gt;
* '''TVector''' - float[3] ''(12 byte)''&lt;br /&gt;
&lt;br /&gt;
Some complex structures vary between the format versions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table width=&amp;quot;100%&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;8&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Structure Name&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Version 1&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Version 2/3&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
;TBounds: bounding objects (box &amp;amp; sphere)&amp;lt;br&amp;gt;''(40 byte)''&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 radius  : float;&lt;br /&gt;
 center  : TVector;&lt;br /&gt;
 min, max: TVector;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 min, max: TVector;&lt;br /&gt;
 center  : TVector;&lt;br /&gt;
 radius  : float;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
;TSurface: surface properties&amp;lt;br&amp;gt;''(4 byte)''&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td colspan=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
 material   : uint8;&lt;br /&gt;
 flag       : uint8;&lt;br /&gt;
 brightness : uint8;&lt;br /&gt;
 light      : uint8;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
;TSphere: collision sphere&amp;lt;br&amp;gt;''(20 byte)''&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 radius : float;&lt;br /&gt;
 center : TVector;&lt;br /&gt;
 surface: TSurface;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 center : TVector;&lt;br /&gt;
 radius : float;&lt;br /&gt;
 surface: TSurface;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
;TBox: collision box&amp;lt;br&amp;gt;''(28 byte)''&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td colspan=&amp;quot;2&amp;quot;&amp;gt;&lt;br /&gt;
 min, max: TVector;&lt;br /&gt;
 surface : TSurface;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
;TFaceGroup: face group (see below)&amp;lt;br&amp;gt;''(28 byte)''&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;th&amp;gt;&lt;br /&gt;
(not used)&lt;br /&gt;
&amp;lt;/th&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 min, max: TVector;&lt;br /&gt;
 StartFace,&lt;br /&gt;
 EndFace : uint16;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
;TVertex: collision mesh vertex&amp;lt;br&amp;gt;''(12 or 6 byte)''&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 float[3]&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 int16[3]&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
;TFace: collision mesh face&amp;lt;br&amp;gt;''(16 or 8 byte)''&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 a, b, c: uint32;&lt;br /&gt;
 surface: TSurface;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 a, b, c : uint16;&lt;br /&gt;
 material: uint8;&lt;br /&gt;
 light   : uint8;&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* all boxes are axis-aligned&lt;br /&gt;
&lt;br /&gt;
=== Header ===&lt;br /&gt;
&amp;lt;table width=&amp;quot;100%&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;8&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 char {4}        - FourCC (&amp;quot;COLL&amp;quot;, &amp;quot;COL2&amp;quot; or &amp;quot;COL3&amp;quot;)&lt;br /&gt;
 uint32 {4}      - file size from after this value (so 8 byte less)&lt;br /&gt;
 char {20}       - collision model name&lt;br /&gt;
 char {4}        - unused, probably part of the name,&lt;br /&gt;
                   but could never be used since dir/img entries are only 24 byte&lt;br /&gt;
                   (and 4 byte are needed for the extension)&lt;br /&gt;
 TBounds {40}    - bounding objects, see above&lt;br /&gt;
 &lt;br /&gt;
 if (Version &amp;gt;= 2) {&lt;br /&gt;
   uint16 {2}    - number of collision spheres&lt;br /&gt;
   uint16 {2}    - number of collision boxes&lt;br /&gt;
   uint32 {4}    - number of collision mesh faces&lt;br /&gt;
   uint32 {4}    - flags&lt;br /&gt;
   uint32 {4}    - offset collision spheres&lt;br /&gt;
   uint32 {4}    - offset collision boxes&lt;br /&gt;
   uint32 {4}    - unknown offset (0)&lt;br /&gt;
   uint32 {4}    - offset collision mesh vertices&lt;br /&gt;
   uint32 {4}    - offset collision mesh faces&lt;br /&gt;
   uint32 {4}    - unknown offset 2 (0)&lt;br /&gt;
 &lt;br /&gt;
   if (Version = 3) {&lt;br /&gt;
     uint32 {4}  - number of shadow mesh faces&lt;br /&gt;
     uint32 {4}  - offset shadow mesh vertices&lt;br /&gt;
     uint32 {4}  - offset shadow mesh faces&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* All offsets in col 2/3 format are relative to after the fourcc, so file offset + 4.&lt;br /&gt;
* Col 2/3 format does not store the number of vertices. Normally you do not need that, since you would just add the vertex index to the offset in your pointer. But if you do need it, scan the faces for the largest index.&lt;br /&gt;
&lt;br /&gt;
'''Flags:'''&lt;br /&gt;
* 2 - not empty (collision model has spheres or boxes or a mesh)&lt;br /&gt;
* 8 - has face groups (if not empty)&lt;br /&gt;
* 16 - has shadow mesh (col 3)&lt;br /&gt;
* apparently other flags are not used&lt;br /&gt;
&lt;br /&gt;
=== Body ===&lt;br /&gt;
&amp;lt;table width=&amp;quot;100%&amp;quot; border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;8&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Version 1&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Version 2/3&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 uint32 {4}    - number of col. spheres&lt;br /&gt;
 TSphere[] {*} - col. sphere array&lt;br /&gt;
 &lt;br /&gt;
 uint32 {4}    - number of unk. data (0)&lt;br /&gt;
 &lt;br /&gt;
 uint32 {4}    - number of col. boxes&lt;br /&gt;
 TBox[] {*}    - col. box array&lt;br /&gt;
 &lt;br /&gt;
 uint32 {4}    - number of col. vertices&lt;br /&gt;
 TVertex[] {*} - col. mesh vertex array&lt;br /&gt;
 &lt;br /&gt;
 uint32 {4}    - number of col. faces&lt;br /&gt;
 TFace[] {*}   - col. mesh face array&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&lt;br /&gt;
 TSphere[] {*}   - col. sphere array &lt;br /&gt;
 &lt;br /&gt;
 TBox[] {*}      - col. box array&lt;br /&gt;
 &lt;br /&gt;
 TVertex[] {*}   - col. mesh vertex array&lt;br /&gt;
 char {2}        - optional padding&lt;br /&gt;
 &lt;br /&gt;
 FaceGroup[] {*} - col. mesh face groups&lt;br /&gt;
 uint32 {4}      - number of face groups&lt;br /&gt;
 &lt;br /&gt;
 TFace[] {*}     - col. mesh face array&lt;br /&gt;
&lt;br /&gt;
 TVertex[] {*}   - shad. mesh vertex array&lt;br /&gt;
 char {2}        - optional padding&lt;br /&gt;
 TFace[] {*}     - shad. mesh face array&lt;br /&gt;
&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The unknown section was presumably planned to hold a set of lines, used for collisions with very thin objects (like railings). But this was never confirmed, nor is it used anywhere.&lt;br /&gt;
* The sequence of sections in the col 2/3 format as given above can be observed in every file sample. However, since there are offsets now, you could order them however you want.&lt;br /&gt;
* There is no offset to face groups, reading them is optional. To read them, go to the start of the face array, go back 4 byte, read the ammount of groups, and go back 28*GroupCount byte. But check the flag in the header for existance of face groups first.&lt;br /&gt;
* Vertex indices (a, b and c) in a TFace structure use a 0 based index. The same applies for StartFace and EndFace in TFaceGroup.&lt;br /&gt;
* The 2 byte padding after the vertex arrays in col 2/3 is used to provide a 4 byte alignment. It is present if the array's length leaves a rest when divided by 4, i.e. (VertexCount*6) mod 4 != 0.&lt;br /&gt;
&lt;br /&gt;
== Annotations ==&lt;br /&gt;
=== Data Compression and Limits ===&lt;br /&gt;
&lt;br /&gt;
In the col 2/3 format not only face indices take up half as much space (uint16 instead of uint32); also vertex coordinates are now stored as so-called [[Wikipedia:Fixed-point arithmetic|fixed-point numbers]].&lt;br /&gt;
&lt;br /&gt;
To convert such an int16 number to a floating point number, simply '''divide it by 128.0'''.&lt;br /&gt;
&lt;br /&gt;
But there is one major disadvantage you have to take care of: meshes are limited to dimensions of +/- 255.99 units on each axis. But this should be no problem, since objects bigger than that would defy the whole purpose of the streaming engine, and should never be used.&lt;br /&gt;
&lt;br /&gt;
=== Face Groups ===&lt;br /&gt;
&lt;br /&gt;
Faces in large col 2/3 meshes (more than 80 faces) are grouped by location, and get a bounding box. This way collision checks can be limited to a special area of interest, to speed them up significantly.&lt;br /&gt;
&lt;br /&gt;
Some statistics: There is an minimum average of 13.8 faces per group, maximum is 50{{ref|1}}. On average there are 31.75 faces per group.&lt;br /&gt;
&lt;br /&gt;
{{note|1}} In the grouping algorithm, a face count of &amp;gt; 50 is the criterion to split a group.&lt;br /&gt;
&lt;br /&gt;
=== Shadow Mesh ===&lt;br /&gt;
&lt;br /&gt;
The so-called &amp;quot;shadow mesh&amp;quot; introduced with version 3 is used to cast real-time shadows in GTA SA. Again, to save cpu time these are reduced to significant parts of the object, like bridges on map parts. Very important is that they '''always have to be closed!''' If there are holes in your mesh, you will get odd projection errors, with shadow triangles floating around.&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
=== Version 1 only ===&lt;br /&gt;
* [[CollMaker]] [http://www.steve-m.com/downloads/tools/collmaker/] by [[User:Steve-m|Steve M.]] (2002)&amp;lt;br&amp;gt;''Very simple tool that creates single model collision files based on text cordinates as input, such as the text .x files.''&lt;br /&gt;
* [[CollEditor]] [http://www.steve-m.com/downloads/tools/colleditor/] by [[User:Steve-m|Steve M.]] (2003)&amp;lt;br&amp;gt;''The first 3D editor for collision files. Allowed simple modification and management of collision models. Not very user-friendly, though, and not bug-free.''&lt;br /&gt;
* [[Col IO]] [http://gtatools.com/pafiledb/pafiledb.php?action=file&amp;amp;id=16] by [[User:Delfi|Delfi]] (2004)&amp;lt;br&amp;gt;''Another 3D editor. Unlike CollEditor, this one allowes to drag spheres, boxes and vertices comfortably with the mouse. Mainly suited for vehicles and quite buggy.''&lt;br /&gt;
&lt;br /&gt;
=== All versions ===&lt;br /&gt;
* [[KAMS]] [http://www.gtaforums.com/index.php?showtopic=218318] by [[User:Kam|Kam]] (2005)&amp;lt;br&amp;gt;''A collection of scripts for [[Wikipedia:3D Studio Max|3D Studio Max]], including one for import/export of collision files. Does not support face groups.''&lt;br /&gt;
* [[CollEditor II]] [http://www.steve-m.com/downloads/tools/colleditor2/] by [[User:Steve-m|Steve M.]] (2005)&amp;lt;br&amp;gt;''And yet another 3D editor, with many features.''&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* {{GTAF|291542|What's the use of collision spheres?}}&lt;br /&gt;
* {{Icon|4}} [[WBD-WBN]] - new format used in GTA IV&lt;br /&gt;
&lt;br /&gt;
{{N|SA|VC}}&lt;br /&gt;
[[Category:3D File Formats]][[Category:GTA 3]]&lt;/div&gt;</summary>
		<author><name>Seggaeman</name></author>
		
	</entry>
</feed>