User Tools

Site Tools


modding:developerinfo:models:materials

Table of Contents

Materials

Materials are stored in the .mtl format in the res\models\material\ folder.

Overview

The format mainly consists of a list of properties. The material type (type) specifies the required set of properties (see below for a reference). order is used for sorting the materials for rendering, if two materials have the same type.

function data()
return {
  order = 0,          -- render order (used for same materials only)
  params = {          -- holds list of properties
 
  },
  type = "PHYSICAL"   -- material type
}
end

Reference

Properties
props = {                     -- properties for standard-shading (Phong reflection model)
  coeffs = { 1, 1, 0.25, 20 } -- Ka, Kd, Ks, specular exponent (shininess)
}
two_sided = {                 -- two sided materials
  twoSided = false,
  flipNormal = false
}
light_scale = {
  lightScale = 15.0           -- scale RGB-texture-value of emissive materials
}
alpha_scale = {
  alphaScale = 1.0            -- scale alpha value of transparent materials
}
normal_scale = {
  normalScale = 1.0           -- scale normals of materials with normal mapping
}
alpha_test = {
  preferAlphaToCoverage = false,  -- enable Alpha to coverage (requires multisampling)
  alphaThreshold = 0.5,       -- discard pixels with lower alpha
  blend = true                -- enable alpha blending
}
color_blend = {
  albedoScale = 0.07,         -- scale gray value (which is overlayed with color)
  color = { 50/255, 85/255, 38/255} -- color used for blending
}
 
color_blend = {
  albedoScales = { 1.1, 1.9, 1.8, 0.5 },
  colors = { }
}
dirt_rust = {
  dirtColor = { 62/255, 58/255, 51/255 },
  dirtOpacity = 5/100,
  dirtScale = 100/12.5,
 
  rustColor = { 89/255, 61/255, 38/255 },
  rustOpacity = 50/100,
  rustScale = 100/34.77
}
fade_out_range = {           -- start/end for calculating fade out alpha
  fadeOutEndDist = 20000,
  fadeOutStartDist = 10000,
}
polygon_offset = {           -- parameters for OpenGL function glPolygonOffset()
  factor = -4.0,
  units = -4.0
}

Maps

Maps are used to describe the textures used by a material. There are three types: two dimensional (TWOD), cube map (CUBE_MAP) and an array of two dimensional textures (TWOD_ARRAY). The accepted file formats are TGA and preferably DDS.

map_albedo_opacity = {
  type = "TWOD",                      -- texture type: TWOD, CUBE_MAP, TWOD_ARRAY
  fileName = "models/vehicle/bus/bus_d40_albedo_opacity.dds",
 
  magFilter = "LINEAR",               -- maps to GL_TEXTURE_MAG_FILTER: NEAREST, LINEAR
  minFilter = "LINEAR_MIPMAP_LINEAR", -- maps to GL_TEXTURE_MIN_FILTER: NEAREST, LINEAR, LINEAR_MIPMAP_LINEAR
  wrapS = "CLAMP_TO_EDGE",            -- maps to GL_TEXTURE_WRAP_S: REPEAT, CLAMP_TO_EDGE
  wrapT = "CLAMP_TO_EDGE",            -- maps to GL_TEXTURE_WRAP_T: REPEAT, CLAMP_TO_EDGE
 
  mipmapAlphaScale = 0,               -- scale alpha channel on mip map generation
  compressionAllowed = true,          -- texture compression
  redGreen = false,                   -- two channel format (BC5)
  scaleDownAllowed = false            -- texture can be scaled down, if texture quality is not set to 'Very high'
}

Operations

A material can use multiple overlay operations (currently at most two) with textures. For each operation, a map and a set of parameters have to be specified. Apart from being disabled (NO_OP), there are three types of operations. There are three modi of obtaining the texture coordinates for the overlay texture: use the local coordinates (NORMAL), the world coordinates (WORLD_XY) or the uv-coordinates (TEXCOORD).

