Skip to main content

Importing Materials

What is a Material?

A material describes the way a surface interacts with light. Its digital representation encapsulates all the parameters used to describe this interaction.

The ByMe rendering engine supports two shading models: Physically Based Rendering (PBR), and Phong.
A given scene can mix objects having both shading models.

The digital representation of the material is not the same for Phong and for PBR.

In order to apply textured materials on a surface, it is mandatory to have UV channels, also called UVW or Texture coordinates-stored within the model.

Materials for Physically Based Rendering (PBR)

ByMe supports the metallic-roughness model defined in the GLTF 2.0 specification available here:
https: //github.com/KhronosGroup/glTF/tree/master/specification/2.0# Specular-shininess workflow is not directly supported, but can be used through conversion with ior and specular extensions.

PBR Materials Supported Features

FeatureTypeTexture FormatNotes
baseColorColor or TextureJPG recommended PNG possible if RGBAsRGB color space alphaMode : MASK not supported (alpha_test feature) thus alphaCutoff is ignored
metallicScalar or TextureJPGLinear color space [0, 1] - 0 = dielectric and 1 = metal
roughnessScalar or TextureJPGLinear color spac [0, 1] - 0 = smooth surface, 1 = rough surface
NormalTexturePNGTangent space normals, green values as Y up or positive, as in the OpenGL convention
occlusionTextureJPGValues are in the [0, 1] range, 0 means completely occluded from indirect lighting
emissiveColor or TextureJPGArray of three floats in linear color space or texture in sRGB color space. If emissive is provided as both floats and a texture, the floats don't have to fit within the [0, 1] range (see below)

Each of parameters can be provided as a texture or as a value. If both are provided, the texture is converted to linear space if needed and then multiplied by the value. This allows greater control over the material parameters. For example, an emissive color is not enough to fully represent light emission, we also need a light intensity. This is done by storing the color in a texture and then using the light intensity as floats. In the shader, both information is multiplied giving us the right color scaled at the right intensity.

PBR Materials Input Formats

PBR materials must be provided to ByMe in the GLTF format. This can be done either through a single .glb file embedding everything or through a combination of a .gltf file, a .bin file and the required textures. The textures can be inside their own folder if the .gltf file was constructed that way. Self-embedding .gltf files are not supported.

PBR Material Input Formats Supported Features

The ByMe platform expects texture formats and structure (what information is in which RGB channel etc.) as per the GLTF specification, except where mentioned.

Features like base color, base color texture, metallic factor, roughness factor, metallic/roughness texture, normal texture, occlusion texture, emissive texture, emissive factor, alpha mode, double sided material, images have full support.

PBR Material extensions

ExtensionSupportNotes
KHR_materials_clearcoatSupported
KHR_materials_transmissionSupportedOptimized for HQ renders
KHR_materials_sheenSupported
KHR_materials_iorSupported
KHR_materials_specularSupported
KHR_materials_volumeSupportedThickness parameter not supported
3DS_materials_anisotropySupported
KHR_materials_translucencyUnsupported
KHR_texture_transformPartially supportedOne transform is supported for AO, and only one transform is supported for all other textures. If non-AO textures have different transforms, then an exception is thrown

Note:

  • In Metallic/Roughness texture, it can (should, if available) accept occlusion information in the red channel.
  • Occlusion texture, while technically possible to set ambient occlusion as a separate texture, we recommend packing it with metallic and roughness.
  • In Emissive factor, it can be outside of the [0, 1] range.
  • In Alpha mode, OPAQUE and BLEND supported. MASK to be defined.
  • In Images, all external images referenced inside the GLTF file must be loaded alongside the main file (With a common drag and drop, or by gathering all the files in a ZIP archive).
    In the case of a GLB file, all the resources are directly embedded inside the GLB buffer.

Materials for Phong Shading

Phong Materials Supported Features

