Skip to content

Commit

Permalink
Merge pull request #11 from ClemensLinnhoff/material-mapping-and-assi…
Browse files Browse the repository at this point in the history
…gnment

Material mapping and assignment
  • Loading branch information
ClemensLinnhoff authored Oct 10, 2024
2 parents 7e069fc + a8c1082 commit f613268
Show file tree
Hide file tree
Showing 12 changed files with 473 additions and 46 deletions.
8 changes: 4 additions & 4 deletions .antora/modules/specification/nav-openmaterial.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
** xref:geometry/general.adoc[]
** xref:geometry/object-classes.adoc[]
** xref:geometry/file-format-support.adoc[]
** xref:geometry/metadata.adoc[]
** xref:geometry/performance.adoc[]
** xref:geometry/asset-schema.adoc[]
** xref:geometry/mapping-schema.adoc[]
* Material
** xref:material/introduction.adoc[]
** xref:material/file-format.adoc[]
** xref:material/metadata.adoc[]
** xref:material/material-properties.adoc[Material properties]
** xref:material/lookup-tables.adoc[]
** xref:material/material-schema.adoc[]
** xref:material/material-emp-schema.adoc[]
16 changes: 8 additions & 8 deletions .github/workflows/antora-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ jobs:
- name: Generate AsciiDoc from JSON
working-directory: repo/scripts
run: |
python3 json2asciidoc.py ../schemas/asset_schema.json metadata
mv metadata.adoc ../content/geometry/
python3 json2asciidoc.py ../schemas/material_schema.json metadata
mv metadata.adoc ../content/material/
python3 json2asciidoc.py ../schemas/material_schema.json materialProperties
mv materialProperties.adoc ../content/material/material-properties.adoc
python3 json2asciidoc.py ../schemas/material_emp_schema.json electromagneticProperties
mv electromagneticProperties.adoc ../content/material/electromagnetic-properties.adoc
python3 json2asciidoc.py ../schemas/asset_schema.json
mv asset-schema.adoc ../content/geometry/
python3 json2asciidoc.py ../schemas/mapping_schema.json
mv mapping-schema.adoc ../content/geometry/
python3 json2asciidoc.py ../schemas/material_schema.json
mv material-schema.adoc ../content/material/
python3 json2asciidoc.py ../schemas/material_emp_schema.json
mv material-emp-schema.adoc ../content/material/
- name: Configure Pages
uses: actions/configure-pages@v4
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/validate-json.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:
schema: ./schemas/asset_schema.json
file: ./examples/*.xoma

- name: Validate material mapping JSON schemas
uses: cardinalby/schema-validator-action@v3
with:
schema: ./schemas/mapping_schema.json
file: ./examples/*.xomm

- name: Validate material JSON schemas
uses: cardinalby/schema-validator-action@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions content/geometry/geometry-index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* xref:geometry/general.adoc[leveloffset=+1]
* xref:geometry/object-classes.adoc[leveloffset=+1]
* xref:geometry/file-format-support.adoc[leveloffset=+1]
* xref:geometry/metadata.adoc[leveloffset=+1]
* xref:geometry/performance.adoc[leveloffset=+1]
* xref:geometry/asset-schema.adoc[leveloffset=+1]
* xref:geometry/mapping-schema.adoc[leveloffset=+1]
4 changes: 2 additions & 2 deletions content/material/material-index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
* xref:material/introduction.adoc[leveloffset=+1]
* xref:material/file-format.adoc[leveloffset=+1]
* xref:material/metadata.adoc[leveloffset=+1]
* xref:material/material-properties.adoc[leveloffset=+1]
* xref:material/lookup-tables.adoc[leveloffset=+1]
* xref:material/material-schema.adoc[leveloffset=+1]
* xref:material/material-emp-schema.adoc[leveloffset=+1]
4 changes: 2 additions & 2 deletions examples/example_asset.xoma
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"z" : [0.0, 1.5]
}
},
"materialMapping": [
["10;50;255;127", "example_material.xomp", "metal with red paint"]
"materialTextureAssignment": [
["example_material_name", "example_texture.png"]
]
}
19 changes: 19 additions & 0 deletions examples/example_mapping.xomm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"metadata": {
"name": "example_mapping",
"description": "This is an example for a material mapping table. This file can be shared between multiple assets.",
"uuid": "c492bda27c8443e6be1903115545e844",
"mappingVersion": "1.0.0",
"openMaterialVersion": "1.0.0",
"copyright": "(C) 2023-2024, Example Company",
"license": "MPL-2.0",
"author": "[email protected]",
"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"]
]
}
22 changes: 8 additions & 14 deletions schemas/asset_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,34 +157,28 @@
"boundingBox"
]
},
"materialMapping": {
"materialTextureAssignment": {
"type": "array",
"description": "Mapping of materials used in the asset",
"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.",
"items": {
"type": "array",
"description": "Array of RGB values and material name",
"items": [
{
"type": "string",
"description": "RGB values in the format 'R;G;B;A'",
"pattern": "^\\d{1,3};\\d{1,3};\\d{1,3};\\d{1,3}$"
"description": "Name of the material in the 3D model file."
},
{
"type": "string",
"description": "Path to an OpenMATERIAL property file"
},
{
"type": "string",
"description": "Short but precise description of the material"
"description": "File path to the OpenMATERIAL assignment texture. Supported texture formats are png and jpg.",
"pattern": "^(\\./|/)?([a-zA-Z0-9_\\-./]+)\\.(png|jpg|jpeg)$"
}
],
"minItems": 3,
"maxItems": 3
"minItems": 2,
"maxItems": 2
}
}
},
"required": [
"metadata",
"materialMapping"
"metadata"
]
}
78 changes: 78 additions & 0 deletions schemas/mapping_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Material Mapping Schema",
"type": "object",
"properties": {
"metadata": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the material mapping."
},
"description": {
"type": "string",
"description": "This is a short description of the material mapping table. Use 2-3 sentences."
},
"uuid": {
"type": "string",
"description": "Universally unique identifier for the material mapping.",
"pattern": "^[a-f0-9]{32}$"
},
"mappingVersion": {
"type": "string",
"description": "Version of the mapping table.",
"pattern": "^\\d+\\.\\d+\\.\\d+$"
},
"openMaterialVersion": {
"type": "string",
"description": "Version of the OpenMaterial format.",
"pattern": "^\\d+\\.\\d+\\.\\d+$"
},
"copyright": {
"type": "string",
"description": "Copyright information with year and company."
},
"license": {
"type": "string",
"description": "License information. For common open source licenses, provide an SPDX identifier or a URL to the license."
},
"author": {
"type": "string",
"description": "Email address or name of the author. Can also be a company name."
},
"creationDate": {
"type": "string",
"description": "Date and time when the material mapping was created in ISO 8601 format.",
"pattern": "^\\d{8}T\\d{6}Z$"
}
},
"required": ["name", "uuid", "mappingVersion", "openMaterialVersion", "creationDate"]
},
"materialMapping": {
"type": "array",
"description": "Array containing material mappings.",
"items": {
"type": "array",
"items": [
{
"type": "string",
"description": "Material name or RGBA code."
},
{
"type": "string",
"description": "File path to the material.",
"pattern": "^(\\./|/)?([a-zA-Z0-9_\\-./]+)\\.xomp$"
},
{
"type": "string",
"description": "Description of the material."
}
],
"minItems": 3,
"maxItems": 3
}
}
},
"required": ["metadata", "materialMapping"]
}
152 changes: 152 additions & 0 deletions scripts/asset-schema.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
= Asset schema

== metadata

Metadata about the asset.

=== name
Name of the asset.

*Required:* Yes

=== description
Short description of the asset in 2 - 3 sentences.

*Required:* Yes

=== uuid
Universally unique identifier for the asset.

*Pattern:* `^[a-f0-9]\{32\}$`

*Required:* Yes

=== assetVersion
Version of the asset.

*Pattern:* `^\\d+\\.\\d+\\.\\d+$`

*Required:* Yes

=== openMaterialVersion
Version of OpenMATERIAL.

*Pattern:* `^\\d+\\.\\d+\\.\\d+$`

*Required:* Yes

=== copyright
Copyright information with year and company.

*Required:* Yes

=== license
License information. For common open source licenses, provide an SPDX identifier. For other types of licenses, provide an URL to a webpage with the license or the filename of a separately provided license file.

*Required:* Yes

=== author
Name or email address of the author of this asset. In case of multiple authors, use comma-separation. The author can also be a company name.

*Required:* Yes

=== modelCreationTool
The tool or software used to generate the 3D model of this asset.

*Required:* No

=== creationDate
Creation date of the asset in the format YYYYMMDDTHHMMSSZ.

*Pattern:* `^\\d\{8\}T\\d\{6\}Z$`

*Required:* Yes

=== modelingMethod
Description how the 3D model was modeled. Was it modeled based on a 3D scan, based on photos, or freehand?

*Required:* No

=== validationDescription
Was the geometry of the 3D model validated against a real-world object? If yes, how?

*Required:* No

=== assetType
Type of the asset out of the following: object (individual object), scene (a collection of multiple objects)

*Required:* Yes

=== objectClass
The class of the object. This only applies if 'asset_type' == 'object'.

*Required:* Yes

=== animated
Does the 3D model contain keyframe animations?

*Required:* Yes

=== pbrMaterialWorkflow
Does the 3D model contain materials for a PBR workflow? If yes, for a metallic or specular workflow?

*Required:* Yes

=== triangleCount
The number of triangles in the 3D model. One quad counts as two triangles.

*Required:* Yes

=== meshCount
The number of meshes in the 3D geometry.

*Required:* Yes

=== textureResolutions
List of all texture resolutions in the 3D model. This can include any combination of '1K', '2K', or '4K'.

No description

*Required:* Yes

=== normalMapFormat
Does the 3D model have normal maps as textures? If yes, are they using the DirectX format or the OpenGL format?

*Required:* Yes

=== boundingBox
Axis-aligned bounding box dimensions specifying the minimum and maximum values in x, y, and z direction.

*Required:* Yes

==== x
Minimum and maximum values in m in x direction.

No description

*Required:* Yes

==== y
Minimum and maximum values in m in y direction.

No description

*Required:* Yes

==== z
Minimum and maximum values in m in z direction.

No description

*Required:* Yes

== materialTextureAssignment

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.


Columns of the table:

- Column 1: Name of the material in the 3D model file.
- Column 2: File path to the OpenMATERIAL assignment texture. Supported texture formats are png and jpg.

Loading

0 comments on commit f613268

Please sign in to comment.