Phoenix uses .xml files to store information about what textures a certain model should use as well as other information such as what shader it should use. This is the file you choose when loading an object. Here is an example object .xml file:
<?xml version="1.0" ?> <Object> <Model>Data/Mods/example_mod/Data/Models/SimpleObject.obj</Model> <ColorMap>Data/Mods/example_mod/Data/Textures/SimpleObject_Color.tga</ColorMap> <NormalMap>Data/Mods/example_mod/Data/Textures/Blank_Norm.tga</NormalMap> <ShaderName>envobject #TANGENT</ShaderName> <MaterialPath>Data/Materials/default.xml</MaterialPath> </Object>
All object .xml files that ship with the game are located in ../Overgrowth/Data/Objects/.
Model and Texture Requirements
- Only triangles in models
- Models use the Wavefront .obj format
- Textures need to be square
- Texture resolution need to be a power of two (32x32, 64x64, 128x128 and so on)
- The .tga format is recommended for textures, but .png and .tif work also.
Converting normal maps
The normal maps that you get from some applications might not be instantly usable in the Phoenix engine without some edits. For instance, if you are using an object space normal map from Substance Designer you need to do this:
- Invert the blue channel
- Swap blue and green channels
You can do this in Photoshop, Substance Designer, Channel Shuffle or similar. Note that Gimp does not work well with alpha channels. So if your alpha channel is anything but solid white, using Gimp to convert the normal map will change your normal map in undesirable ways.
Object .xml File
The object .xml files contain all information about a single object (model) that can be spawned in the engine. This aims to be a full reference over all tags and flags that can be used in an object .xml.
|path to the model file (.obj)|
|path to the color texture file (.tga, .tif or .png)|
|Path to the normal map texture file (.tga, .tif or .png)|
<ShaderName>envobject #TANGENT #KEEP_SPEC</ShaderName>
|What shader to use, see shaders for more information|
|Path to the material to use, see materials for more information.|
|Path to a black and white texture used for determining where each detail texture should be used. Required when using the detailmap4 shader.|
|Path to a color texture used for translucency, meaning light that shines through the object. Adds its color to the surface multiplied by the amount of light it receives, this effect ignores the normal of the surface, so if one side receives light from for instance the sun, the other side will also get the color added. If unspecified it defaults to 0.0 (no translucency) across the entire surface. Optional when using the plant shader.|
|Path to a black and white texture used to define the intensity of a vertex wind effect. If unspecified it defaults to 1.0 (active) across the entire surface. Optional when using the plant shader.|
<DetailMaps> <DetailMap colorpath="Data/Textures/Terrain/DetailTextures/gray_rock.tga" normalpath="Data/Textures/Terrain/DetailTextures/gray_rock_normal.tga" materialpath="Data/Materials/rocks.xml" /> ... </DetailMaps>
|Contains exactly 4 <DetailMap> tags describing textures and materials that will be tiled across the model using the <WeightMap> tag's texture. Required when using the detailmap4 shader.|
<DetailObjects> <DetailObject obj_path="Data/Objects/Plants/Groundcover/Groundcover1.xml" weight_path="Data/Textures/Environments/Rocks/granite_vine_rocks/granite_vine_boulder_overgrown_vine_mask.tga" normal_conform="0.9" density="10" min_embed="0" max_embed="0.4" min_scale="0.7" max_scale="2" view_distance="40" jitter_degrees="10" overbright="0" /> </DetailObjects>
|Contains one or more <DetailObject> tags, each describing how to randomly distribute some object across the surface. Can be used for grass, small rocks etc.|
<flags no_collision=true double_sided=true/>
|Used to set boolean values on the object (see flags)|
|Moves the object up/down by the set amount when the object is created|
These tags are deprecated and should not be used.
|path to the shader to use (.frag & .vert), replaced by ShaderName|
These are the materials that can be assigned to objects using the
<MaterialPath> tag. You can find the materials in
../Overgrowth/Data/Materials/. The material affects what particles spawn when a character runs on the surface, what sound footsteps make on the surface, how easily weapons stick in the surface, and more.
Flags are entered as boolean attributes ("true" or "false") in a tag called "flags" under the "Object" tag. All flags have a default value of false.
|no_collision||Disables physics collisions with this object.|
|double_sided||The backsides of the object gets rendered as well.|
|bush_collision||Makes the object give some resistance when passed through while the object wobbles a bit and generates leaf particles.|
The engine automatically generates a simplified physics object from your model but this can be overridden by providing an alternative .OBJ file. The file is placed in the same folder and shares the same name as the original .OBJ file with a suffix:
|YourObject_COL.obj||Contains simplified geometry for physics calculations.|
|YourObjectHULL.obj||Same as _COL but has extra info, used for weapons.|
Note that HULL doesn’t have an underscore to separate it from the file name!
Physics objects (_COL)
Simplified geometry such as boxes and cylinders which are used for collision detection, they are aligned to your object based on “relative position” in your 3D program so you should place the physics mesh on top of your render mesh upon export.
Hull objects (HULL)
They are very similar to physics objects but are used for items and weapons, the only difference is that they contain a free-floating triangle which defines the object’s center of gravity.
Overgrowth uses an "uber shader" approach to shader management, which means that there is one huge shader that almost everything in the game uses. So instead of choosing a shader for your object, you can set "flags" with your object that the game will use to change how it's rendered.
The flags are put in the <ShaderName> tag after the shader name. Here is an example:
<ShaderName>envobject #TANGENT #KEEP_SPEC</ShaderName>
"#TANGENT" and "#KEEP_SPEC" in this example are flags.
There are two texture maps that are required for an object to be loaded in the engine. Those are the ColorMap and the NormalMap textures. Some flags allow you to use more than these two required textures, and some flags change how the required textures are used. TODO: Are there any default textures that can be used and what are they?
Here is the channel designations of the ColorMap and NormalMap textures:
RGB - Color
A - Reflectivity
RGB - Normal
A - Color tint mask
Any deviation from these designations or new textures caused by any flag in the table below can be seen in the Channel/Texture Changes column.
|#TANGENT||The normal map is used as an object space normal map by default, with this flag it's used as a tangent space normal map instead.|
|Instead of using the alpha channel of the normal map as a color tint mask, as is the default, that channel is used as a smoothness map. The object can still be tinted, you just can't control what parts get tinted.|
| Allows for repeating up to 4 different textures over a model so it looks more detailed up close. This also means you can scale the model up or down with less obvious texture stretching.
|#BASE_TANGENT||TODO: What does this do?|
|#AXIS_UV||TODO: What does this do?|
|#AXIS_BLEND||TODO: What does this do?|
|#NO_DECALS||No decals shows up on this object.|
|#WHY_DOES_THIS_WORK||TODO: What does this do?|
|#INVISIBLE||This object will not be rendered.|
Makes the alpha channel of the ColorMap work as transparency instead of reflectivity
|#WATER||TODO: What does this do?|
Color Tint Mask
This mask is located in the alpha channel of the normal map, and determines what parts of the object should be tinted when using the color picker. Black parts are not affected, the brighter the texel the more it is affected by tinting.