Skip to content

Commit c8f0d9c

Browse files
Updates to Support PhysicallyBased V2 : Part I. (#37)
* Started work on updating the Physically Based API call to v2.0 * Add in colorspace tagging and handle specular color. The choise of colorspace and format (for specular) is to take the first entry which preserves the previous values but now with proper colorspace tagging. * Leave a Q. Is srgb-linear lin_rec709 or srgb_texture. Current set to srgb_texture. * - Handle specular color propertly for glTF vs SS vs OPBR. Note that Diseny and USDPreview are not currently supported but the default is Gulbrandsen. There is no BSDF for Lama nodes but the default should work there as well. - Fix colorspace specification. It was being used for all inputs instead of just ones where specifeid. - Fix transmission color colorspace setting. - Rerun translation for each shading model. * Fix to colorspace writing. Choose based on option. Default srgb-linear does not write lin_rec709 unless specified by option. * Fix up mapping of colors, colorspace for custom definitions. * Remove "default" colorspae behaviour. Colorspace is always explicitly set for clariity. * - Remove colorspace option for now. Will always choice linear. - Delete acescg translations --------- Co-authored-by: Anton Palmqvist <13031779+AntonPalmqvist@users.noreply.github.com>
1 parent 456508f commit c8f0d9c

14 files changed

Lines changed: 10870 additions & 4880 deletions

src/materialxMaterials.egg-info/PKG-INFO

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ See the <a href="https://kwokcb.github.io/materialxMaterials/examples/index.html
298298
</tr>
299299
</table>
300300
</td>
301+
</tr>
302+
<tr>
301303
<td>
302304
<b>PhysicallyBased</b>
303305
<table>
@@ -338,20 +340,23 @@ See the <a href="https://kwokcb.github.io/materialxMaterials/examples/index.html
338340
</tr>
339341
</table>
340342
</td>
343+
</tr>
344+
<tr>
341345
<td>
342346
<b>PolyHaven</b>
343347
<table>
348+
<!-- https://kwokcb.github.io/materialxMaterials/src/materialxMaterials/ -->
344349
<tr>
345350
<td>
346-
<img src="https://kwokcb.github.io/materialxMaterials/src/materialxMaterials/data/PolyHavenMaterialX/polyhaven_aerial_asphalt_1.png" width=256px%><br>
347-
Ashphalt
351+
<img src="https://raw.githubusercontent.com/kwokcb/materialxMaterials/refs/heads/main/examples/PolyHaven/aerial_asphalt_01_1k_materialx/aerial_asphalt_01_1k.png" width="256px"><br>
352+
Ashphalt 1
348353
</td>
349354
<td>
350-
<img src="https://kwokcb.github.io/materialxMaterials/src/materialxMaterials/data/PolyHavenMaterialX/polyhaven_polystrylene.png" width=256px><br>
351-
Polystyrene
355+
<img src="https://github.com/kwokcb/materialxMaterials/blob/main/examples/PolyHaven/aerial_rocks_02_1k_materialx/aerial_rocks_02_1k.png?raw=true" width="256px"><br>
356+
Rocks 2
352357
</td>
353358
<td>
354-
<img src="https://kwokcb.github.io/materialxMaterials/src/materialxMaterials/data/PolyHavenMaterialX/polyhave_wood_trunk_wall.png" width=256px><br>
359+
<img src="https://github.com/kwokcb/materialxMaterials/blob/main/examples/PolyHaven/wood_trunk_wall_1k_materialx/wood_trunk_wall_1k.png?raw=true" width="256px"><br>
355360
Wood Trunk Wall
356361
</td>
357362
</tr>
@@ -515,7 +520,7 @@ npm run [build/start] # Build distribution or run the package
515520

516521
<h3>Command Line Interfaces</h3>
517522

518-
<h4>Python</h4>
523+
<h4>PhysicallyBased</h4>
519524

520525
- Query all materials fom PhysicallyBased and convert them to all support shading models. Save the material list and corresponding MaterialX files in the default output location. The build will include this information Python package under the <code>data</code> folder.
521526

@@ -527,13 +532,16 @@ npm run [build/start] # Build distribution or run the package
527532
```sh
528533
materialxMaterials physbased
529534
```
535+
<h4>GPUOpen</h4>
530536

531537
- Query all materials fom GPUOpen. Extract out a few material packages (zip). Save the material lists, material names and unzipped packages (MaterialX and images) in the default output location. The build will include this information Python package under the <code>data</code> folder.
532538

533539
```sh
534540
materialxMaterials gpuopen --materialNames=1 --saveMaterials=1
535541
```
536542

543+
<h4>ambientCG</h4>
544+
537545
- Download the materials list fom ambientCG:
538546

539547
```sh
@@ -546,28 +554,50 @@ package where the images are 2K PNG files:
546554
```sh
547555
materialxMaterials acg --downloadMaterial "WoodFloor038" --downloadResolution 2
548556
```
549-
- Examine all texture assets on PolyHaven, and find all ones which have MaterialX resources. Does not download the asset.
557+
558+
<h4>PolyHaven</h4>
559+
560+
- Examine all texture assets on PolyHaven, and find all ones which have MaterialX resources.
550561

551562
```sh
552-
polyHavenLoaderCmd.py --fetch --download_id=""
563+
polyHavenLoaderCmd.py -fe
553564
```
554565

555-
- Extract out a specific MateriaX asset with a given identifier.
566+
- The extraction can be filtered by identifier:
556567
```sh
557-
polyHavenLoaderCmd.py --fetch --download_id="aerial_asphalt_01"
568+
polyHavenLoaderCmd.py -fe -id="aerial_asphalt_01"
558569
```
559-
- Extract out the first 10 MaterialX assets.
570+
- or by count. In this case the first 10 assets with MaterialX resources will be extracted.
560571
```sh
561-
polyHavenLoaderCmd.py --fetch -c 10
572+
polyHavenLoaderCmd.py -fe -c 10
562573
```
563574

564-
- Scan locally downloaded MaterialX asset information to download.
575+
Note that this does not download any of the content for each asset, but instead
576+
extract information into a file called `polyhaven_materialx_assets.json` for later usage.. The build process will include a file with this name under the <code>data</code> as part of the Python package. This avoids having to query the PolyHaven API repeatedly.
577+
578+
- The user can either use a local version of this file by specifying the path the file as shown below, where an optional `--data_folder` argument can be used to specify the location of the file.
565579

566580
```sh
567-
python -m materialxMaterials polyhaven --load --download_id="aerial_asphalt_01"
581+
python -m materialxMaterials polyhaven --load [--data-folder <myfolder location> -id="aerial_asphalt_01"
568582
```
569583

570-
<h5>NodeJS</h5>
584+
- If `--load` is not specified then the the packaged will be used by default.
585+
586+
```sh
587+
python -m materialxMaterials polyhaven -id="aerial_asphalt_01"
588+
```
589+
590+
Download options include:
591+
592+
1. `-x` or `--extract` to extract the content of the package (MaterialX and images) into a folder. By default the package will be downloaded but not extracted.
593+
594+
2. `-exr` or `--keep_exr` to keep the EXR files if they are included in the package. By default the equivalent PNG files are downloaded or EXR files are converted to PNG files. The latter requires the `OpenImageIO` package to be installed.
595+
- Note that if EXR images are remapped then the MaterialX file references
596+
are also remapped in the `.mtlx` file.
597+
598+
3. `-r` or `--download_resolution` to specify the resolution of the images to download. By default the lowest resolution images are downloaded. The user can specify "1k", "2k", "4k" or "8k".
599+
600+
<h4>GPUOpen (NodeJS)</h4>
571601

572602
The utility can be run from the `javascript\JsGPUOpenLoaderPackage` folder as follows:
573603

src/materialxMaterials.egg-info/SOURCES.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ src/materialxMaterials/data/PhysicallyBasedMaterialX/Cooking_Oil.png
5151
src/materialxMaterials/data/PhysicallyBasedMaterialX/Ketchup.png
5252
src/materialxMaterials/data/PhysicallyBasedMaterialX/PhysicallyBasedMaterial.json
5353
src/materialxMaterials/data/PhysicallyBasedMaterialX/PhysicallyBasedMaterialX_GLTF.mtlx
54+
src/materialxMaterials/data/PhysicallyBasedMaterialX/PhysicallyBasedMaterialX_GLTF_acescg.mtlx
5455
src/materialxMaterials/data/PhysicallyBasedMaterialX/PhysicallyBasedMaterialX_OPBR.mtlx
56+
src/materialxMaterials/data/PhysicallyBasedMaterialX/PhysicallyBasedMaterialX_OPBR_acescg.mtlx
5557
src/materialxMaterials/data/PhysicallyBasedMaterialX/PhysicallyBasedMaterialX_SS.mtlx
58+
src/materialxMaterials/data/PhysicallyBasedMaterialX/PhysicallyBasedMaterialX_SS_acescg.mtlx
5659
src/materialxMaterials/data/PhysicallyBasedMaterialX/PhysicallyBasedMaterialX_translated_GLTF.mtlx
5760
src/materialxMaterials/data/PhysicallyBasedMaterialX/PhysicallyBasedMaterialX_translated_OPBR.mtlx
5861
src/materialxMaterials/data/PhysicallyBasedMaterialX/PhysicallyBasedMaterialX_translated_SS.mtlx
@@ -61,17 +64,15 @@ src/materialxMaterials/data/PhysicallyBasedMaterialX/Skin.png
6164
src/materialxMaterials/data/PhysicallyBasedMaterialX/physbased_pbr.mtlx
6265
src/materialxMaterials/data/PhysicallyBasedMaterialX/physbased_pbr_materials.mtlx
6366
src/materialxMaterials/data/PhysicallyBasedMaterialX/physbased_pbr_translators.mtlx
64-
src/materialxMaterials/data/PolyHavenMaterialX/aerial_asphalt_01___1k_materialx.zip
6567
src/materialxMaterials/data/PolyHavenMaterialX/filtered_polyhaven_assets.json
6668
src/materialxMaterials/data/PolyHavenMaterialX/polyhave_wood_trunk_wall.png
6769
src/materialxMaterials/data/PolyHavenMaterialX/polyhaven_aerial_asphalt_1.png
6870
src/materialxMaterials/data/PolyHavenMaterialX/polyhaven_assets.json
6971
src/materialxMaterials/data/PolyHavenMaterialX/polyhaven_materialx_assets.json
7072
src/materialxMaterials/data/PolyHavenMaterialX/polyhaven_polystrylene.png
7173
src/materialxMaterials/data/PolyHavenMaterialX/polystyrene_1k_materialx.zip
72-
src/materialxMaterials/data/PolyHavenMaterialX/wood_trunk_wall___1k_materialx.zip
7374
src/materialxMaterials/data/PolyHavenMaterialX/polystyrene_1k_materialx/polystyrene_1k.mtlx
74-
src/materialxMaterials/data/PolyHavenMaterialX/polystyrene_1k_materialx/polystyrene_1k_thumbnail..png
75+
src/materialxMaterials/data/PolyHavenMaterialX/polystyrene_1k_materialx/polystyrene_1k_thumbnail.png
7576
src/materialxMaterials/data/PolyHavenMaterialX/polystyrene_1k_materialx/textures/polystyrene_diff_1k.jpg
7677
src/materialxMaterials/data/PolyHavenMaterialX/polystyrene_1k_materialx/textures/polystyrene_disp_1k.png
7778
src/materialxMaterials/data/PolyHavenMaterialX/polystyrene_1k_materialx/textures/polystyrene_nor_gl_1k.png

0 commit comments

Comments
 (0)