Materials - Outerra/anteworld GitHub Wiki
Material Definition
"name" : "example", // Material name
"shader" : "alpha_masked", // Add this line to use alpha masked geometry (single-sided faces).
Pixels below 0.75 are discarded
"color" : "1.0,1.0,1.0,1.0", // Albedo multiplier (in linear space not sRGB)
"f0" : "0.039" // f0 value used when there is no reflectance texture specified
"reflectance_multiplier" : "1.0", // reflection multiplier for the value fetched from texture
"roughness" : "1.0", // Roughness parameter range 0-1, 0 - glossy, 1 - matte
"no_light" : false, // If false lights are not computed for this material
"emissive" : false, // True means that the material will be emissive if tex_emissive and emissive_color are configured properly
"emissive_color" : "1.0,1.0,1.0,0.0", // Emissive multiplier (in linear space or uchar (255, 255, 255, 255))
"sun_lag" : 0.0, // *1
"max_temperature_black" : 40, // *1
"max_temperature_white" : 20, // *1
"thermal" : "", // *1
"tex_albedo" : "example_tex_albedo.dds", // Albedo texture must be DXT1 format
"tex_normal" : "example_tex_normal.dds", // Normal texture must be DXT5/3dc2/ATI2 format
"tex_roughness" : "example_tex_roughness.dds", // Roughness texture (usually negative specular map) must be in BC4/ATI1 format
"tex_opacity" : "", // Opacity texture must be in BC4/ATI1 format
"tex_reflectance" : "", // F0 reflection map(default texture has value of 0.04). Must be in BC4/ATI1 format.
"tex_environment" : "", // Local environment map (not used yet) must be in DXT1 format
"tex_emissive" : "" // Emission texture - masks emissive areas of the material. DXT1 format.
"tex_ambient_occlusion" : "" // Ambient occlusion texture must be in BC4/ATI1 format.
"tex_ambient_occlusion_secondary" : "" // Optional secondary ambient occlusion texture mapped on second UV channel.
*1 See Thermal materials
--Outerra uses neither metal-rough
nor spec-gloss
PBR workflow.
--Please do not forget that color
, roughness
, f0
and emissive_color
are just multipliers of their respective texture (tex_albedo
, tex_roughness
, tex_reflectance
and tex_emissive
).
"shader" : "decal"
can be used for decals. Can use opacity. Geometry must be placed on top of opaque geometry, otherwise shadows are not correct.
Textures
Using nvcompress
For generating outerra friendly dds textures it is highly recommended to use nvcompress.exe
that can be found inside the bin
folder.
Texture | Compression | Additional switch |
---|---|---|
albedo | -bc1 | |
normal | -bc5 or -bc1 | -normal (-bc5 for high quality or -bc1 for smaller size, but more artifacts) |
roughness | -bc4 | -linear |
roughness (improved mips) | -bc4 | -linear -normal_to_roughness normalmap.png |
opacity (alpha blending) | -bc4 | -linear |
opacity (alpha masking) | -bc4 | -linear -coverage 0.75 0 (enhance mip-maps) * |
reflectance | -bc4 | -linear |
emissive | -bc1 | |
ambient occlusion | -bc4 | -linear |
CDR | -bc1 |
*The source texture needs to be grayscale, NOT RGB, for the coverage to be applied properly
Albedo and emissive texture must be sRGB, which is default (=> no additional switch).
The compression determines which channels are stored and their resolution. Detailed info can be found here.
Example usage (albedo, normal, roughness, reflectance, opacity (alpha blending), opacity (alpha masked):
C:\Outerra\bin\bin\nvcompress.exe -bc1 "input_al.png" "output_al.dds"
C:\Outerra\bin\bin\nvcompress.exe -bc5 -normal "input_nn.png" "output_nn.dds"
C:\Outerra\bin\bin\nvcompress.exe -bc4 -linear "input_rg.png" "output_rg.dds"
C:\Outerra\bin\bin\nvcompress.exe -bc4 -linear "input_f0.png" "output_f0.dds"
C:\Outerra\bin\bin\nvcompress.exe -bc4 -linear "input_op.png" "output_op.dds"
C:\Outerra\bin\bin\nvcompress.exe -bc4 -linear -coverage 0.75 0 "input_path_op.png" "output_path_op.dds"
--nvcompress.exe
depends on nvtt.dll
. Beware: if the .dll is missing the .exe fails without any message!
--if you want to be able to use nvcompress from any path, you can copy the .exe to c:\windows\system32
and the .dll to
c:\windows\SysWOW64
Default textures
If texture is not defined it is replaced by a small texture with following default values:
Texture | Default value |
---|---|
albedo | 255,255,255 |
normal | 127,127 |
roughness | 255 |
opacity | 255 |
reflectance | 10 (0.04f) |
emissive | 255 |
ambient occlusion | 255 |
sRGB <-> linear conversion
These conversions are done internally in the engine. You just need to make sure that you store albedo and emissive textures in the sRGB and all others in the linear space. If you use Substance Painter you can verify this by checking your texture set settings:
Outerra's PBR textures
Albedo
Defines the base color of the material. The final albedo value is computed by:
albedo_{final}=color*tex_{albedo}
--This texture has the same meaning in the metal-rough workflow
--Must be stored in sRGB space
Roughness
Defines the roughness of the material. The final roughness value is computed by:
roughness_{final}=roughness*tex_{roughness}
--This texture has the same meaning in the metal-rough workflow
--Must be stored in linear space
--Roughness can be obtained by inverting glosiness map (from spec-gloss workflow)
Reflectance (f0)
F0 defines material characteristics, basically it means how much light is reflected from the material and how much light is reflected as diffuse. For standard dielectric materials it's usually 0.04 (4%) and it means 4% light is reflected from the material if we are looking at surface perpendicularly.
Final F0 value is computed by equation:
F0_{final} = reflectance\_multiplier * tex_{reflectance}
Reflectance map is used if two very different materials are needed in one texture for example leather book cover with gold lettering. This approach is much easier than splitting mesh. Values greater than 0.4 will create metallic appearance.
Example F0 values:
Material | f0 |
---|---|
Quartz | 0.045593921 |
Ice | 0.017908907 |
Water | 0.020373188 |
Alcohol | 0.01995505 |
Glass | 0.08 |
Milk | 0.022181983 |
Ruby | 0.077271957 |
Crystal | 0.111111111 |
Diamond | 0.171968833 |
Skin | 0.028 |
--This texture is similar to specular texture from spec-gloss workflow, but it has only 1 channel. Metallic materials in spec-gloss workflow have black (0,0,0) diffuse color and the actual color is stored in the specular texture. In outerra, we have the color always stored in the albedo and therefore this is just grayscale texture.
--Must be stored in linear space
--In Substance Painter this is called f0 map. Note: SP calculates f0 map from Metallic map.
Emissive
Defines color of the light that the material emits.
--Must be stored in sRGB
--Do not forget to set the bool emissive
to true and emissive_color
multiplier for emission to work
Useful links (mandatory reading)
- https://seblagarde.wordpress.com/2011/08/17/feeding-a-physical-based-lighting-mode/
- https://seblagarde.wordpress.com/2012/04/30/dontnod-specular-and-glossiness-chart/
- http://www.crytek.com/download/fmx2013_c3_art_tech_donzallaz_sousa.pdf
- https://www.marmoset.co/posts/pbr-texture-conversion/
- https://www.allegorithmic.com/pbr-guide