operation = {
  op = "OVERLAY",        -- NO_OP, MULTIPLICATION, OVERLAY, LINEAR_BURN
  mode = "NORMAL",       -- TEXCOORD, WORLD_XY, NORMAL
  scale = { 0.05, 0.5 }, -- scale of overlay texture
  opacity = 0.5          -- opacity of operation
},
 
map_op = {
 
}
Material Types

REFLECTIVE

  • props
  • two_sided
  • map_color_reflect
  • fade_out_range
  • map_env
  • polygon_offset

REFLECTIVE_NRML_MAP

  • props
  • two_sided
  • map_color_reflect
  • map_normal
  • fade_out_range
  • map_env
  • polygon_offset

REFLECTIVE_OP

  • props
  • operation
  • two_sided
  • map_color_reflect
  • fade_out_range
  • map_env
  • map_op
  • polygon_offset

REFLECTIVE_NRML_MAP_OP

  • operation
  • props
  • map_normal
  • map_color_reflect
  • two_sided
  • fade_out_range
  • map_env
  • polygon_offset
  • map_op

PHYSICAL

  • two_sided
  • fade_out_range
  • map_metal_gloss_ao
  • map_albedo
  • polygon_offset

PHYSICAL_OP

  • two_sided
  • operation_1
  • map_metal_gloss_ao
  • fade_out_range
  • operation_2
  • polygon_offset
  • map_albedo
  • map_op_1
  • map_op_2

PHYSICAL_NRML_MAP

  • two_sided
  • map_normal
  • fade_out_range
  • map_metal_gloss_ao
  • map_albedo
  • polygon_offset
  • normal_scale

PHYSICAL_NRML_MAP_CBLEND

  • map_normal
  • two_sided
  • map_metal_gloss_ao
  • fade_out_range
  • polygon_offset
  • map_albedo
  • map_cblend
  • color_blend
  • normal_scale

PHYSICAL_NRML_MAP_CBLEND_DIRT

  • map_normal
  • two_sided
  • map_metal_gloss_ao
  • fade_out_range
  • map_albedo
  • polygon_offset
  • map_cblend_dirt_rust
  • map_dirt
  • map_dirt_normal
  • map_rust
  • map_rust_normal
  • color_blend
  • dirt_rust
  • normal_scale

PHYSICAL_NRML_MAP_OP

  • map_normal
  • two_sided
  • operation_1
  • map_metal_gloss_ao
  • fade_out_range
  • polygon_offset
  • map_albedo
  • map_op_1
  • map_op_2
  • operation_2
  • normal_scale

PHYSICAL_NRML_MAP_CBLEND_OP

  • map_normal
  • two_sided
  • map_metal_gloss_ao
  • fade_out_range
  • polygon_offset
  • map_albedo
  • map_cblend
  • map_op_1
  • map_op_2
  • color_blend
  • operation_1
  • operation_2
  • normal_scale

PHYSICAL_NRML_MAP_OP_UV1_AO

  • map_normal
  • two_sided
  • map_metal_gloss_ao
  • fade_out_range
  • polygon_offset
  • map_albedo
  • map_op_1
  • map_ao
  • map_op_2
  • operation_1
  • operation_2
  • normal_scale

PHYSICAL_NRML_MAP_OP_UV1_AO

  • map_normal
  • two_sided
  • map_metal_gloss_ao
  • fade_out_range
  • polygon_offset
  • map_albedo
  • map_op_1
  • map_ao
  • map_op_2
  • operation_1
  • operation_2
  • normal_scale

PHYSICAL_OP_GLOSS_ONLY

  • two_sided
  • fade_out_range
  • operation_1
  • map_albedo_gloss
  • map_op_2
  • map_op_1
  • polygon_offset
  • operation_2

PHYSICAL_OP_GLOSS_ONLY

  • two_sided
  • fade_out_range
  • operation_1
  • map_albedo_gloss
  • map_op_2
  • map_op_1
  • polygon_offset
  • operation_2

SKINNING_TEXTURED

  • props
  • two_sided
  • map_color

