From f54367b884b78d86d9b3d2ee233d937393bcd778 Mon Sep 17 00:00:00 2001 From: ClemensLinnhoff Date: Wed, 3 Jul 2024 18:16:19 +0200 Subject: [PATCH 1/8] Add example files for assets and materials and additional json schema files Signed-off-by: ClemensLinnhoff --- examples/example_asset.xoma | 17 + examples/example_material.xomp | 602 +++++++++++++++++++++++++++++++++ schemas/asset_schema.json | 94 +++++ schemas/material_schema.json | 152 +++++++++ 4 files changed, 865 insertions(+) create mode 100644 examples/example_asset.xoma create mode 100644 examples/example_material.xomp create mode 100644 schemas/asset_schema.json create mode 100644 schemas/material_schema.json diff --git a/examples/example_asset.xoma b/examples/example_asset.xoma new file mode 100644 index 00000000..f747b58a --- /dev/null +++ b/examples/example_asset.xoma @@ -0,0 +1,17 @@ +{ + "metadata": { + "copyright" : "(C) 2023-2024, Example Company", + "generator": "Blender", + "openmaterial_version": "1.0.0", + "creator": "Example Company", + "creation_date": "20240703T101728Z", + "asset_version": "1.0.0", + "id": "87769375a5109c689af8cc3ad3dd8349", + "name": "example_car", + "label": "vehicle", + "description": "Example car to demonstrate how OpenMATERIAL works" + }, + "material_mapping": [ + ["10;50;255;127", "example_material.xomp"] + ] +} \ No newline at end of file diff --git a/examples/example_material.xomp b/examples/example_material.xomp new file mode 100644 index 00000000..e41c56f1 --- /dev/null +++ b/examples/example_material.xomp @@ -0,0 +1,602 @@ +{ + "metadata": { + "copyright" : "(C) 2023-2024, Example Company", + "generator": "Example Companies Fancy Material Tool", + "openmaterial_version": "1.0.0", + "creator": "Example Company", + "creation_date": "20240703T101728Z", + "material_version": "1.0.0", + "id": "fe7d707050e545f19f2658ecacb6ac5e", + "name": "aluminum", + "description": "aluminum material" + }, + "materials_properties": { + "surface_roughness": { + "surface_height_rms": 0.8, + "surface_correlation_length": 1.0 + }, + "index_of_refraction": [ + { + "temperature": 300.0, + "n": [ + [200e-9, 0.110803374], + [205e-9, 0.111587326], + [210e-9, 0.11365555], + [215e-9, 0.115928445], + [220e-9, 0.116173424], + [225e-9, 0.119771906], + [230e-9, 0.124315543], + [235e-9, 0.129276519], + [240e-9, 0.133002743], + [245e-9, 0.139688588], + [250e-9, 0.141162655], + [255e-9, 0.148765766], + [260e-9, 0.150722638], + [265e-9, 0.161465056], + [270e-9, 0.164610587], + [275e-9, 0.172365826], + [280e-9, 0.178635303], + [285e-9, 0.18587018], + [290e-9, 0.188953314], + [295e-9, 0.197315218], + [300e-9, 0.204991638], + [305e-9, 0.210097266], + [310e-9, 0.218816718], + [315e-9, 0.224454799], + [320e-9, 0.237666454], + [325e-9, 0.24464928], + [330e-9, 0.251892832], + [335e-9, 0.259391824], + [340e-9, 0.267481852], + [345e-9, 0.275201252], + [350e-9, 0.28349792], + [355e-9, 0.291774119], + [360e-9, 0.300125667], + [365e-9, 0.308578012], + [370e-9, 0.317597538], + [375e-9, 0.32692637], + [380e-9, 0.335956002], + [385e-9, 0.345714203], + [390e-9, 0.354901676], + [395e-9, 0.364968364], + [400e-9, 0.375150842], + [405e-9, 0.385211589], + [410e-9, 0.396086448], + [415e-9, 0.40706511], + [420e-9, 0.417647849], + [425e-9, 0.429543735], + [430e-9, 0.440996226], + [435e-9, 0.452837879], + [440e-9, 0.464232752], + [445e-9, 0.477070026], + [450e-9, 0.489220122], + [455e-9, 0.501228231], + [460e-9, 0.514817248], + [465e-9, 0.528042125], + [470e-9, 0.53987657], + [475e-9, 0.554932886], + [480e-9, 0.568005038], + [485e-9, 0.582771419], + [490e-9, 0.596705366], + [495e-9, 0.610784373], + [500e-9, 0.625686295], + [505e-9, 0.640306464], + [510e-9, 0.655709839], + [515e-9, 0.672565753], + [520e-9, 0.688336416], + [525e-9, 0.704045108], + [530e-9, 0.720793584], + [535e-9, 0.737603948], + [540e-9, 0.75446839], + [545e-9, 0.772330366], + [550e-9, 0.789405353], + [555e-9, 0.808351698], + [560e-9, 0.829205097], + [565e-9, 0.848630853], + [570e-9, 0.867376853], + [575e-9, 0.887661988], + [580e-9, 0.908569739], + [585e-9, 0.928308533], + [590e-9, 0.948955518], + [595e-9, 0.9714896], + [600e-9, 0.992465612], + [605e-9, 1.016073317], + [610e-9, 1.038145667], + [615e-9, 1.062059906], + [620e-9, 1.088160063], + [625e-9, 1.112663572], + [630e-9, 1.136328574], + [635e-9, 1.165731637], + [640e-9, 1.190265203], + [645e-9, 1.218505245], + [650e-9, 1.246364405], + [655e-9, 1.275302761], + [660e-9, 1.304382818], + [665e-9, 1.333854457], + [670e-9, 1.365410391], + [675e-9, 1.395892303], + [680e-9, 1.426024482], + [685e-9, 1.457391234], + [690e-9, 1.493230683], + [695e-9, 1.5274935], + [700e-9, 1.559751729], + [705e-9, 1.596346402], + [710e-9, 1.631621525], + [715e-9, 1.669698976], + [720e-9, 1.706780893], + [725e-9, 1.745260386], + [730e-9, 1.786398844], + [735e-9, 1.827772224], + [740e-9, 1.872189153], + [745e-9, 1.916802427], + [750e-9, 1.958355454], + [755e-9, 2.005349601], + [760e-9, 2.054224115], + [765e-9, 2.09984451], + [770e-9, 2.144528834], + [775e-9, 2.189915668], + [780e-9, 2.231500036], + [785e-9, 2.275479945], + [790e-9, 2.314643646], + [795e-9, 2.350258044], + [800e-9, 2.373653298], + [805e-9, 2.399438967], + [810e-9, 2.409296598], + [815e-9, 2.414395973], + [820e-9, 2.410049326], + [825e-9, 2.399462094], + [830e-9, 2.375277499], + [835e-9, 2.342102357], + [840e-9, 2.301774531], + [845e-9, 2.257656113], + [850e-9, 2.204898553], + [855e-9, 2.148111401], + [860e-9, 2.092718783], + [865e-9, 2.03127715], + [870e-9, 1.973568962], + [875e-9, 1.915492386], + [880e-9, 1.854996083], + [885e-9, 1.802564727], + [890e-9, 1.750120449], + [895e-9, 1.694671727], + [900e-9, 1.64715608], + [905e-9, 1.602399525], + [910e-9, 1.557188172], + [915e-9, 1.516837858], + [920e-9, 1.483545494], + [925e-9, 1.447230511], + [930e-9, 1.415213787], + [935e-9, 1.385433286], + [940e-9, 1.355589911], + [945e-9, 1.325884954], + [950e-9, 1.302164463], + [955e-9, 1.280288795], + [960e-9, 1.25976713], + [965e-9, 1.23821822], + [970e-9, 1.218188621], + [975e-9, 1.201067407], + [980e-9, 1.182294465], + [985e-9, 1.167631515], + [990e-9, 1.153696234], + [995e-9, 1.140905235], + [1000e-9, 1.126639087], + [1004e-9, 1.114680776], + [1010e-9, 1.102964941], + [1014e-9, 1.09358083], + [1020e-9, 1.08727974], + [1025e-9, 1.081445553], + [1030e-9, 1.071397488], + [1035e-9, 1.061537336], + [1040e-9, 1.055494597], + [1045e-9, 1.051806876], + [1050e-9, 1.043454926], + [1055e-9, 1.036482441], + [1060e-9, 1.033133204], + [1065e-9, 1.02747793], + [1070e-9, 1.025591906], + [1075e-9, 1.024418445], + [1080e-9, 1.020244607], + [1085e-9, 1.015304156], + [1090e-9, 1.014378517], + [1095e-9, 1.011890304], + [1100e-9, 1.009905005], + [1105e-9, 1.008451539], + [1110e-9, 1.005344855], + [1115e-9, 1.00382405], + [1120e-9, 1.004294808], + [1125e-9, 1.003882164], + [1130e-9, 1.003972742], + [1135e-9, 1.00500573], + [1140e-9, 1.002828586], + [1145e-9, 1.003941179], + [1150e-9, 1.005317282], + [1155e-9, 1.003754384], + [1160e-9, 1.008818757], + [1165e-9, 1.007932489], + [1170e-9, 1.008357257], + [1175e-9, 1.012688334], + [1180e-9, 1.015213183], + [1185e-9, 1.014759181], + [1190e-9, 1.017683803], + [1195e-9, 1.01813905], + [1200e-9, 1.021736807], + [1205e-9, 1.022859293], + [1210e-9, 1.024257787], + [1215e-9, 1.026450838], + [1220e-9, 1.029738722], + [1225e-9, 1.035047848], + [1230e-9, 1.038667581], + [1235e-9, 1.039978895], + [1240e-9, 1.043389606], + [1245e-9, 1.046657092], + [1250e-9, 1.049913391], + [1255e-9, 1.051297547], + [1260e-9, 1.056495057], + [1265e-9, 1.057188404], + [1270e-9, 1.061492702], + [1275e-9, 1.066383574], + [1280e-9, 1.070500901], + [1285e-9, 1.073080696], + [1290e-9, 1.078091053], + [1295e-9, 1.081263285], + [1300e-9, 1.08667656], + [1305e-9, 1.090905752], + [1310e-9, 1.094227716], + [1315e-9, 1.097106966], + [1320e-9, 1.104427092], + [1325e-9, 1.108138114], + [1330e-9, 1.109282178], + [1335e-9, 1.112492808], + [1340e-9, 1.123987022], + [1345e-9, 1.129233973], + [1350e-9, 1.132981867], + [1355e-9, 1.135566133], + [1430e-9, 1.20897633], + [1435e-9, 1.215774284], + [1440e-9, 1.222359347], + [1445e-9, 1.225637477], + [1450e-9, 1.232348412], + [1455e-9, 1.235053048], + [1460e-9, 1.23989324], + [1465e-9, 1.245674136], + [1470e-9, 1.25590184], + [1475e-9, 1.252421713], + [1480e-9, 1.265153644], + [1485e-9, 1.264792932], + [1490e-9, 1.275023692], + [1495e-9, 1.277693673], + [1500e-9, 1.285699173], + [1505e-9, 1.290149697], + [1510e-9, 1.296809948], + [1515e-9, 1.304059962], + [1520e-9, 1.313924676], + [1525e-9, 1.31627889], + [1530e-9, 1.325289614], + [1535e-9, 1.332565366], + [1540e-9, 1.338103685], + [1545e-9, 1.342317392], + [1550e-9, 1.347399401], + [1555e-9, 1.354287918], + [1560e-9, 1.36162657], + [1565e-9, 1.367953829], + [1570e-9, 1.374881699], + [1575e-9, 1.374949427], + [1580e-9, 1.385662006], + [1585e-9, 1.390425967], + [1590e-9, 1.400170689], + [1595e-9, 1.39786136], + [1600e-9, 1.400984694], + [1605e-9, 1.402928097], + [1610e-9, 1.421414675], + [1615e-9, 1.424742484], + [1620e-9, 1.436002763], + [1625e-9, 1.439358574], + [1630e-9, 1.44609075], + [1635e-9, 1.447904247], + [1640e-9, 1.45643876], + [1645e-9, 1.458873135], + [1650e-9, 1.469917493], + [1655e-9, 1.478177828], + [1660e-9, 1.474977808], + [1665e-9, 1.477843053], + [1670e-9, 1.462292742], + [1675e-9, 1.425778483], + [1680e-9, 1.427335087], + [1685e-9, 1.454908413], + [1690e-9, 1.514176047], + [1695e-9, 1.555668449], + [1700e-9, 1.584018511] + ], + "k": [ + [200e-9, 1.908606137], + [205e-9, 1.969936987], + [210e-9, 2.028057589], + [215e-9, 2.091850713], + [220e-9, 2.151998203], + [225e-9, 2.213039835], + [230e-9, 2.274896559], + [235e-9, 2.336773934], + [240e-9, 2.395514502], + [245e-9, 2.457358928], + [250e-9, 2.515219055], + [255e-9, 2.573777623], + [260e-9, 2.633214255], + [265e-9, 2.693431077], + [270e-9, 2.750035753], + [275e-9, 2.81099804], + [280e-9, 2.868973784], + [285e-9, 2.923276881], + [290e-9, 2.98248275], + [295e-9, 3.042340102], + [300e-9, 3.100858199], + [305e-9, 3.157347124], + [310e-9, 3.214790935], + [315e-9, 3.267473023], + [320e-9, 3.323775766], + [325e-9, 3.37932734], + [330e-9, 3.436779015], + [335e-9, 3.493749292], + [340e-9, 3.550147397], + [345e-9, 3.607178361], + [350e-9, 3.663518946], + [355e-9, 3.719829584], + [360e-9, 3.776251503], + [365e-9, 3.831608068], + [370e-9, 3.889198914], + [375e-9, 3.945995546], + [380e-9, 4.002607455], + [385e-9, 4.058265431], + [390e-9, 4.114238107], + [395e-9, 4.169676475], + [400e-9, 4.226433266], + [405e-9, 4.281283449], + [410e-9, 4.336805792], + [415e-9, 4.391435073], + [420e-9, 4.447407079], + [425e-9, 4.503499508], + [430e-9, 4.559109307], + [435e-9, 4.613682059], + [440e-9, 4.669101846], + [445e-9, 4.724044433], + [450e-9, 4.778319404], + [455e-9, 4.832828338], + [460e-9, 4.887948117], + [465e-9, 4.943260916], + [470e-9, 4.997345967], + [475e-9, 5.051331558], + [480e-9, 5.105940631], + [485e-9, 5.159226931], + [490e-9, 5.212874187], + [495e-9, 5.265933683], + [500e-9, 5.320477736], + [505e-9, 5.374848125], + [510e-9, 5.428163169], + [515e-9, 5.481545831], + [520e-9, 5.535955836], + [525e-9, 5.58799423], + [530e-9, 5.641767754], + [535e-9, 5.693773756], + [540e-9, 5.746496546], + [545e-9, 5.799008035], + [550e-9, 5.851936501], + [555e-9, 5.905288517], + [560e-9, 5.958236408], + [565e-9, 6.009090973], + [570e-9, 6.060226283], + [575e-9, 6.112687118], + [580e-9, 6.165184423], + [585e-9, 6.215605902], + [590e-9, 6.267417058], + [595e-9, 6.317103137], + [600e-9, 6.368986418], + [605e-9, 6.417351867], + [610e-9, 6.46681888], + [615e-9, 6.517052343], + [620e-9, 6.566589093], + [625e-9, 6.61475776], + [630e-9, 6.66312559], + [635e-9, 6.710806975], + [640e-9, 6.759417967], + [645e-9, 6.807110623], + [650e-9, 6.852329839], + [655e-9, 6.898361917], + [660e-9, 6.942363757], + [665e-9, 6.987643931], + [670e-9, 7.031951759], + [675e-9, 7.071104251], + [680e-9, 7.116287362], + [685e-9, 7.157652493], + [690e-9, 7.197481356], + [695e-9, 7.23603734], + [700e-9, 7.27391404], + [705e-9, 7.311383032], + [710e-9, 7.34575992], + [715e-9, 7.380372258], + [720e-9, 7.414249862], + [725e-9, 7.446739811], + [730e-9, 7.475374294], + [735e-9, 7.502849546], + [740e-9, 7.528352557], + [745e-9, 7.55216072], + [750e-9, 7.571403838], + [755e-9, 7.585211073], + [760e-9, 7.599462923], + [765e-9, 7.605086914], + [770e-9, 7.61216158], + [775e-9, 7.610567038], + [780e-9, 7.603853787], + [785e-9, 7.589387919], + [790e-9, 7.572223927], + [795e-9, 7.547894599], + [800e-9, 7.522581337], + [805e-9, 7.486541749], + [810e-9, 7.449477169], + [815e-9, 7.410756231], + [820e-9, 7.369351244], + [825e-9, 7.325600203], + [830e-9, 7.288411569], + [835e-9, 7.253098886], + [840e-9, 7.225729444], + [845e-9, 7.204374444], + [850e-9, 7.188085811], + [855e-9, 7.177700369], + [860e-9, 7.181328004], + [865e-9, 7.184642431], + [870e-9, 7.198887028], + [875e-9, 7.218248477], + [880e-9, 7.243411521], + [885e-9, 7.274079983], + [890e-9, 7.309782595], + [895e-9, 7.350096072], + [900e-9, 7.393045594], + [905e-9, 7.439468008], + [910e-9, 7.48978204], + [915e-9, 7.542665118], + [920e-9, 7.592621895], + [925e-9, 7.647710517], + [930e-9, 7.70342976], + [935e-9, 7.756057335], + [940e-9, 7.812465936], + [945e-9, 7.872100794], + [950e-9, 7.928721983], + [955e-9, 7.985307721], + [960e-9, 8.04593147], + [965e-9, 8.1051949], + [970e-9, 8.163760378], + [975e-9, 8.22268587], + [980e-9, 8.279240316], + [985e-9, 8.338247019], + [990e-9, 8.399524689], + [995e-9, 8.457757667], + [1000e-9,8.511598888], + [1004e-9,8.571960874], + [1010e-9,8.629920722], + [1014e-9,8.687515124], + [1020e-9,8.74843856], + [1025e-9,8.809967337], + [1030e-9,8.867857271], + [1035e-9,8.920081923], + [1040e-9,8.978255334], + [1045e-9,9.036830069], + [1050e-9,9.083765639], + [1055e-9,9.148731926], + [1060e-9,9.204040646], + [1065e-9,9.264432573], + [1070e-9,9.318521275], + [1075e-9,9.373122913], + [1080e-9,9.42862127], + [1085e-9,9.479917855], + [1090e-9,9.5368739], + [1095e-9,9.593431189], + [1100e-9,9.649917519], + [1105e-9,9.704482186], + [1110e-9,9.750882949], + [1115e-9,9.806001363], + [1120e-9,9.860152537], + [1125e-9,9.917498646], + [1130e-9,9.968398129], + [1135e-9,10.02382345], + [1140e-9,10.07500199], + [1145e-9,10.12708734], + [1150e-9,10.18335224], + [1155e-9,10.23706613], + [1160e-9,10.28628773], + [1165e-9,10.34146643], + [1170e-9,10.39215013], + [1175e-9,10.44200832], + [1180e-9,10.49336256], + [1185e-9,10.5517646], + [1190e-9,10.60545522], + [1195e-9,10.65817091], + [1200e-9,10.70579031], + [1205e-9,10.75807795], + [1210e-9,10.80782605], + [1215e-9,10.85926339], + [1220e-9,10.9110202], + [1225e-9,10.96181208], + [1230e-9,11.01266681], + [1235e-9,11.06849385], + [1240e-9,11.11569439], + [1245e-9,11.16984741], + [1250e-9,11.21616325], + [1255e-9,11.26655345], + [1260e-9,11.31619114], + [1265e-9,11.36079431], + [1270e-9,11.41081797], + [1275e-9,11.47288865], + [1280e-9,11.51937378], + [1285e-9,11.56250415], + [1290e-9,11.61775711], + [1295e-9,11.66829595], + [1300e-9,11.71967858], + [1305e-9,11.7737027], + [1310e-9,11.82020872], + [1315e-9,11.86438552], + [1320e-9,11.91930196], + [1325e-9,11.96737106], + [1330e-9,12.01542787], + [1335e-9,12.06389822], + [1340e-9,12.1162431], + [1345e-9,12.16532652], + [1350e-9,12.21775953], + [1355e-9,12.26700903], + [1430e-9,12.99198306], + [1435e-9,13.0402495], + [1440e-9,13.08984959], + [1445e-9,13.13438949], + [1450e-9,13.19350911], + [1455e-9,13.23424936], + [1460e-9,13.2825952], + [1465e-9,13.32973008], + [1470e-9,13.37524914], + [1475e-9,13.42119816], + [1480e-9,13.46516297], + [1485e-9,13.51960433], + [1490e-9,13.56523813], + [1495e-9,13.61515704], + [1500e-9,13.66027168], + [1505e-9,13.70964938], + [1510e-9,13.75760575], + [1515e-9,13.81378197], + [1520e-9,13.8577198], + [1525e-9,13.90548777], + [1530e-9,13.94978109], + [1535e-9,13.9955611], + [1540e-9,14.0463704], + [1545e-9,14.08906725], + [1550e-9,14.13278052], + [1555e-9,14.18605286], + [1560e-9,14.2300396], + [1565e-9,14.27204602], + [1570e-9,14.33214219], + [1575e-9,14.37325593], + [1580e-9,14.41873986], + [1585e-9,14.47146449], + [1590e-9,14.51965833], + [1595e-9,14.56653756], + [1600e-9,14.60865354], + [1605e-9,14.65292487], + [1610e-9,14.70647543], + [1615e-9,14.75635087], + [1620e-9,14.82100212], + [1625e-9,14.84862799], + [1630e-9,14.8956765], + [1635e-9,14.94712102], + [1640e-9,14.99170484], + [1645e-9,15.02392461], + [1650e-9,15.08179888], + [1655e-9,15.1223348], + [1660e-9,15.17582154], + [1665e-9,15.23233469], + [1670e-9,15.2773787], + [1675e-9,15.34740513], + [1680e-9,15.38951869], + [1685e-9,15.4724516], + [1690e-9,15.49621661], + [1695e-9,15.53351552], + [1700e-9,15.55632073] + ] + } + ] + } +} \ No newline at end of file diff --git a/schemas/asset_schema.json b/schemas/asset_schema.json new file mode 100644 index 00000000..b650ef6c --- /dev/null +++ b/schemas/asset_schema.json @@ -0,0 +1,94 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "description": "Root object for the JSON data structure", + "properties": { + "metadata": { + "type": "object", + "description": "Metadata about the asset", + "properties": { + "copyright": { + "type": "string", + "description": "Copyright information" + }, + "generator": { + "type": "string", + "description": "The tool or software used to generate the asset" + }, + "openmaterial_version": { + "type": "string", + "description": "Version of OpenMATERIAL", + "pattern": "^\\d+\\.\\d+\\.\\d+$" + }, + "creator": { + "type": "string", + "description": "Creator of the asset" + }, + "creation_date": { + "type": "string", + "description": "Creation date of the asset in the format YYYYMMDDTHHMMSSZ", + "pattern": "^\\d{8}T\\d{6}Z$" + }, + "asset_version": { + "type": "string", + "description": "Version of the asset", + "pattern": "^\\d+\\.\\d+\\.\\d+$" + }, + "id": { + "type": "string", + "description": "Unique identifier for the asset", + "pattern": "^[a-f0-9]{32}$" + }, + "name": { + "type": "string", + "description": "Name of the asset" + }, + "label": { + "type": "string", + "description": "Label or category of the asset" + }, + "description": { + "type": "string", + "description": "Description of the asset" + } + }, + "required": [ + "copyright", + "generator", + "openmaterial_version", + "creator", + "creation_date", + "asset_version", + "id", + "name", + "label", + "description" + ] + }, + "material_mapping": { + "type": "array", + "description": "Mapping of materials used in the asset", + "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}$" + }, + { + "type": "string", + "description": "Name of the material" + } + ], + "minItems": 2, + "maxItems": 2 + } + } + }, + "required": [ + "metadata", + "material_mapping" + ] +} diff --git a/schemas/material_schema.json b/schemas/material_schema.json new file mode 100644 index 00000000..393bd958 --- /dev/null +++ b/schemas/material_schema.json @@ -0,0 +1,152 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "metadata": { + "type": "object", + "description": "Metadata related to the material.", + "properties": { + "copyright": { + "type": "string", + "description": "Copyright information.", + "pattern": "^\\(C\\) \\d{4}-\\d{4}, .+$" + }, + "generator": { + "type": "string", + "description": "Software or tool used to generate the material." + }, + "openmaterial_version": { + "type": "string", + "description": "Version of OpenMATERIAL.", + "pattern": "^\\d+\\.\\d+\\.\\d+$" + }, + "creator": { + "type": "string", + "description": "Creator of the material." + }, + "creation_date": { + "type": "string", + "description": "Date when the material was created, in the format YYYYMMDDTHHMMSSZ.", + "pattern": "^\\d{8}T\\d{6}Z$" + }, + "material_version": { + "type": "string", + "description": "Version of the material.", + "pattern": "^\\d+\\.\\d+\\.\\d+$" + }, + "id": { + "type": "string", + "description": "Unique identifier for the material.", + "pattern": "^[a-f0-9]{32}$" + }, + "name": { + "type": "string", + "description": "Name of the material." + }, + "description": { + "type": "string", + "description": "Description of the material." + } + }, + "required": [ + "copyright", + "generator", + "openmaterial_version", + "creator", + "creation_date", + "material_version", + "id", + "name", + "description" + ] + }, + "materials_properties": { + "type": "object", + "description": "Properties related to the material.", + "properties": { + "surface_roughness": { + "type": "object", + "description": "Information about the surface roughness of the material.", + "properties": { + "surface_height_rms": { + "type": "number", + "description": "Root mean square of surface height deviations." + }, + "surface_correlation_length": { + "type": "number", + "description": "Correlation length of the surface height deviations." + } + }, + "required": [ + "surface_height_rms", + "surface_correlation_length" + ] + }, + "index_of_refraction": { + "type": "array", + "description": "Index of refraction of the material at different temperatures.", + "items": { + "type": "object", + "properties": { + "temperature": { + "type": "number", + "description": "Temperature at which the index of refraction is measured." + }, + "n": { + "type": "array", + "description": "Real part of the refractive index as a function of wavelength.", + "items": { + "type": "array", + "items": [ + { + "type": "number", + "description": "Wavelength." + }, + { + "type": "number", + "description": "Real part of the refractive index at the specified wavelength." + } + ], + "minItems": 2, + "maxItems": 2 + } + }, + "k": { + "type": "array", + "description": "Imaginary part of the refractive index as a function of wavelength.", + "items": { + "type": "array", + "items": [ + { + "type": "number", + "description": "Wavelength." + }, + { + "type": "number", + "description": "Imaginary part of the refractive index at the specified wavelength." + } + ], + "minItems": 2, + "maxItems": 2 + } + } + }, + "required": [ + "temperature", + "n", + "k" + ] + } + } + }, + "required": [ + "surface_roughness", + "index_of_refraction" + ] + } + }, + "required": [ + "metadata", + "materials_properties" + ] +} From 104b63e05734c89fe1fa9b0e63442725cd6ca5b6 Mon Sep 17 00:00:00 2001 From: ClemensLinnhoff Date: Wed, 3 Jul 2024 18:18:58 +0200 Subject: [PATCH 2/8] Add space at the end for the files Signed-off-by: ClemensLinnhoff --- examples/example_asset.xoma | 2 +- examples/example_material.xomp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/example_asset.xoma b/examples/example_asset.xoma index f747b58a..d3a4aa01 100644 --- a/examples/example_asset.xoma +++ b/examples/example_asset.xoma @@ -14,4 +14,4 @@ "material_mapping": [ ["10;50;255;127", "example_material.xomp"] ] -} \ No newline at end of file +} diff --git a/examples/example_material.xomp b/examples/example_material.xomp index e41c56f1..8e550917 100644 --- a/examples/example_material.xomp +++ b/examples/example_material.xomp @@ -599,4 +599,4 @@ } ] } -} \ No newline at end of file +} From 48416db04aaaf041811e4331310d9037abdd7582 Mon Sep 17 00:00:00 2001 From: ClemensLinnhoff Date: Thu, 4 Jul 2024 12:45:20 +0200 Subject: [PATCH 3/8] Fix description of matterial assignment. Signed-off-by: ClemensLinnhoff --- schemas/asset_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/asset_schema.json b/schemas/asset_schema.json index b650ef6c..0a270a9d 100644 --- a/schemas/asset_schema.json +++ b/schemas/asset_schema.json @@ -79,7 +79,7 @@ }, { "type": "string", - "description": "Name of the material" + "description": "Path to an OpenMATERIAL property file" } ], "minItems": 2, From ac2dbf18c2e3ea057930bbf273dd2e32be3215c4 Mon Sep 17 00:00:00 2001 From: Frank Ralf Date: Thu, 1 Aug 2024 13:21:26 +0200 Subject: [PATCH 4/8] Add GitHub workflow for automatic validation of JSON schemas. Signed-off-by: Frank Ralf --- .github/workflows/validate-json.yaml | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/validate-json.yaml diff --git a/.github/workflows/validate-json.yaml b/.github/workflows/validate-json.yaml new file mode 100644 index 00000000..d449c594 --- /dev/null +++ b/.github/workflows/validate-json.yaml @@ -0,0 +1,29 @@ +# Validate JSON schema files +# Source: https://github.com/nhalstead/validate-json-action +# Forked from: https://github.com/marketplace/actions/validate-json +name: Validate JSON schemas for assets and materials + +on: + push: + branches: [ main ] + +jobs: + json-schema-validation: + name: JSON schema validation + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: Validate "asset" JSON schemas + uses: nhalstead/validate-json-action@0.1.3 + with: + schema: ./schemas/asset_schema.json + jsons: ./examples/*_asset.xoma + + - name: Validate "material" JSON schemas + uses: nhalstead/validate-json-action@0.1.3 + with: + schema: ./schemas/material_schema.json + jsons: ./examples/*_material.xomp + \ No newline at end of file From 8643fc6440d41aa4b41a02d8a922d259a5fa96dd Mon Sep 17 00:00:00 2001 From: Frank Ralf Date: Thu, 1 Aug 2024 13:39:44 +0200 Subject: [PATCH 5/8] Implement changes suggested by Clemens. Signed-off-by: Frank Ralf --- .github/workflows/validate-json.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/validate-json.yaml b/.github/workflows/validate-json.yaml index d449c594..dedda0a0 100644 --- a/.github/workflows/validate-json.yaml +++ b/.github/workflows/validate-json.yaml @@ -3,10 +3,8 @@ # Forked from: https://github.com/marketplace/actions/validate-json name: Validate JSON schemas for assets and materials -on: - push: - branches: [ main ] - +on: pull_request + jobs: json-schema-validation: name: JSON schema validation @@ -19,11 +17,11 @@ jobs: uses: nhalstead/validate-json-action@0.1.3 with: schema: ./schemas/asset_schema.json - jsons: ./examples/*_asset.xoma + jsons: ./examples/*.xoma - name: Validate "material" JSON schemas uses: nhalstead/validate-json-action@0.1.3 with: schema: ./schemas/material_schema.json - jsons: ./examples/*_material.xomp + jsons: ./examples/*.xomp \ No newline at end of file From b9124c1e5a0fd7a93257ddd96cff1e707d98c8ab Mon Sep 17 00:00:00 2001 From: ClemensLinnhoff Date: Thu, 1 Aug 2024 13:57:32 +0200 Subject: [PATCH 6/8] Add suggested description Signed-off-by: ClemensLinnhoff --- examples/example_asset.xoma | 2 +- schemas/asset_schema.json | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/example_asset.xoma b/examples/example_asset.xoma index d3a4aa01..d74259f5 100644 --- a/examples/example_asset.xoma +++ b/examples/example_asset.xoma @@ -12,6 +12,6 @@ "description": "Example car to demonstrate how OpenMATERIAL works" }, "material_mapping": [ - ["10;50;255;127", "example_material.xomp"] + ["10;50;255;127", "example_material.xomp", "metal with red paint"] ] } diff --git a/schemas/asset_schema.json b/schemas/asset_schema.json index 0a270a9d..610480ea 100644 --- a/schemas/asset_schema.json +++ b/schemas/asset_schema.json @@ -80,6 +80,10 @@ { "type": "string", "description": "Path to an OpenMATERIAL property file" + }, + { + "type": "string", + "description": "Short but precise description of the material" } ], "minItems": 2, From abae54be430342b68df1b319e9931ec4ba9bfcfb Mon Sep 17 00:00:00 2001 From: ClemensLinnhoff Date: Thu, 1 Aug 2024 13:59:05 +0200 Subject: [PATCH 7/8] Fix schema Signed-off-by: ClemensLinnhoff --- schemas/asset_schema.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schemas/asset_schema.json b/schemas/asset_schema.json index 610480ea..4813b22b 100644 --- a/schemas/asset_schema.json +++ b/schemas/asset_schema.json @@ -86,8 +86,8 @@ "description": "Short but precise description of the material" } ], - "minItems": 2, - "maxItems": 2 + "minItems": 3, + "maxItems": 3 } } }, From 97f65b160dd4bb07b5f19b0952d5251864360883 Mon Sep 17 00:00:00 2001 From: Frank Ralf Date: Thu, 1 Aug 2024 14:09:37 +0200 Subject: [PATCH 8/8] Restrict validation to pull request related only to schema folders. Signed-off-by: Frank Ralf --- .github/workflows/validate-json.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate-json.yaml b/.github/workflows/validate-json.yaml index dedda0a0..ed4bfe93 100644 --- a/.github/workflows/validate-json.yaml +++ b/.github/workflows/validate-json.yaml @@ -3,7 +3,11 @@ # Forked from: https://github.com/marketplace/actions/validate-json name: Validate JSON schemas for assets and materials -on: pull_request +on: + pull_request: + paths: + - 'examples/**' + - 'schemas/**' jobs: json-schema-validation: