M.pbrmetaldetail
(→Examples) |
(→Blender Material Configuration) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 74: | Line 74: | ||
Note that the detail maps are sampled at different texture coordinates from the primary maps. The 'detail-scale' material attribute defines a constant ratio between the two maps, with the primary maps functioning as normal and the detail maps tiling at the specified ratio to the primary. It is important that the detail map textures are configured to [[texture tiling|tile]] appropriately. | Note that the detail maps are sampled at different texture coordinates from the primary maps. The 'detail-scale' material attribute defines a constant ratio between the two maps, with the primary maps functioning as normal and the detail maps tiling at the specified ratio to the primary. It is important that the detail map textures are configured to [[texture tiling|tile]] appropriately. | ||
+ | |||
+ | This texture example has been set to 0.5 (128,128,128) so the overall albedo colour will not change. | ||
[[File:pbrmetaldetaildetailalbedo.jpg|border|middle|x200px]] | [[File:pbrmetaldetaildetailalbedo.jpg|border|middle|x200px]] | ||
Line 94: | Line 96: | ||
=Examples= | =Examples= | ||
+ | |||
+ | [[File:trainz_material_pbrmetaldetail.jpg|border|middle|x512px]] | ||
+ | |||
+ | Example asset download: | ||
+ | |||
+ | [http://download.trainzportal.com/tutorials/Trainz_Material_-_pbrmetaldetail.cdp Trainz Material - pbrmetaldetail] | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | [https://youtu.be/9KuZlGkMvdk video ] comparison of no detail vs. detail | ||
[[file: pbrmetaildetailexample.jpg]] | [[file: pbrmetaildetailexample.jpg]] | ||
Line 100: | Line 114: | ||
Once you export your fbx files: | Once you export your fbx files: | ||
− | lod0.trainmesh - | + | lod0.trainmesh - material = body.m.pbrmetaldetail |
− | lod1.trainmesh - | + | lod1.trainmesh - material = body.m.pbrmetaldetail |
− | lod2.trainmesh - | + | lod2.trainmesh - material = body.m.pbrmetaldetail |
Line 116: | Line 130: | ||
− | Open lod0.txt and add this text to adjust the | + | Open lod0.txt and add this text to adjust the detail-scale to tile macro (< than 1.0 for larger detail) or micro (> than 1.0 for smaller detail): |
+ | |||
+ | NOTE: in the above example image we are using a micro detail-scale of 80x smaller. | ||
materials | materials | ||
{ | { | ||
− | + | body.m.pbrmetaldetail | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
{ | { | ||
− | + | detail-scale 80 | |
} | } | ||
} | } | ||
Line 136: | Line 147: | ||
materials | materials | ||
{ | { | ||
− | + | body.m.pbrmetaldetail | |
{ | { | ||
− | + | detail-scale 80 | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
} | } | ||
+ | |||
Line 152: | Line 159: | ||
materials | materials | ||
{ | { | ||
− | + | body.m.pbrmetaldetail | |
{ | { | ||
− | + | detail-scale 80 | |
} | } | ||
} | } | ||
+ | |||
+ | NOTE: all LODs using the same material will need to use the same metadata file parameters. This is why you see all metadata files above have identical parameters for material "body.m.pbrmetaldetail". | ||
=3ds Max Material Configuration= | =3ds Max Material Configuration= | ||
Line 165: | Line 174: | ||
=Blender Material Configuration= | =Blender Material Configuration= | ||
− | + | Unlike Max, Blender does not offer all the slots needed to directly create pbrmetaldetail material. | |
+ | To do this anyway, here are the steps to follow | ||
+ | |||
+ | |||
+ | Create your object in Blender, and texture it with a pbrmetal material as usual (albedo, normal and parameter). | ||
+ | |||
+ | Important note : use the alpha layer of the albedo file to determine where, on your object, the pbrmetaldetail should apply (see above on this page). | ||
+ | |||
+ | Once you are happy with the texturing in Blender, simply rename the material you have just used -mytexture.m.pbrmetal- with this new extension : mytexture.m.pbrmetaldetail. | ||
+ | Export your work under fbx format. | ||
+ | |||
+ | |||
+ | In the Content Manager, create a new object with this content and submit it. | ||
+ | |||
+ | The system will generate two errors, indicating that the slots 'detail albedo' and 'detail normal' are empty. | ||
+ | |||
+ | To fix it, proceed in two steps. | ||
+ | |||
+ | '''First step :''' | ||
+ | |||
+ | In the files tree of your object, add now the two missing tga files : detail_albedo.tga and detail_normal.tga. | ||
+ | |||
+ | Add also their own config text : detail_albedo.texture.txt and detail_normal.texture.txt | ||
+ | |||
+ | The content of each of these text file should be : | ||
+ | |||
+ | <pre>Primary=detail_diffuse.tga | ||
+ | Alpha=detail_diffuse.tga | ||
+ | Tile=st | ||
+ | </pre> | ||
+ | |||
+ | and | ||
+ | |||
+ | <pre>Primary=detail_normal.tga | ||
+ | Alpha=detail_normal.tga | ||
+ | Tile=st | ||
+ | </pre> | ||
+ | |||
+ | '''Second step :''' | ||
+ | |||
+ | In the files tree of your object, and for each fbx files where the material pbrmetaldetail will apply, create a new text file. When speaking about these text files, we refer to [mesh metadata files[https://online.ts2009.com/mediaWiki/index.php/Mesh_metadata_file]] | ||
+ | |||
+ | Important note : the name of each one of these new text files must bear the name of the fbx file it refers to. For these fbx files : ''object_lod0'', ''object_lod1'' you should have ''object_lod0.txt'' and ''object_lod1.txt'' | ||
+ | |||
+ | Here is the typical content of such a mesh metadata file : | ||
+ | |||
+ | <pre>materials | ||
+ | { | ||
+ | mytexture.m.pbrmetaldetail | ||
+ | { | ||
+ | detail-scale 4 | ||
+ | textures | ||
+ | { | ||
+ | albedo | ||
+ | { | ||
+ | texture-resource "albedo.texture" | ||
+ | } | ||
+ | normal | ||
+ | { | ||
+ | texture-resource "normal.texture" | ||
+ | } | ||
+ | parameter | ||
+ | { | ||
+ | texture-resource "parameter.texture" | ||
+ | } | ||
+ | detail-albedo | ||
+ | { | ||
+ | texture-resource "detail_albedo.texture" | ||
+ | } | ||
+ | detail-normal | ||
+ | { | ||
+ | texture-resource "detail_normal.texture" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | Submit a new once your object and enjoy the result ! | ||
[[Category:Material types| ]] | [[Category:Material types| ]] | ||
+ | [[Category:Modeling]] | ||
+ | [[Category:Content creation]] |
Latest revision as of 20:05, 1 August 2022
m.pbrmetaldetail is a variation on the m.pbrmetal material. It adds a 'detail map' which is often used to provide fine surface texture repeated across the entire material. 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.
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.
[edit] Primary Albedo
RGB: The albedo map defines the base color of each texel. The sRGB color space is used.
A: The alpha channel defines whether the detail map is used at this location on the material. 0.0 (black) indicates that the detail map is not used, giving a result identical to m.pbrmetal. 1.0 (white) indicates that the detail map is used at full strength. Values between these extremes offer a partial-strength detail map.
Please note that there is no alpha blending support. 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 (RGB) and Albedo Alpha Channel Example Textures
[edit] Primary 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)
NOTE: this example texture is for a ballast or ground texture while the other textures throughout this page are used on the rolling stock in the example below.
[edit] Primary 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] Detail Albedo
RGB: Albedo modifier. This is combined into the fragment's primary albedo on a per-channel basis. At 0.0, and at full detail map strength, the channel is reduced to 0%. At 1.0, the channel is increased to 200%. At 0.5, the channel is left at 100%. The result is clamped into the 0.0 .. 1.0 range. A: Unused. Should be omitted.
Note that the detail maps are sampled at different texture coordinates from the primary maps. The 'detail-scale' material attribute defines a constant ratio between the two maps, with the primary maps functioning as normal and the detail maps tiling at the specified ratio to the primary. It is important that the detail map textures are configured to tile appropriately.
This texture example has been set to 0.5 (128,128,128) so the overall albedo colour will not change.
[edit] Detail Normal
RGB: Surface normal. This functions in an identical manner to the primary normal map, and is simply an additional offset to the normal. A: Unused. Should be omitted.
Note that the detail maps are sampled at different texture coordinates from the primary maps. The 'detail-scale' material attribute defines a constant ratio between the two maps, with the primary maps functioning as normal and the detail maps tiling at the specified ratio to the primary. It is important that the detail map textures are configured to tile appropriately.
[edit] Material Attributes
The following attributes may be overridden in the mesh metadata file associated with the material's parent mesh:
- detail-scale - A single number (default 0.09) which describes the size relationship between the primary and detail texture maps.
- At 1.0, both maps are used at the same scale and there is absolutely no point in using a detail map.
- At lower values, the detail map's tiling size is larger than the primary map's. This is used to provide low-frequency noise to avoid having the material tile too obviously. For example, a 2048x2048 primary map which tiles every 10 meters such as a ground texture might use a 256x256 detail map which tiles every 300m - while the detail map is obviously too low resolution to enhance the detail of the primary map, it allows gradual variations in the primary map so that a large tiled ground area doesn't look artificially repetitive.
- At higher values, the detail map's tiling size is smaller than the primary map's. This is used to provide high-frequency noise to allow the material to look more crisp and higher resolution than the actual primary texture map allows for. For example, a 512x512 primary map which tiles every 10 meters (51.2 texels per meter) such as a tiled pathway might use a 128x128 detail map which tiles every 10cm (1280 texels per meter). Cracks and joins in the tiles would exclude the detail map by using the alpha channel of the primary albedo.
[edit] Examples
Example asset download:
Trainz Material - pbrmetaldetail
video comparison of no detail vs. detail
Once you export your fbx files:
lod0.trainmesh - material = body.m.pbrmetaldetail
lod1.trainmesh - material = body.m.pbrmetaldetail
lod2.trainmesh - material = body.m.pbrmetaldetail
You'll need to setup the mesh metadata files for each like so. Create each metadata.txt file:
lod0.txt
lod1.txt
lod2.txt
Open lod0.txt and add this text to adjust the detail-scale to tile macro (< than 1.0 for larger detail) or micro (> than 1.0 for smaller detail):
NOTE: in the above example image we are using a micro detail-scale of 80x smaller.
materials { body.m.pbrmetaldetail { detail-scale 80 } }
Open lod1.txt and add this text:
materials { body.m.pbrmetaldetail { detail-scale 80 } }
Open lod2.txt and add this text:
materials { body.m.pbrmetaldetail { detail-scale 80 } }
NOTE: all LODs using the same material will need to use the same metadata file parameters. This is why you see all metadata files above have identical parameters for material "body.m.pbrmetaldetail".
[edit] 3ds Max Material Configuration
Texture Assignment
[edit] Blender Material Configuration
Unlike Max, Blender does not offer all the slots needed to directly create pbrmetaldetail material. To do this anyway, here are the steps to follow
Create your object in Blender, and texture it with a pbrmetal material as usual (albedo, normal and parameter).
Important note : use the alpha layer of the albedo file to determine where, on your object, the pbrmetaldetail should apply (see above on this page).
Once you are happy with the texturing in Blender, simply rename the material you have just used -mytexture.m.pbrmetal- with this new extension : mytexture.m.pbrmetaldetail. Export your work under fbx format.
In the Content Manager, create a new object with this content and submit it.
The system will generate two errors, indicating that the slots 'detail albedo' and 'detail normal' are empty.
To fix it, proceed in two steps.
First step :
In the files tree of your object, add now the two missing tga files : detail_albedo.tga and detail_normal.tga.
Add also their own config text : detail_albedo.texture.txt and detail_normal.texture.txt
The content of each of these text file should be :
Primary=detail_diffuse.tga Alpha=detail_diffuse.tga Tile=st
and
Primary=detail_normal.tga Alpha=detail_normal.tga Tile=st
Second step :
In the files tree of your object, and for each fbx files where the material pbrmetaldetail will apply, create a new text file. When speaking about these text files, we refer to [mesh metadata files[1]]
Important note : the name of each one of these new text files must bear the name of the fbx file it refers to. For these fbx files : object_lod0, object_lod1 you should have object_lod0.txt and object_lod1.txt
Here is the typical content of such a mesh metadata file :
materials { mytexture.m.pbrmetaldetail { detail-scale 4 textures { albedo { texture-resource "albedo.texture" } normal { texture-resource "normal.texture" } parameter { texture-resource "parameter.texture" } detail-albedo { texture-resource "detail_albedo.texture" } detail-normal { texture-resource "detail_normal.texture" } } }
Submit a new once your object and enjoy the result !