Skip to content

Commit

Permalink
Merge pull request #140 from ClemensLinnhoff/50-add-brdf-look-up-tabl…
Browse files Browse the repository at this point in the history
…e-to-the-material-data

Add example brdf data and brdf schema
  • Loading branch information
ClemensLinnhoff authored Oct 25, 2024
2 parents 98228ba + 252485c commit 789aa20
Show file tree
Hide file tree
Showing 13 changed files with 13,304 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/antora-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
mv material-schema.adoc ../content/material/
python3 json2asciidoc.py ../schemas/material_emp_schema.json
mv material-emp-schema.adoc ../content/material/
python3 json2asciidoc.py ../schemas/material_brdf_schema.json
mv material-brdf-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 @@ -41,3 +41,9 @@ jobs:
with:
schema: ./schemas/material_emp_schema.json
file: ./examples/*_emp.xompt

- name: Validate brdf JSON schemas
uses: cardinalby/schema-validator-action@v3
with:
schema: ./schemas/material_brdf_schema.json
file: ./examples/*_brdf.xompt
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
.vscode/
.idea/

# Autogenerated files
content/geometry/metadata.adoc
content/material/metadata.adoc
content/material/material-properties.adoc
content/material/electromagnetic-properties.adoc
# Autogenerated schema documentation files
content/*/*schema.adoc
1 change: 1 addition & 0 deletions content/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ include::material/introduction.adoc[leveloffset=+1]
include::material/file-structure.adoc[leveloffset=+1]
include::material/material-schema.adoc[leveloffset=+1]
include::material/material-emp-schema.adoc[leveloffset=+1]
include::material/material-brdf-schema.adoc[leveloffset=+1]
Expand Down
1 change: 1 addition & 0 deletions content/nav-openmaterial.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
** xref:material/file-structure.adoc[]
** xref:material/material-schema.adoc[]
** xref:material/material-emp-schema.adoc[]
** xref:material/material-brdf-schema.adoc[]



Expand Down
7 changes: 6 additions & 1 deletion examples/example_material.xomp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
"density": 2699.0,
"source": "internet: https://en.wikipedia.org/wiki/Aluminium"
},
"electromagneticPropertiesUri": "example_material_emp.xompt"
"electromagneticPropertiesUri": "example_material_emp.xompt",
"brdfUris": [
"example_material_camera_brdf.xompt",
"example_material_lidar_brdf.xompt",
"example_material_radar_brdf.xompt"
]
}
}
9,259 changes: 9,259 additions & 0 deletions examples/example_material_camera_brdf.xompt

Large diffs are not rendered by default.

926 changes: 926 additions & 0 deletions examples/example_material_lidar_brdf.xompt

Large diffs are not rendered by default.

2,949 changes: 2,949 additions & 0 deletions examples/example_material_radar_brdf.xompt

Large diffs are not rendered by default.

