No Man's Sky Modding Wiki
Tag: Visual edit
No edit summary
Tag: Visual edit
Line 53: Line 53:
 
* T - Transparency/Translucence. (0~1 range) The lower the value, the more transparent the object. (This may require the _F22_TRANSPARENT_SCALAR shader called.)
 
* T - Transparency/Translucence. (0~1 range) The lower the value, the more transparent the object. (This may require the _F22_TRANSPARENT_SCALAR shader called.)
 
gMaterialParamsVec4
 
gMaterialParamsVec4
* X - overall metalness coefficent of your material, if you did not provide a METALLIC_MASK flag.
+
* X - overall roughness coefficient of your material, if you did not provide a ROUGHNESS_MASK flag.
** 1.0 makes the surface generally more metallic (reflections are precise) while values toward 0.0 make the surface less metallic (reflections become blurred and *diffused*)
 
* Y - likely has something to do with the intensity of a detail normal map, still needs further confirmation. This seems to be left at 0.5 by default for most vanilla models.
 
* Z - overall roughness coefficient of your material, if you did not provie a ROUGHNESS_MASK flag.
 
 
** 1.0 makes the surface rougher (less shiny, like charcoal), 0.0 makes it smoother (much more shiny, like glass or a laminated object)
 
** 1.0 makes the surface rougher (less shiny, like charcoal), 0.0 makes it smoother (much more shiny, like glass or a laminated object)
  +
** If _F25_ROUGHNESS_MASK is provided, this value will multiply the final result.
 
* Y - likely has something to do with the intensity of a detail normal map, still needs further confirmation. This seems to be left at 0.5 by default for most vanilla models.
 
* Z - overall metalness coefficent of your material, if you did not provide a METALLIC_MASK flag.
 
** 1.0 makes the surface generally more metallic (reflections are precise) while values toward 0.0 make the surface less metallic (reflections become blurred and *diffused*)
  +
  +
**
 
* T - not used
 
* T - not used
 
[[Category:Object MBIN's]]
 
[[Category:Object MBIN's]]

Revision as of 23:01, 27 March 2019

MATERIAL MBIN's contain information about which texture maps as well as shader effects are used for a given mesh provided via a GEOMETRY file. Much like 'materials' in 3D modeling programs, there are a lot of options available for customizing the look and rendering of an in-game object.

It is highly recommended that you are already used to the workflow involving the import of custom models or is simply planning a retexture mod. A basic MATERIAL file contains some basic attributes such as whether the object casts shadows.

Initial Structure

Name - simply the name of this material.

Class - flags your texture onto whether it is Opaque (please expand)

TransparencyLayerID - likely has something to do with the Z drawing order of a transparent object. Always set to 0.

CastShadow - determines whether this object casts a shadow.

DisableZTest -

Link -

Shader - determines what shader to use. Shaders can be found in the /SHADER/ folder of your extracted PCBANKS directory. The most common shader is the UBERSHADER (SHADERS/UBSERSHADER.SHADER.BIN) which behaves similarly to Unity's Standard Shader.

Flags - declaring different material flags toggles on or off parts of the shader code. Listed below are options for the standard UBERSHADER.

Uniforms - uniforms are generic variables used by GLSL shaders. They are basically numerical properties that directly influence your material. There are several structs available, but only two are frequently used. See Material Options below.

Samplers - sampler structs can be found here. Each struct references actual 2D textures from a given directory. There are three types of samplers.

  • gDiffuseMap - the diffuse map is a DDS file where RGB channels are used for the diffuse texture and the ALPHA channel is used for metalness or transparency, depending on which flags you have declared in the MATERIAL file.
  • gMaskMap - this DDS file is used for a wide variety of effects. Roughness glossiness is derived from the green channel. Ambient occlusion is derived from the red channel. (can someone write about the blue channel?) After some testing, the blue channel appears to be for determining where custom colors are applied while base building - White receives primary color, grey (I used #7b7b7b) receives secondary color, and black retains original texture color. More testing needed.
  • gNormalMap - the normal map in DDS format. It might be important to know how NMS stores normal maps.

Material Flags (UBERSHADER)

Most materials in the game, especially 3D objects, reference an Ubershader similiar to Unity's Standard Shader, which uses Physically Based Rendering. Declaring more flags will trigger more effects on the MATERIAL MBIN. Listed below are the various flags (specifically what is known at this time), how they function, an what maps or parameters they rely on.

_F01_DIFFUSEMAP - exactly does the same thing a diffuse map on any 3D application, a basic texture image your model uses.

_F03_NORMALMAP - with this flag declared, your model will use a supplied normal map if you have any.

_F07_UNLIT - this makes this material unlit or shadeless.

_F24_AOMAP - if your model has an ambient occlusion bake, it will be read from the RED CHANNEL of your mask map as opposed to being baked into your diffuse map. Important note: As of Foundation 1.1, using this flag apparently causes the model to be entirely shaded black for some reason!

_F25_ROUGHNESS_MASK - this is the roughness glossiness property used for PBR rendering. It can be thought of as something like specularity map in older generations of games. Roughness glossiness masks rely on the GREEN CHANNEL of your provided mask map.

_F39_METALLIC_MASK - this is the metalness property used for PBR rendering. Your metalness map comes from the ALPHA CHANNEL of your diffuse map.

_F09_TRANSPARENT - this will cause parts of your texture to be transparent. It will read from your diffuse map's ALPHA CHANNEL, effectively overriding the metalness map.

_F22_TRANSPARENT_SCALAR - this will allow the declaration of a single value to determine the texture's transparency via the 'a' property in the material file's gMaterialColourVec4 struct.

_F11_ALPHACUTOUT - similar to any alpha cutout, where all pixels above a certain threshold or immediately transparent. Used for things like leaves or fences, where the actual object doesn't technically have a soft fade anywhere.

Material Options

gMaterialColourVec4

  • X, Y, Z - these variables likely determine that direct intensity of your diffuse map as per your RGB channels. A value of zero will probably cause your model to shade black.
  • T - Transparency/Translucence. (0~1 range) The lower the value, the more transparent the object. (This may require the _F22_TRANSPARENT_SCALAR shader called.)

gMaterialParamsVec4

  • X - overall roughness coefficient of your material, if you did not provide a ROUGHNESS_MASK flag.
    • 1.0 makes the surface rougher (less shiny, like charcoal), 0.0 makes it smoother (much more shiny, like glass or a laminated object)
    • If _F25_ROUGHNESS_MASK is provided, this value will multiply the final result.
  • Y - likely has something to do with the intensity of a detail normal map, still needs further confirmation. This seems to be left at 0.5 by default for most vanilla models.
  • Z - overall metalness coefficent of your material, if you did not provide a METALLIC_MASK flag.
    • 1.0 makes the surface generally more metallic (reflections are precise) while values toward 0.0 make the surface less metallic (reflections become blurred and *diffused*)
  • T - not used