FeatureTypeTexture FormatNotes
DiffuseColor or TextureJPG recommended PNG possiblesRGB color space
OpacityScalar[0, 1] - 0 = transparent
NormalTexturePNGTangent space normals, green values as Y up or positive, as in the OpenGL convention
Specular and ShininessColor or TextureJPG recommended (specular only) PNG possible: alpha channel used for shininesslinear color space. [0, 255]
Refraction ratio (IOR)Number or TextureJPG onlyThis figure defines the Reflection ratio. Number between 1 and 5 or grayscale texture [51-255]
OcclusionTextureJPG onlyUse UV channel 1
LightmapNot supported

For Specular and Shininess,
linear color space. [0, 255]
Specular: <75: matte (rarely used)
75-128 = common material
180-250 = metal material
255 = mirror
Shininess: 0 (rough) > 255 (shiny)

For texture size and performance, it is advised to use JPG wherever possible.

When alpha transparency is needed, PNG can be used. Formats other than png and jpg are not supported.

Specular + shininess example:
Specular Shine

Figure 1-Specular and Shininess

Phong Input Formats

  • DAE Open Collada: 1 .DAE file + images folder containing N .png or .png textures files.
    DAE Open Collada
Figure 2-File Samples
  • OBJ: 1 .obj file + 1 .mtl file + N .png or .png texture files.
    OBJ
    Figure 3-File Samples

Supported Features when Importing from DAE(Open Collada)

FeatureSupportNotes
Effect instantiationPartialOnly "url" attribute is taken into account. Only references to local instances are supported or URLs of BM3MAT files. Technique hints and parameters are ignored.
ProfilesNoneOnly "profile_COMMON" is taken into account
Effect annotationsNone
Effect parametersNone
ShadersPartialThe Blinn shader is the only well supported model. Any other shader will lead to a conversion attempt, and the quality of the result may vary.Note: The following components of the Blin shader are not supported: emission, ambient, reflective, reflectivity,
ImagesPartialAll external images referenced inside the collada files must be loaded alongside the main Collada file (With a common drag and drop, or by gathering all the files in a ZIP archive)

Supported Features when Importing from OBJ

FeatureSupport
Diffuse colorPartial
Specular colorPartial
Dissolve (Opacity)Full
Specular exponentPartial
Diffuse texture filePartial
Specular texture filePartial
Specular exponent texture filePartial
Bump filePartial
Ambient colorNone
Transmission factorNone
Illumination modelNone
Ambient textureNone
Dissolve textureNone
Anti-aliasingIgnored
Decal fileNone
SharpnessNone
Optical densityNone
Displacement mapNone
ImagesPartial

Note:

  • For Diffuse color and Specular color, only RGB mode supported (Spectral files and CIEXYZ values ignored). Will be used as diffuse and specular colors in the Phong Blinn rendering model. The quality of the result may vary.
  • For Specular exponent and Specular exponent texture file, will be converted into shininess in the Phong Blinn rendering model. The quality of the result may vary.
  • For Diffuse texture file and Specular texture file, only Phong Blinn shading is granted.
    Will be used as diffuse and specular textures in the Phong Blinn rendering model.
    The quality of the result may vary.
  • For Bump file, will be used as the normal map in the Phong Blinn rendering model.
    The quality of the result may vary.
  • For Images, all external images referenced inside the file must be loaded alongside the main OBJ file (With a common drag and drop, or by gathering all the files in a ZIP archive).

Additional Material Definition

The ByMe engine considers a set of additional information, which should be set on top of the assets provided as an input.

UVOperator
Displaces the textures applied on surfaces, by displacing the UV space with the formula :

newUV = rotate(oldUV * scale + offset)

ParameterDefaultEffect
OffsetX, OffsetY0Shifts the texture (UV units)
ScaleX, ScaleY1Scales the texture
Rotate0Clockwise angle (degrees)

For materials which are custom-made for a geometry, UVs and texture match each other and default values of the UVOperator should be used.
For variable materials or scalable geometries, these should be considered carefully: refer to the corresponding section.