Modeling Materials


Contents
Related Links

Overview

This document describes Prepar3D® materials in detail, providing many visual examples. The sample settings can be used to great effect when creating new aircraft or other scenery objects using 3ds Max.


The Material Editor


Material Properties

Base Properties

Base Textures

Fresnel Ramps

Specular Maps

Bloom and Ambient Light Scale

Frame Buffer Blending, Shadows, and Texture Clamping


Material Functionality

Z-Bias Level

In order to improve layering materials on the ground for airport ground polygons, Prepar3D has implemented a Z-Bias level material setting.

This functionality only works with "No Z Write" checked on the material. Using values between -1 and -50, you can set and order the layering of the ground polygon textures above the default airport aprons, taxiways and runways. The more negative the Z-bias, the higher layer the material will be. For example, the runway ground polygon could be -1 making it the lower layer, the white runway markings could be the middle layer at -2, the yellow runway markings could be -3 ending as the highest layer. This process can be repeated for up to fifty layers, supporting standard and alpha blended materials.

A: Selected Material: Taxiway marks
B: Z-Bias Level = -10
C: No Z write and No Shadow

Detail Textures

Detail textures now have the ability to be offset, rotated, and scaled along both the U and V axes. Developers now also have control of the blend mode and blend weight of the detail texture. Detail textures can now use the alpha channel as a mask.

Special Functionality

Property Title Description Scriptable
Detail Color The detail color that is always multiplied into the detail texture. The alpha channel of the detail color is used for certain masking operations when enabled and doing transparency. Y
Offset U The texture coordinate offset value applied to the U coordinate of the detail texture mapping. Y
Offset V The texture coordinate offset value applied to the V coordinate of the detail texture mapping. Y
Rotation

The clockwise texture coordinate rotation value applied to the detail texture mapping in degrees.


Note: Texture coordinates are rotated about UV origin (0,0). The detail texture coordinate transformation matrix is multiplied in the following order: scale, rotation, offset.

Y
Scale U The texture coordinate scale value applied to the U coordinate of the detail texture mapping [0.0, 64.0]. Y
Scale V The texture coordinate scale value applied to the V coordinate of the detail texture mapping [0.0, 64.0]. Y
Blend Mode The blend mode of the detail map:
  • Multiply
  • Blend
Y
Blend Weight The source and destination interpolant value used when blending. Y
Use Detail Alpha As Blend Mask Whether or not the detail texture's alpha channel will be used as a mask. Y
Blend diffuse blends by detail blend mask Whether or not to mask diffuse blends with detail blend mask and use detail color alpha. Y
Mask by detail blend mask Whether or not to mask final alpha blend with detail blend mask and use detail color alpha. Y

Note: See the Material Variables article and Material Scripting section for more information on scriptable properties.

Material Scripting

Material scripting allows developers to modify material properties at runtime via a Lua script. A single Lua script can be bound to a single material in the Script Properties group under the Extended Parameter section of the Material Editor. Users can use the Browse button to select the .lua file they would like to assign. Only the filename and extension of the Lua script are required. Scripts can be located in the Prepar3D installation's Scripts subdirectory or any Scripts directory added via Add-on Configuration Files or Add-on Packages. The Lua script will be executed once per frame on a per material basis. During execution, the Lua script will have access to the associated material's properties. Below is an example material script. See the Variables Overview and Material Variables articles for all available variables and material properties when using material scripts.

Example Material Script

!lua

-- Material Season Example.lua
-- An example script demonstrating changing a material's
-- diffuse color based on the month of the year.

local colorRed = 1.0
local colorGreen = 1.0
local colorBlue = 1.0

local month = varget("E:ZULU MONTH OF YEAR", "Number")

if month > 3 then
    colorRed = 0.0
end

if month > 6 then
    colorGreen = 0.0
end

if month > 9 then
    colorBlue = 0.0
end

varset("T:DiffuseColorRed","Number",colorRed)
varset("T:DiffuseColorGreen","Number",colorGreen)
varset("T:DiffuseColorBlue","Number",colorBlue)

Heat and Temperature

Heat and temperature properties are used by IR (infrared) based views. These properties give developers better control over how their objects will appear when rendered in these views. The following heat and temperature material properties are available:

Special Functionality

Property Title Description Scriptable
Use Emissive Map Alpha as Heat Map This check box will cause the emissive map alpha channel to be used as the heat map in an IR view. Checking this setting will override the rendered color with the emissive map alpha channel value. This setting may be used in conjunction with the Temperature Scale property but is not required. N
Temperature Scale The temperature scalar value used by IR views. The default value is 1.0 and the accepted range is [0.0, 10.0]. This scalar is applied regardless of the Use Emissive Map Alpha as Heat Map check box value. This scalar allows developers to render objects completely black, completely white, or anywhere in between. Y

Note: See the Material Variables article and Material Scripting section for more information on scriptable properties.

Example Temperature Scale Script

!lua

-- TemperatureScaleScript.lua
-- Adjusts the temperature scale value based on the time of day.

local secondsPerDay = 60 * 60 * 24
local percentOfDay = varget("E:LOCAL TIME", "Number") / secondsPerDay

-- Scale the temperature from midnight to noon and then back to midnight.
local minimumScale = 0.75
local maximumScale = 1.25

local temperatureScale = 1.0

if percentOfDay < 0.5 then
    temperatureScale = minimumScale + ((percentOfDay / 0.5) * (maximumScale - minimumScale))
else
    temperatureScale = minimumScale + (((1.0 - percentOfDay) / 0.5) * (maximumScale - minimumScale))
end

varset("T:TemperatureScale", "Number", temperatureScale)

IR Scenery Object Sample

A sample scenery object using the IR based heat and temperature properties is included with the SDK. This sample is configured as an add-on and can be viewed by copying the IRSceneryObject directory into the %DOCUMENTS%\Prepar3D v5 Add-ons directory. The sample scenery object will be placed to the right of Runway 19 at Eglin AFB. The sample is located in the following location:

<Lockheed Martin\Prepar3D v5 SDK *>\Modeling\3ds Max\Samples\IRSceneryObject