|
MaterialXMaterials 1.39.5
Utilities for retrieving materials from remote servers
|
Javascript class for querying materials from the Physically Based database and creating MaterialX materials. More...
Public Member Functions | |
| constructor (mtlx_module=null, mtlx_stdlib=null) | |
| Constructor for the PhysicallyBasedMaterialLoader. | |
| getJSON () | |
| Get the Physically Based Materials as JSON. | |
| getJSONMaterialNames () | |
| Get list of the Physically Based Material names. | |
| getMaterialXDocument () | |
| Get the MaterialX document. | |
| validateDocument () | |
| Validate the MaterialX document. | |
| getInputRemapping (shadingModel) | |
| Get the remapping keys for a given shading model. | |
| getInputRemappingMap () | |
| Get remmapping map. | |
| get_physlib () | |
| get_physlib_definition () | |
| get_physlib_category () | |
| get_physlib_definition_name () | |
| get_physlib_implementation_name () | |
| get_physlib_materials () | |
| get_definitions () | |
| map_keys_to_definition (mat, ndef) | |
| find_all_bxdf (doc) | |
| derive_translator_name_from_targets (source, target) | |
| create_translator (doc, source, target, source_version="", target_version="", mappings=null, output_doc) | |
| create_all_translators (definitions, output_doc=null) | |
| add_copyright_comment (doc, shaderCategory, embedDate=false) | |
| create_definition (doc=null) | |
| create_definition_materials (doc_mat, filter_list=null) | |
| find_translator (doc, source, target) | |
| translate_node (doc, source_bxdf, target_bxdf, node) | |
| initialize_definitions_and_materials (shadingModel='standard_surface', materialNames=[], force=false) | |
| setDefaultRemapKeys () | |
| Set the default remapping keys for different shading models : glTF, OpenPBR, and Autodesk Standard Surface. | |
| initializeInputRemapping () | |
| Initialize the input remapping for different shading models. | |
| loadMaterialX () | |
| Load the MaterialX module. | |
| async | getPhysicallyBasedMaterials () |
| Get the Physically Based Materials from the API. | |
| loadStandardLibraries () | |
| Load the MaterialX standard libraries. | |
| skipLibraryElement (element) | |
| Predicate to skip library elements. | |
| getMaterialXString () | |
| Get the MaterialX document as a string. | |
| addComment (doc, commentString) | |
| Add a comment to the MaterialX document. | |
| getReferenceList () | |
| Return a sorted list reference names mapped reference images. | |
| add_copyright_docstring (doc, shaderCategory='') | |
| Add copyright docstring to the MaterialX document. | |
| convertToMaterialX (shaderCategory, references, addAllInputs=false, materialNames=[], remapKeys={}, shaderPreFix='') | |
| Convert the Physically Based Materials to MaterialX. | |
Public Attributes | |
| url = '' | |
| URL to fetch the Physically Based Materials. | |
| headers = {} | |
| Headers for the fetch operation. | |
| materials = null | |
| List of Physically Based Materials. | |
| materialNames = [] | |
| List of Physically Based Material names. | |
| mxMaterialNames = [] | |
| List of MaterialX Material names. | |
| mx = null | |
| MaterialX module. | |
| doc = null | |
| Working MaterialX document. | |
| stdlib = null | |
| MaterialX standard libraries. | |
| remapMap = {} | |
| Remap keys for input values for different shading models. | |
Javascript class for querying materials from the Physically Based database and creating MaterialX materials.
Definition at line 8 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::add_copyright_comment | ( | doc, | |
| shaderCategory, | |||
| embedDate = false ) |
Definition at line 462 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::add_copyright_docstring | ( | doc, | |
| shaderCategory = '' ) |
Add copyright docstring to the MaterialX document.
| doc | MaterialX document |
| shaderCategory | - MaterialX shader category (optional) |
Definition at line 1033 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::addComment | ( | doc, | |
| commentString ) |
Add a comment to the MaterialX document.
| doc | - MaterialX document |
| commentString | - Comment string to add |
Definition at line 994 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::constructor | ( | mtlx_module = null, | |
| mtlx_stdlib = null ) |
Constructor for the PhysicallyBasedMaterialLoader.
Definition at line 60 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::convertToMaterialX | ( | shaderCategory, | |
| references, | |||
| addAllInputs = false, | |||
| materialNames = [], | |||
| remapKeys = {}, | |||
| shaderPreFix = '' ) |
Convert the Physically Based Materials to MaterialX.
| shaderCategory | - MaterialX shader category |
| addAllInputs | - Add all inputs from node definitions |
| materialNames | - List of material names to convert. If empty all materials are converted |
| remapKeys | - Remap keys to MaterialX shader inputs. If not specified the default remap keys are used if any. |
| shaderPreFix | - Prefix for the shader name. Default is empty |
| references | - List of references found. (returned). Each reference is a object: { name: string, reference: string } |
Definition at line 1056 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::create_all_translators | ( | definitions, | |
| output_doc = null ) |
Create translators for all supported shading models.
| {object} | definitions - The source document containing Physically Based MaterialX definitions. |
| {object} | output_doc - The document to add the translators to. If null, use the source doc. |
Definition at line 418 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::create_definition | ( | doc = null | ) |
Create a NodeDef for the Physically Based Material inputs
| {object|null} | doc - The MaterialX document to add the NodeDef to. If null, a new document will be created. |
Definition at line 479 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::create_definition_materials | ( | doc_mat, | |
| filter_list = null ) |
Create a MaterialX document containing Physically Based MaterialX materials
| {object|null} | doc_mat - The MaterialX document to add the materials to |
| {string[]|null} | filter_list - A list of material names to filter. If null, all materials will be processed. |
Definition at line 526 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::create_translator | ( | doc, | |
| source, | |||
| target, | |||
| source_version = "", | |||
| target_version = "", | |||
| mappings = null, | |||
| output_doc ) |
Create a translator nodedef and nodegraph from source to target definitions.
| {object} | doc - The source document containing the definition. |
| {string} | source - The source definition category. |
| {string} | target - The target definition category. |
| {string} | source_version - The source version string. If empty, use the first source definition version found. |
| {string} | target_version - The target version string. If empty, use the first target definition version found. |
| {object} | mappings - A dictionary mapping source input names to target input names. |
| {object} | output_doc - The document to add the translator to. If null, use the source doc. |
Definition at line 297 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::derive_translator_name_from_targets | ( | source, | |
| target ) |
Definition at line 292 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::find_all_bxdf | ( | doc | ) |
Definition at line 279 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::find_translator | ( | doc, | |
| source, | |||
| target ) |
Find a translator nodedef from source to target in the document.
| {object} | doc - The MaterialX document to search. |
| {string} | source - The source definition category. |
| {string} | target - The target definition category. |
Definition at line 588 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::get_definitions | ( | ) |
Definition at line 200 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::get_physlib | ( | ) |
Definition at line 167 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::get_physlib_category | ( | ) |
Definition at line 180 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::get_physlib_definition | ( | ) |
Definition at line 172 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::get_physlib_definition_name | ( | ) |
Definition at line 185 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::get_physlib_implementation_name | ( | ) |
Definition at line 190 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::get_physlib_materials | ( | ) |
Definition at line 195 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::getInputRemapping | ( | shadingModel | ) |
Get the remapping keys for a given shading model.
| shadingModel | - Shading model to get the remapping keys |
Definition at line 146 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::getInputRemappingMap | ( | ) |
Get remmapping map.
Definition at line 162 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::getJSON | ( | ) |
Get the Physically Based Materials as JSON.
Definition at line 102 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::getJSONMaterialNames | ( | ) |
Get list of the Physically Based Material names.
Definition at line 110 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::getMaterialXDocument | ( | ) |
Get the MaterialX document.
Definition at line 118 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::getMaterialXString | ( | ) |
Get the MaterialX document as a string.
Definition at line 971 of file JsMaterialXPhysicallyBased.js.
| async JsPhysicallyBasedMaterialLoader::getPhysicallyBasedMaterials | ( | ) |
Get the Physically Based Materials from the API.
Definition at line 898 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::getReferenceList | ( | ) |
Return a sorted list reference names mapped reference images.
Definition at line 1005 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::initialize_definitions_and_materials | ( | shadingModel = 'standard_surface', | |
| materialNames = [], | |||
| force = false ) |
Initialize Physically Based MaterialX definitions, materials, remappings, and translators.
Definition at line 697 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::initializeInputRemapping | ( | ) |
Initialize the input remapping for different shading models.
Definition at line 846 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::loadMaterialX | ( | ) |
Load the MaterialX module.
Definition at line 882 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::loadStandardLibraries | ( | ) |
Load the MaterialX standard libraries.
Definition at line 934 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::map_keys_to_definition | ( | mat, | |
| ndef ) |
Definition at line 215 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::setDefaultRemapKeys | ( | ) |
Set the default remapping keys for different shading models : glTF, OpenPBR, and Autodesk Standard Surface.
Definition at line 792 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::skipLibraryElement | ( | element | ) |
Predicate to skip library elements.
| element | - MaterialX element |
Definition at line 962 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::translate_node | ( | doc, | |
| source_bxdf, | |||
| target_bxdf, | |||
| node ) |
Translate a shader node of source_bxdf to target_bxdf using ungrouped nodes. This function creates a target node and a translation node based on the translator nodedef, then makes upstream and downstream connections.
| {object} | doc - The document to operate on. |
| {string} | source_bxdf - The source BXDF shading model name. |
| {string} | target_bxdf - The target BXDF shading model name. |
| {object} | node - The source shader node to translate. |
Definition at line 601 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::validateDocument | ( | ) |
Validate the MaterialX document.
Definition at line 127 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::doc = null |
Working MaterialX document.
Definition at line 43 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::headers = {} |
| JsPhysicallyBasedMaterialLoader::materialNames = [] |
List of Physically Based Material names.
Definition at line 28 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::materials = null |
List of Physically Based Materials.
Definition at line 23 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::mx = null |
MaterialX module.
Definition at line 38 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::mxMaterialNames = [] |
List of MaterialX Material names.
Definition at line 33 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::remapMap = {} |
Remap keys for input values for different shading models.
Definition at line 53 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::stdlib = null |
MaterialX standard libraries.
Definition at line 48 of file JsMaterialXPhysicallyBased.js.
| JsPhysicallyBasedMaterialLoader::url = '' |
URL to fetch the Physically Based Materials.
Definition at line 13 of file JsMaterialXPhysicallyBased.js.