Difference between revisions of "RpMaterial"

From GTAMods Wiki
Jump to navigation Jump to search
(Cleaned up a bit and added version information to struct format.)
Line 1: Line 1:
 
{{RW Section|Material|0x0007}}
 
{{RW Section|Material|0x0007}}
  
'''Material''' is a container section used in [[model file|DFF files]] as child of a [[Material List (RW Section)|Material 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. A ''material'' section is used to hold one or more texture maps.
+
'''RpMaterial''' is a [[RenderWare]] structure that stores geometric data for 3D geometry.
  
== Structure ==
+
== Stream Structure ==
  
The structure of the material section defines information about the amount and appearance of the texture maps.
+
When streamed in/out it is usually the child of a [[Material List (RW Section)|Material List]] chunk and parent of a [[Struct (RW Section)|Struct]], optional [[Texture (RW Section)|Texture]] and [[Extension (RW Section)|Extension]] chunk.
  
4b - DWORD  - Material flags (unused)
+
The format of the Material's Struct chunk is as follows:
4b - DWORD  - Color (RwRGBA)
 
4b - DWORD  - Unused field
 
4b - BOOL  - Is material textured
 
4b - FLOAT  - Ambient
 
4b - FLOAT  - Specular
 
4b - FLOAT  - Diffuse
 
  
== Child sections ==
+
int32        flags (unused)
 +
RwRGBA      color    (RwRGBA: uint8 r, g, b, a)
 +
int32        unused
 +
bool32      isTextured
 +
#if version > 0x30400
 +
  surface properties:
 +
    float32  ambient
 +
    float32  specular
 +
    float32  diffuse
 +
#endif
  
If the material is defined as textured above there'll be a child texture section.
+
If the material is defined as textured above, a [[Texture (RW Section)|Texture]] chunk will follow the Struct.
 
 
* [[Texture (RW Section)|Texture]]
 
  
 
=== Extension ===
 
=== Extension ===
  
Additionally each ''material'' can hold an extension. This extension holds the following sections in the order they are listed in here.
+
The extension of an material can hold the following chunks in GTA:
  
 +
* [[Right To Render (RW Section)|Right To Render]]
 
* [[Material Effects PLG (RW Section)|Material Effects PLG]]
 
* [[Material Effects PLG (RW Section)|Material Effects PLG]]
 +
* [[UV Animation PLG (RW Section)|UV Animation PLG]]
 
* [[Reflection Material (RW Section)|Reflection Material]]
 
* [[Reflection Material (RW Section)|Reflection Material]]
 
* [[Specular Material (RW Section)|Specular Material]]
 
* [[Specular Material (RW Section)|Specular Material]]
* [[UV Animation PLG (RW Section)|UV Animation PLG]]
 
  
 
== See also ==
 
== See also ==

Revision as of 13:03, 1 September 2016

{{{NAME}}}
RenderWare Stream Section
Vendor {{{VENDORNAME}}}
Module {{{MODULENAME}}}
Module ID 0x{{{MODULEID}}}
Identifier 0x{{{IDENTIFIER}}}
Chunk ID 0x{{{MODULEID}}}{{{IDENTIFIER}}}
Versions All
Hierarchy
Parents:
None
Children:
None
Extensions:
None
File Format

RpMaterial is a RenderWare structure that stores geometric data for 3D geometry.

Stream Structure

When streamed in/out it is usually the child of a Material List chunk and parent of a Struct, optional Texture and Extension chunk.

The format of the Material's Struct chunk is as follows:

int32        flags (unused)
RwRGBA       color    (RwRGBA: uint8 r, g, b, a)
int32        unused
bool32       isTextured
#if version > 0x30400
  surface properties:
    float32  ambient
    float32  specular
    float32  diffuse
#endif

If the material is defined as textured above, a Texture chunk will follow the Struct.

Extension

The extension of an material can hold the following chunks in GTA:

See also