From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m (Added Blender settings.)
Line 17: Line 17:
'''Albedo Texture Example'''
'''Albedo Texture Example'''
Color Channel Separated
Alpha Channel Separated

Latest revision as of 05:20, 26 June 2020

m.pbrmetalmasked is a minor variation on the m.pbrmetal material. It adds a masked alpha channel to allow a complex outline to be created without the use of large numbers of polygons. 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.

It should be noted that the "metal" in the name of this material refers to the physical property used in the lighting equations; it does not mean that the material is only appropriate for metallic surfaces.

On some hardware, masked alpha materials may perform substantially worse than an opaque material. This cost is per-fragment, meaning that it may be suitable to use a masked material on low-LOD meshes where polygon count must remain low and where fragment count is naturally low. On higher-LOD meshes, especially where the material is expected to fill a reasonable percentage of the screen, masked materials should be avoided in favor of higher polygon detail, or should be used in conjunction with true opaque materials such that the majority of opaque fragments are filled by the opaque materials and only the complex edge detail is filled by the masked material.

This page describes content format v4.6 and assumes that the FBX file format is used as a data source for any meshes.


[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.

A: The alpha channel provides a "black and white" masked alpha channel. Black indicates full transparency, meaning that the fragment is discarded. White indicates full opacity, meaning that rendering proceeds as per m.pbrmetal. If the alpha channel is omitted, this material acts exactly as m.pbrmetal except with lower performance. 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.

Albedo Texture Example


Color Channel Separated


Alpha Channel Separated


[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] Examples

Trainz material pbrmetalmasked.jpg

Example asset download:

Trainz Material - pbrmetalmasked + emissive

[edit] 3ds Max Material Configuration

Texture Assignment


[edit] Blender Material Configuration

The Blender settings for PBRMetalMasked are the same as PBRMetal Blender Settings except for the albedo texture where the Image->Use_Alpha should be checked.

Personal tools