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
Feature | Type | Texture Format | Notes |
---|---|---|---|
baseColor | Color or Texture | JPG recommended PNG possible if RGBA | sRGB color space alphaMode : MASK not supported (alpha_test feature) thus alphaCutoff is ignored |
metallic | Scalar or Texture | JPG | Linear color space [0, 1] - 0 = dielectric and 1 = metal |
roughness | Scalar or Texture | JPG | Linear color spac [0, 1] - 0 = smooth surface, 1 = rough surface |
Normal | Texture | PNG | Tangent space normals, green values as Y up or positive, as in the OpenGL convention |
occlusion | Texture | JPG | Values are in the [0, 1] range, 0 means completely occluded from indirect lighting |
emissive | Color or Texture | JPG | Array 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
Extension | Support | Notes |
---|---|---|
KHR_materials_clearcoat | Supported | |
KHR_materials_transmission | Supported | Optimized for HQ renders |
KHR_materials_sheen | Supported | |
KHR_materials_ior | Supported | |
KHR_materials_specular | Supported | |
KHR_materials_volume | Supported | Thickness parameter not supported |
3DS_materials_anisotropy | Supported | |
KHR_materials_translucency | Unsupported | |
KHR_texture_transform | Partially supported | One 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
Feature | Type | Texture Format | Notes |
---|---|---|---|
Diffuse | Color or Texture | JPG recommended PNG possible | sRGB color space |
Opacity | Scalar | – | [0, 1] - 0 = transparent |
Normal | Texture | PNG | Tangent space normals, green values as Y up or positive, as in the OpenGL convention |
Specular and Shininess | Color or Texture | JPG recommended (specular only) PNG possible: alpha channel used for shininess | linear color space. [0, 255] |
Refraction ratio (IOR) | Number or Texture | JPG only | This figure defines the Reflection ratio. Number between 1 and 5 or grayscale texture [51-255] |
Occlusion | Texture | JPG only | Use UV channel 1 |
Lightmap | Not 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:
Figure 1-Specular and Shininess
Phong Input Formats
- DAE Open Collada: 1 .DAE file + images folder containing N .png or .png textures files.
Figure 2-File Samples
- OBJ: 1 .obj file + 1 .mtl file + N .png or .png texture files.
Figure 3-File Samples
Supported Features when Importing from DAE(Open Collada)
Feature | Support | Notes |
---|---|---|
Effect instantiation | Partial | Only "url" attribute is taken into account. Only references to local instances are supported or URLs of BM3MAT files. Technique hints and parameters are ignored. |
Profiles | None | Only "profile_COMMON" is taken into account |
Effect annotations | None | – |
Effect parameters | None | – |
Shaders | Partial | The 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, |
Images | Partial | All 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
Feature | Support |
---|---|
Diffuse color | Partial |
Specular color | Partial |
Dissolve (Opacity) | Full |
Specular exponent | Partial |
Diffuse texture file | Partial |
Specular texture file | Partial |
Specular exponent texture file | Partial |
Bump file | Partial |
Ambient color | None |
Transmission factor | None |
Illumination model | None |
Ambient texture | None |
Dissolve texture | None |
Anti-aliasing | Ignored |
Decal file | None |
Sharpness | None |
Optical density | None |
Displacement map | None |
Images | Partial |
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)
Parameter | Default | Effect |
---|---|---|
OffsetX, OffsetY | 0 | Shifts the texture (UV units) |
ScaleX, ScaleY | 1 | Scales the texture |
Rotate | 0 | Clockwise 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.