SKINNING_PHYS_CBLEND4

  • two_sided
  • map_albedo
  • map_cblend
  • map_metal_gloss_ao
  • color_blend

SKINNING_PHYS_NRML_MAP_CBLEND4

  • two_sided
  • map_normal
  • map_albedo
  • map_cblend
  • map_metal_gloss_ao
  • color_blend
  • normal_scale

PHYSICAL_ALPHA_NRML_MAP

  • map_normal
  • two_sided
  • normal_scale
  • alpha_scale
  • map_albedo_alpha
  • alpha_test
  • map_metal_gloss_ao
  • fade_out_range
  • polygon_offset

PHYSICAL_ALPHA_NRML_MAP_OP

  • map_normal
  • two_sided
  • map_albedo_alpha
  • alpha_test
  • alpha_scale
  • normal_scale
  • map_metal_gloss_ao
  • fade_out_range
  • map_op_1
  • map_op_2
  • polygon_offset
  • operation_1
  • operation_2

PHYS_TRANSPARENT

  • two_sided
  • map_albedo_opacity
  • alpha_scale
  • alpha_test
  • fade_out_range
  • map_metal_gloss_ao
  • polygon_offset

PHYS_TRANSPARENT_NRML_MAP

  • map_normal
  • map_albedo_opacity
  • two_sided
  • normal_scale
  • alpha_scale
  • alpha_test
  • map_metal_gloss_ao
  • fade_out_range
  • polygon_offset

PHYS_TRANSPARENT_NRML_MAP_CBLEND_DIRT

  • map_normal
  • map_albedo_opacity
  • two_sided
  • alpha_test
  • alpha_scale
  • dirt_rust
  • normal_scale
  • map_metal_gloss_ao
  • fade_out_range
  • map_cblend_dirt_rust
  • map_dirt
  • map_dirt_normal
  • map_rust
  • map_rust_normal
  • polygon_offset
  • color_blend

PHYSICAL_NRML_MAP_CBLEND_DIRT_LOGO

  • map_normal
  • two_sided
  • map_metal_gloss_ao
  • fade_out_range
  • map_albedo
  • polygon_offset
  • map_cblend_dirt_rust
  • map_dirt
  • map_dirt_normal
  • map_rust
  • map_rust_normal
  • map_logo
  • color_blend
  • dirt_rust
  • normal_scale

TRANSPARENT

  • props
  • two_sided
  • alpha_scale
  • alpha_test
  • fade_out_range
  • map_color_alpha
  • polygon_offset

TRANSPARENT_DETAIL

  • props
  • two_sided
  • map_detail
  • alpha_scale
  • alpha_test
  • fade_out_range
  • map_color_alpha
  • polygon_offset

TRANSPARENT_NRML_MAP

  • props
  • two_sided
  • map_normal
  • alpha_scale
  • alpha_test
  • fade_out_range
  • map_color_alpha
  • polygon_offset

TRANSPARENT_OP

  • operation
  • props
  • two_sided
  • alpha_test
  • alpha_scale
  • fade_out_range
  • polygon_offset
  • map_op
  • map_color_alpha

TRANSPARENT_NRML_MAP_OP

  • operation
  • props
  • map_normal
  • two_sided
  • alpha_test
  • alpha_scale
  • fade_out_range
  • map_op
  • map_color_alpha
  • polygon_offset

EMISSIVE

  • two_sided
  • light_scale
  • fade_out_range
  • map_emissive
  • polygon_offset

LEAF_CARD

  • props
  • alpha_scale
  • alpha_test
  • fade_out_range
  • map_color_alpha
  • map_normal

BILLBOARD

  • props
  • alpha_scale
  • alpha_test
  • fade_out_range
  • map_color_alpha
  • billboard
  • map_normal

BILLBOARD_MULTI

  • props
  • fade_out_ranges
  • alpha_scales
  • alpha_test
  • map_color_alpha
  • map_normal
  • billboards
modding/developerinfo/models/materials.txt · Last modified: 2019/03/19 10:18 (external edit)