M.glass
m |
(→Blender Material Configuration V2.8+) |
||
(10 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
[[m.glass]] is a variation on the [[m.pbrmetal]] material. It adds a [[blended alpha]] channel to allow actual glass-like transparencies to be created. All PBR materials are defined using a multitude of texture channels (not just a simple RGB image) which define various aspects of the material on a per-texel basis. One major advantage of this approach is that a single in-game material can be used to display various different real-world materials, rather than requiring multiple separate in-game materials with different parameters. Trainz uses a Metallic/Roughness style PBR workflow. | [[m.glass]] is a variation on the [[m.pbrmetal]] material. It adds a [[blended alpha]] channel to allow actual glass-like transparencies to be created. All PBR materials are defined using a multitude of texture channels (not just a simple RGB image) which define various aspects of the material on a per-texel basis. One major advantage of this approach is that a single in-game material can be used to display various different real-world materials, rather than requiring multiple separate in-game materials with different parameters. Trainz uses a Metallic/Roughness style PBR workflow. | ||
− | This material should be used for creating glass and glass-like materials only. This material has various limitations which make it unsuitable for general use. It is expected that this material will be enhanced over time to improve the glass-like effect, which will further compromise any meshes which attempt to misuse this material for non-glass surfaces. If cutout-style transparency is desired, [[m.pbrmetalmasked]] should be used instead. | + | This material should be used for creating glass and glass-like materials (eg. ice) only. This material has various limitations which make it unsuitable for general use. It is expected that this material will be enhanced over time to improve the glass-like effect, which will further compromise any meshes which attempt to misuse this material for non-glass surfaces. If cutout-style transparency is desired, [[m.pbrmetalmasked]] should be used instead. Foliage should use [[m.pbrmetalmasked]] or [[m.clutter]] with high-resolution geometry and/or texture maps to provide appropriate coverage, rather than attempting to fake coverage using blended alpha. |
This page describes content format v4.6 and assumes that the FBX file format is used as a data source for any meshes. | This page describes content format v4.6 and assumes that the FBX file format is used as a data source for any meshes. | ||
Line 9: | Line 9: | ||
==Albedo== | ==Albedo== | ||
− | RGB: The albedo defines the base color of each texel. The sRGB color space is used. | + | RGB: The [[albedo map]] defines the base color of each texel. The sRGB color space is used. |
+ | |||
+ | '''Albedo Texture Example''' | ||
+ | |||
+ | [[File:Fire albedo.png|border|middle|x200px]] | ||
A: The alpha channel provides a greyscale [[blended alpha]] channel. Black indicates full transparency. White indicates full opacity. Mid levels offer partial transparency. If the alpha channel is omitted, this material becomes fully opaque but still suffers from a number of drawbacks, unlike the truly opaque [[m.pbrmetal]]. Note that unlike legacy Trainz materials, PBR materials do not autodetect opacity mode based on the texture in use. The content creator must select the appropriate material for their desired outcome. Runtime texture replacement should not expect to replace an opaque texture with a blended or masked texture and have the material update automatically. | A: The alpha channel provides a greyscale [[blended alpha]] channel. Black indicates full transparency. White indicates full opacity. Mid levels offer partial transparency. If the alpha channel is omitted, this material becomes fully opaque but still suffers from a number of drawbacks, unlike the truly opaque [[m.pbrmetal]]. Note that unlike legacy Trainz materials, PBR materials do not autodetect opacity mode based on the texture in use. The content creator must select the appropriate material for their desired outcome. Runtime texture replacement should not expect to replace an opaque texture with a blended or masked texture and have the material update automatically. | ||
− | ''' | + | '''Alpha Texture Example''' |
+ | |||
+ | [[File:Fire alpha.png|border|middle|x200px]] | ||
− | + | The full texture is available here: [[File:fire.tga]] | |
==Normal== | ==Normal== | ||
− | RGB: Surface normal. This defines which way the surface is facing, relative to the interpolated vertex normals. Since this is an XYZ format rather than color data, it should never be modified in Photoshop. Using Photoshop to add a fourth channel or copy/paste smaller textures into a [[texture atlas]] is acceptable. Per-pixel manipulation or use of filters on the "RGB" channels is not acceptable. | + | RGB: Surface [[normal map]]. This defines which way the surface is facing, relative to the interpolated vertex normals. Since this is an XYZ format rather than color data, it should never be modified in Photoshop. Using Photoshop to add a fourth channel or copy/paste smaller textures into a [[texture atlas]] is acceptable. Per-pixel manipulation or use of filters on the "RGB" channels is not acceptable. |
A: [[Parallax Occlusion Map|Displacement height]]. 0.0 represents the deepest possible value, while 1.0 represents the shallowest possible value. While it is possible to paint this data in Photoshop, a linear color space must be used, and far superior results will be available through other data sources. The parallax height and the surface normal must be kept in sync, which means that a third-party tool must be used to generate the surface normal from the parallax height if you are painting this map manually. | A: [[Parallax Occlusion Map|Displacement height]]. 0.0 represents the deepest possible value, while 1.0 represents the shallowest possible value. While it is possible to paint this data in Photoshop, a linear color space must be used, and far superior results will be available through other data sources. The parallax height and the surface normal must be kept in sync, which means that a third-party tool must be used to generate the surface normal from the parallax height if you are painting this map manually. | ||
Line 44: | Line 50: | ||
[[File:pbrparametersemissivemap1.jpg|border|middle|x200px]] | [[File:pbrparametersemissivemap1.jpg|border|middle|x200px]] | ||
− | G: Roughness. Defines whether the surface reflections are shiny ( | + | G: Roughness. Defines whether the surface reflections are shiny (0.0) or matte (1.0). See the [[Physically Based Rendering|PBR metal workflow]] for details. |
Line 76: | Line 82: | ||
=Examples= | =Examples= | ||
− | + | ||
+ | [[File:trainz_material_glass.jpg|border|middle|x512px]] | ||
+ | |||
+ | Example asset download: | ||
+ | |||
+ | [http://download.trainzportal.com/tutorials/Trainz_Material_-_glass.cdp Trainz Material - glass] | ||
=3ds Max Material Configuration= | =3ds Max Material Configuration= | ||
Line 82: | Line 93: | ||
'''Texture Assignment''' | '''Texture Assignment''' | ||
− | |||
− | |||
− | |||
+ | [[File:ConfigTextureMaxGlass.jpg]] | ||
+ | |||
+ | =Blender Material Configuration (2.7x)= | ||
+ | You must use the Blender Render option in Blender as the Cycles Render doesn't export the texture names associated with the material. The cycles option is still being investigated. | ||
+ | |||
+ | The albedo must have the "Use Alpha" and Influence->Diffuse->Alpha tag ticked. The normal does not require any special settings. The parameters texture must use the Influence->Specular->Hardness tag (checkbox). The value of the hardness is not exported by the Blender FBX exporter. Sample settings are shown below. All textures except the albedo are using png in this example because they do not require an Alpha channel. | ||
+ | |||
+ | [[File:BlenderFBXmglassAlbedo.png|border|middle|x700px]] [[File:BlenderFBXmglassNormal.png|border|middle|x700px]] [[File:BlenderFBXmglassparameter.png|border|middle|x700px]] | ||
+ | |||
+ | =Blender Material Configuration (2.8+)= | ||
+ | |||
+ | The shader node is a Principled BSDF shader and the FBX exporter supports the export of some texture names but not all. The following connections should be made: | ||
+ | |||
+ | Albedo texture to the Base Color input. | ||
+ | |||
+ | Parameter texture to the Roughness input. | ||
+ | |||
+ | The normal texture, via a normal converter set to Tangent, to the Normal input. | ||
+ | |||
+ | The 3D view of the mesh does not show a true PBR render. | ||
+ | |||
+ | You will need to update the texture.txt files created by the Trainz FBX importer. | ||
+ | |||
+ | |||
+ | [[File:Blender 2.80 shader export nodes.jpg|border|middle|x700px]] | ||
[[Category:Material types| ]] | [[Category:Material types| ]] | ||
+ | [[Category:Modeling]] | ||
+ | [[Category:Content creation]] |
Latest revision as of 16:43, 3 February 2021
m.glass is a variation on the m.pbrmetal material. It adds a blended alpha channel to allow actual glass-like transparencies to be created. All PBR materials are defined using a multitude of texture channels (not just a simple RGB image) which define various aspects of the material on a per-texel basis. One major advantage of this approach is that a single in-game material can be used to display various different real-world materials, rather than requiring multiple separate in-game materials with different parameters. Trainz uses a Metallic/Roughness style PBR workflow.
This material should be used for creating glass and glass-like materials (eg. ice) only. This material has various limitations which make it unsuitable for general use. It is expected that this material will be enhanced over time to improve the glass-like effect, which will further compromise any meshes which attempt to misuse this material for non-glass surfaces. If cutout-style transparency is desired, m.pbrmetalmasked should be used instead. Foliage should use m.pbrmetalmasked or m.clutter with high-resolution geometry and/or texture maps to provide appropriate coverage, rather than attempting to fake coverage using blended alpha.
This page describes content format v4.6 and assumes that the FBX file format is used as a data source for any meshes.
Contents |
[edit] Texture Slots
The following texture slots are used for this material. All textures should typically have the same dimensions unless they represent a uniform color, however this is not strictly enforced.
[edit] Albedo
RGB: The albedo map defines the base color of each texel. The sRGB color space is used.
Albedo Texture Example
A: The alpha channel provides a greyscale blended alpha channel. Black indicates full transparency. White indicates full opacity. Mid levels offer partial transparency. If the alpha channel is omitted, this material becomes fully opaque but still suffers from a number of drawbacks, unlike the truly opaque m.pbrmetal. Note that unlike legacy Trainz materials, PBR materials do not autodetect opacity mode based on the texture in use. The content creator must select the appropriate material for their desired outcome. Runtime texture replacement should not expect to replace an opaque texture with a blended or masked texture and have the material update automatically.
Alpha Texture Example
The full texture is available here: File:Fire.tga
[edit] Normal
RGB: Surface normal map. This defines which way the surface is facing, relative to the interpolated vertex normals. Since this is an XYZ format rather than color data, it should never be modified in Photoshop. Using Photoshop to add a fourth channel or copy/paste smaller textures into a texture atlas is acceptable. Per-pixel manipulation or use of filters on the "RGB" channels is not acceptable.
A: Displacement height. 0.0 represents the deepest possible value, while 1.0 represents the shallowest possible value. While it is possible to paint this data in Photoshop, a linear color space must be used, and far superior results will be available through other data sources. The parallax height and the surface normal must be kept in sync, which means that a third-party tool must be used to generate the surface normal from the parallax height if you are painting this map manually.
Normal Texture Example with no Alpha Channel (Parallax)
Normal Texture Example with Alpha Channel (Parallax)
[edit] Parameter
This texture is comprised of four separate channels which each form a separate data element. Linear color space (not sRGB) is used for these channels.
R: Emissive. This causes the texture to have an internal glow, even when no external light is present. Used for phosphors, permanently-lit markings, etc. The glow color is based on the albedo. Note that this glow does not cast light upon surrounding surfaces except via the Bloom post-processing effect.
Parameters (Emissive - Red Channel) Texture Example
G: Roughness. Defines whether the surface reflections are shiny (0.0) or matte (1.0). See the PBR metal workflow for details.
Parameters (Roughness - Green Channel) Texture Example
B: Ambient Occlusion. Defines whether the surface is exposed to ambient lighting conditions (1.0) or affected only by direct lighting (0.0).
Parameters (Ambient Occlusion - Blue Channel) Texture Example
A: Metallicity. Defines whether the surface is metallic (1.0) with the albedo used to colorize reflected light, or dielectric (0.0) with the albedo used to colorize the surface. While intermediate values are not physically accurate, they may be used to emulate subsurfaces which are partially metallic. See the PBR metal workflow for details.
Parameters (Metallic - Alpha Channel) Texture Example
[edit] Limitations
As a truly transparent surface, m.glass offers excellent standalone visual quality but suffers from a number of drawbacks, including:
- Limited or no shadow-casting.
- Limited or no z-buffer writes.
- Limited capability to correctly resolve z-order against itself or other transparent surfaces.
- Lower performance.
These limitations are not considered defining characteristics of the material and may change in exact outcome based on changes to the underlying render technology. Minor rendering artifacts caused by these limitations are considered inevitable. Major artifacts (such as see-through walls or large objects with missing shadows) caused by these limitations are considered a content creation fault (eg. inappropriate use of this material where another material would have given a superior result; inappropriate use of a correct-but-limited asset while route building, etc.) and not an engine bug.
[edit] Examples
Example asset download:
[edit] 3ds Max Material Configuration
Texture Assignment
[edit] Blender Material Configuration (2.7x)
You must use the Blender Render option in Blender as the Cycles Render doesn't export the texture names associated with the material. The cycles option is still being investigated.
The albedo must have the "Use Alpha" and Influence->Diffuse->Alpha tag ticked. The normal does not require any special settings. The parameters texture must use the Influence->Specular->Hardness tag (checkbox). The value of the hardness is not exported by the Blender FBX exporter. Sample settings are shown below. All textures except the albedo are using png in this example because they do not require an Alpha channel.
[edit] Blender Material Configuration (2.8+)
The shader node is a Principled BSDF shader and the FBX exporter supports the export of some texture names but not all. The following connections should be made:
Albedo texture to the Base Color input.
Parameter texture to the Roughness input.
The normal texture, via a normal converter set to Tangent, to the Normal input.
The 3D view of the mesh does not show a true PBR render.
You will need to update the texture.txt files created by the Trainz FBX importer.