Model loading · function
parseMtl
Parse a .mtl.
Explained in Importing models.
function parseMtl(text: string): Map<string, ObjMaterial>import { parseMtl } from '@driftengine/assets';Parameters
| Parameter | Type | Description |
|---|---|---|
text | string |
In depth
Pr and Pm are the widely used PBR extension rather than the original specification,
and they are preferred where present because they say directly what this engine shades
with. Where they are absent, Ns — a Phong exponent — is converted, since an exponent
and a roughness describe the same thing from opposite ends.
d and Tr are the same quantity written in opposite directions: d is how much of the
surface is there and Tr is how much of it is not. Reading either as the other inverts
every transparent material in a file, turning solid geometry invisible and glass solid,
so both are read explicitly rather than one being assumed.