141 changes: 141 additions & 0 deletions schemas/material_brdf_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"metadata": {
"type": "object",
"description": "Metadata about the material.",
"properties": {
"name": {
"type": "string",
"description": "Name of the material."
},
"description": {
"type": "string",
"description": "Short description of the material in 2 - 3 sentences."
},
"uuid": {
"type": "string",
"description": "Universally unique identifier for the material.",
"pattern": "^[a-f0-9]{32}$"
},
"materialVersion": {
"type": "string",
"description": "Version of the material.",
"pattern": "^\\d+\\.\\d+\\.\\d+$"
},
"creationDate": {
"type": "string",
"description": "Creation date of the material in the format YYYYMMDDTHHMMSSZ.",
"pattern": "^\\d{8}T\\d{6}Z$"
},
"openMaterialVersion": {
"type": "string",
"description": "Version of OpenMATERIAL.",
"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. For other types of licenses, provide an URL to a webpage with the license or the filename of a separately provided license file."
},
"author": {
"type": "string",
"description": "Name or email address of the author of this material. In case of multiple authors, use comma-separation. The author can also be a company name."
},
"source": {
"type": "string",
"description": "Source of the brdf data."
}
},
"required": [
"name",
"description",
"uuid",
"materialVersion",
"creationDate",
"openMaterialVersion",
"copyright",
"license",
"author",
"source"
]
},
"brdf": {
"type": "object",
"description": "General information about the lookup table.",
"properties": {
"typicalSensor": {
"type": "string",
"description": "Typical sensor technology this BRDF table is used for, e.g., radar, lidar, camera."
},
"wavelengthRange": {
"type": "array",
"description": "Wavelength range covered by the lookup table. The first item is the minimum wavelength in meters and the second item is the maximum wavelength in meters.",
"items": {
"type": "number"
},
"minItems": 2,
"maxItems": 2
},
"amplitudeUnit": {
"type": "string",
"description": "The unit of amplitude, either \"1/sr\" or \"linear\"",
"enum": ["1/sr", "linear"]
},
"lookupTable": {
"type": "array",
"description": "Array of bidirectional reflectance distribution function (BRDF) values, with each item representing a different property. The array SHALL be sorted based on the columns starting with the first.",
"items": {
"type": "array",
"items": [
{
"type": ["number", "null"],
"description": "Incident elevation angle in rad."
},
{
"type": ["number", "null"],
"description": "Exit elevation angle in rad."
},
{
"type": ["number", "null"],
"description": "Exit azimuth angle in rad (for BRDFs with incident and exit vectors on the same plane as the normal, exit azimuth angle is 0.)"
},
{
"type": ["number", "null"],
"description": "Polarized plane angle in rad. This is the angle between the plane containing the incident, exit, and normal vector, and the plane of polarization."
},
{
"type": ["number", "null"],
"description": "Wavelength in meters."
},
{
"type": ["number", "null"],
"description": "Amplitude within the linearly polarized plane."
},
{
"type": ["number", "null"],
"description": "Phase within the linearly polarized plane. If the phase is not taken into account, it is null."
}
],
"minItems": 7,
"maxItems": 7
}
}
},
"required": [
"typicalSensor",
"wavelengthRange",
"amplitudeUnit",
"lookupTable"
]
}
},
"required": [
"metadata",
"brdf"
]
}
2 changes: 1 addition & 1 deletion schemas/material_emp_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
},
"electromagneticProperties": {
"type": "array",
"description": "Array of electromagnetic property values, with each item representing a different property. The array SHALL be sorted based on the columns starting with the first.",
"items": {
"type": "array",
"description": "Array of electromagnetic property values, with each item representing a different property. The array SHALL be sorted based on the columns starting with the first.",
"items": [
{
"type": ["number", "null"],
Expand Down
8 changes: 8 additions & 0 deletions schemas/material_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@
"description": "Relative path to a property lookup table file with electromagnetic material properties.",
"pattern": ".*_emp\\.xompt$"
},
"brdfUris": {
"type": "array",
"description": "Relative paths to one or multiple property lookup table files with wavelength-dependent bidirectional reflectance distribution functions.",
"items": {
"type": "string",
"pattern": ".*_brdf\\.xompt$"
}
},
"retroreflectivityData": {
"type": "object",
"description": "Information about the retro-reflective properties of the material in the visible light spectrum.",
Expand Down
4 changes: 2 additions & 2 deletions scripts/json2asciidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def generate_asciidoc_properties(properties, required_fields, level=2):
for prop_name, prop_data in properties.items():
heading_prefix = "=" * level # Create heading based on level
asciidoc_content += f"{heading_prefix} {prop_name}\n"
asciidoc_content += f"{prop_data.get('description', 'No description')}\n"
asciidoc_content += f"{prop_data.get('description', '')}\n"

# Handle array types and generate description for array of arrays
if prop_data.get('type') == "array":
Expand All @@ -87,7 +87,7 @@ def generate_asciidoc_properties(properties, required_fields, level=2):
asciidoc_content += generate_asciidoc_array_of_arrays(prop_data['items'], prop_data.get('description', '')) + "\n"
else:
# Simple array, include the description of the array
asciidoc_content += f"\n{prop_data['items'].get('description', 'No description')}\n"
asciidoc_content += f"\n{prop_data['items'].get('description', '')}\n"

# Add pattern inline and handle escaping of backslashes and curly braces
if "pattern" in prop_data:
Expand Down

0 comments on commit 789aa20

Please sign in to comment.