diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..3c06548 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,18 @@ +# Examples + +This folder contains examples for all file formats defined in ASAM OpenMATERIAL. +This showcases the usage of asset files alongside a 3D model file, the material assignment via mesh or texture, the mapping to material property files als well as the definition of specific property look-up tables. + +| File Name | Description | +|--------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------| +| `checker.png` | Visual texture used in the 3D model. | +| `checker_xom.png` | ASAM OpenMATERIAL assignment texture used to assign different materials to certain parts of the object (texture-based material assignment). | +| `example_asset.gltf/bin` | 3D model file in glTF format, representing the 3D geometry. | +| `example_asset.xoma` | ASAM OpenMATERIAL asset file (.xoma), containing asset metadata and the link to the assignment texture. | +| `example_mapping.xomm` | Material mapping file (.xomm), providing mappings for different material definitions, per mesh or texture color value. | +| `example_material.xomp` | ASAM OpenMATERIAL material property file (.xomp), defining core material characteristics. | +| `example_material_2.xomp` | Second example of an ASAM OpenMATERIAL material property file to showcase the mapping of multiple materials. | +| `example_material_emp.xompt` | Material property look-up table (.xompt), containing electromagnetic properties. | +| `example_material_camera_brdf.xompt` | Material property look-up table (.xompt), containing BRDF data specific to camera sensors. | +| `example_material_lidar_brdf.xompt` | Material property look-up table (.xompt), containing BRDF data specific to lidar sensors. | +| `example_material_radar_brdf.xompt` | Material property look-up table (.xompt), containing BRDF data specific to radar sensors. | diff --git a/examples/checker.png b/examples/checker.png new file mode 100644 index 0000000..9a6c3fc Binary files /dev/null and b/examples/checker.png differ diff --git a/examples/checker_xom.png b/examples/checker_xom.png new file mode 100644 index 0000000..212bf6f Binary files /dev/null and b/examples/checker_xom.png differ diff --git a/examples/example_asset.bin b/examples/example_asset.bin new file mode 100644 index 0000000..cbc5b87 Binary files /dev/null and b/examples/example_asset.bin differ diff --git a/examples/example_asset.gltf b/examples/example_asset.gltf new file mode 100644 index 0000000..1b94bfb --- /dev/null +++ b/examples/example_asset.gltf @@ -0,0 +1,218 @@ +{ + "asset":{ + "generator":"Khronos glTF Blender I/O v4.2.57", + "version":"2.0" + }, + "scene":0, + "scenes":[ + { + "name":"Scene", + "nodes":[ + 0 + ] + } + ], + "nodes":[ + { + "mesh":0, + "name":"Cube" + } + ], + "materials":[ + { + "doubleSided":true, + "name":"Material_Cube", + "pbrMetallicRoughness":{ + "baseColorTexture":{ + "index":0 + }, + "metallicFactor":0, + "roughnessFactor":0.5 + } + }, + { + "doubleSided":true, + "name":"Material_Sphere", + "pbrMetallicRoughness":{ + "baseColorFactor":[ + 0.800000011920929, + 0.800000011920929, + 0.800000011920929, + 1 + ], + "metallicFactor":0, + "roughnessFactor":0.5 + } + } + ], + "meshes":[ + { + "name":"Cube", + "primitives":[ + { + "attributes":{ + "POSITION":0, + "NORMAL":1, + "TEXCOORD_0":2 + }, + "indices":3, + "material":0 + }, + { + "attributes":{ + "POSITION":4, + "NORMAL":5, + "TEXCOORD_0":6 + }, + "indices":7, + "material":1 + } + ] + } + ], + "textures":[ + { + "sampler":0, + "source":0 + } + ], + "images":[ + { + "mimeType":"image/png", + "name":"Asset 1", + "uri":"checker.png" + } + ], + "accessors":[ + { + "bufferView":0, + "componentType":5126, + "count":16, + "max":[ + 1, + 2, + 1 + ], + "min":[ + -1, + 0, + -1 + ], + "type":"VEC3" + }, + { + "bufferView":1, + "componentType":5126, + "count":16, + "type":"VEC3" + }, + { + "bufferView":2, + "componentType":5126, + "count":16, + "type":"VEC2" + }, + { + "bufferView":3, + "componentType":5123, + "count":42, + "type":"SCALAR" + }, + { + "bufferView":4, + "componentType":5126, + "count":296, + "max":[ + 0.999999463558197, + 3, + 0.9999994039535522 + ], + "min":[ + -0.9999992847442627, + 2, + -0.9999986886978149 + ], + "type":"VEC3" + }, + { + "bufferView":5, + "componentType":5126, + "count":296, + "type":"VEC3" + }, + { + "bufferView":6, + "componentType":5126, + "count":296, + "type":"VEC2" + }, + { + "bufferView":7, + "componentType":5123, + "count":1440, + "type":"SCALAR" + } + ], + "bufferViews":[ + { + "buffer":0, + "byteLength":192, + "byteOffset":0, + "target":34962 + }, + { + "buffer":0, + "byteLength":192, + "byteOffset":192, + "target":34962 + }, + { + "buffer":0, + "byteLength":128, + "byteOffset":384, + "target":34962 + }, + { + "buffer":0, + "byteLength":84, + "byteOffset":512, + "target":34963 + }, + { + "buffer":0, + "byteLength":3552, + "byteOffset":596, + "target":34962 + }, + { + "buffer":0, + "byteLength":3552, + "byteOffset":4148, + "target":34962 + }, + { + "buffer":0, + "byteLength":2368, + "byteOffset":7700, + "target":34962 + }, + { + "buffer":0, + "byteLength":2880, + "byteOffset":10068, + "target":34963 + } + ], + "samplers":[ + { + "magFilter":9728, + "minFilter":9984 + } + ], + "buffers":[ + { + "byteLength":12948, + "uri":"example_asset.bin" + } + ] +} diff --git a/examples/example_asset.xoma b/examples/example_asset.xoma index a129fbb..a47847a 100644 --- a/examples/example_asset.xoma +++ b/examples/example_asset.xoma @@ -1,7 +1,7 @@ { "metadata": { "name": "example_car", - "description": "This is an example car asset. It demonstrates how OpenMATERIAL assets work.", + "description": "This is an example asset. It demonstrates how OpenMATERIAL assets work.", "uuid": "87769375a5109c689af8cc3ad3dd8349", "assetVersion": "1.0.0", "openMaterialVersion": "1.0.0", @@ -11,9 +11,9 @@ "modelCreationTool": "Blender", "creationDate": "20240703T101728Z", "modelingMethod": "Modeled according to images", - "validationDescription": "The dimensions of the vehicle in x, y and z where compared to a real vehicle. They were accurate within a margin of 0.01 m.", + "validationDescription": "Not validated.", "assetType": "object", - "objectClass": "vehicle", + "objectClass": "other", "animated": false, "pbrMaterialWorkflow": "metallic", "triangleCount": 100000, @@ -21,12 +21,13 @@ "textureResolutions": ["2K"], "normalMapFormat": "OpenGL", "boundingBox": { - "x" : [-2.5, 2.5], - "y" : [-1.1, 1.1], - "z" : [0.0, 1.5] + "x" : [-1, 1], + "y" : [-1, 1], + "z" : [0.0, 3] } }, + "materialMappingUri": "example_mapping.xomm", "materialTextureAssignment": [ - ["example_material_name", "example_texture.png"] + ["Material_Cube", "checker_xom.png"] ] } diff --git a/examples/example_mapping.xomm b/examples/example_mapping.xomm index deb46c1..c8bd339 100644 --- a/examples/example_mapping.xomm +++ b/examples/example_mapping.xomm @@ -11,9 +11,8 @@ "creationDate": "20240703T101728Z", }, "materialMapping": [ - ["material_red", "materials/material_a.xomp", "metal with red paint"], - ["rgba:10;50;255;127", "materials/material_a.xomp", "metal with red paint"], - ["material_green", "materials/material_b.xomp", "metal with green paint"], - ["material_blue", "materials/material_c.xomp", "metal with blue paint"] + ["Material_Sphere", "example_material.xomp", "white aluminum"], + ["rgba:255;0;0;255", "example_material.xomp", "white aluminum"], + ["rgba:0;11;255;255", "example_material_2.xomp", "black aluminum"] ] } diff --git a/examples/example_material_2.xomp b/examples/example_material_2.xomp new file mode 100644 index 0000000..556773c --- /dev/null +++ b/examples/example_material_2.xomp @@ -0,0 +1,35 @@ +{ + "metadata": { + "name": "another example", + "description": "Second example material to showcase OpenMATERIAL assignment and mapping", + "uuid": "807db46a39654e5d83d43ddebad07dc3", + "materialVersion": "1.0.0", + "creationDate": "20241024T110000Z", + "openMaterialVersion": "1.0.0", + "copyright": "(C) 2023-2024, Example Company", + "license": "MPL-2.0", + "author": "john.doe@asam.net" + }, + "materialProperties": { + "surfaceRoughness": { + "surfaceHeightRms": 0.5, + "surfaceCorrelationLength": 0.3, + "source": "estimate" + }, + "emissivityData": { + "emissivityCoefficient": 0.07, + "temperature": 300.0, + "source": "internet: https://www.engineeringtoolbox.com/emissivity-coefficients-d_447.html" + }, + "elasticityData": { + "youngsModulus": 70e9, + "poissonsRatio": 0.35, + "source": "internet: https://en.wikipedia.org/wiki/Aluminium" + }, + "densityData": { + "density": 2699.0, + "source": "internet: https://en.wikipedia.org/wiki/Aluminium" + }, + "electromagneticPropertiesUri": "example_material_emp.xompt" + } +} diff --git a/schemas/asset_schema.json b/schemas/asset_schema.json index 498d05a..4c32c28 100644 --- a/schemas/asset_schema.json +++ b/schemas/asset_schema.json @@ -157,6 +157,11 @@ "boundingBox" ] }, + "materialMappingUri": { + "type": "string", + "description": "Relative path to a material mapping file (.xomm). In this file, material names from the 3D model file or texture color codes from textures assigned in materialTextureAssignment are linked to OpenMATERIAL property files.", + "pattern": ".*\\.xomm$" + }, "materialTextureAssignment": { "type": "array", "description": "Optional array containing material texture assignments. It links material names contained in the 3D model file to OpenMATERIAL assignment textures. In a separate material mapping file, the 'color' values in this texture are linked to OpenMATERIAL property files.",