diff --git a/.gitattributes b/.gitattributes index eaab4287d2be9870a1f6e84e4d20cea0b4f464ac..35c37af78a30b5e2b5bbdcb948e76925cb9dd0fd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -72,3 +72,17 @@ assets/hammer/simready_usd/hammer.usd filter=lfs diff=lfs merge=lfs -text assets/hand_saw/simready_usd/hand_saw.usd filter=lfs diff=lfs merge=lfs -text assets/handheld_welding_shield/simready_usd/handheld_welding_shield.usd filter=lfs diff=lfs merge=lfs -text assets/handtruck/simready_usd/handtruck.usd filter=lfs diff=lfs merge=lfs -text +assets/industrial_cabinet/simready_usd/industrial_cabinet.usd filter=lfs diff=lfs merge=lfs -text +assets/jerrycan/simready_usd/jerrycan.usd filter=lfs diff=lfs merge=lfs -text +assets/ladder/simready_usd/ladder.usd filter=lfs diff=lfs merge=lfs -text +assets/lancable/simready_usd/lancable.usd filter=lfs diff=lfs merge=lfs -text +assets/machine_guard/simready_usd/machine_guard.usd filter=lfs diff=lfs merge=lfs -text +assets/monkey_wrench/simready_usd/monkey_wrench.usd filter=lfs diff=lfs merge=lfs -text +assets/office_chair/simready_usd/office_chair.usd filter=lfs diff=lfs merge=lfs -text +assets/oil_drain_cart/simready_usd/oil_drain_cart.usd filter=lfs diff=lfs merge=lfs -text +assets/paint_bucket/simready_usd/paint_bucket.usd filter=lfs diff=lfs merge=lfs -text +assets/pallet/simready_usd/pallet.usd filter=lfs diff=lfs merge=lfs -text +assets/pallet_stand/simready_usd/pallet_stand.usd filter=lfs diff=lfs merge=lfs -text +assets/pegboard/simready_usd/pegboard.usd filter=lfs diff=lfs merge=lfs -text +assets/platform_dolly/simready_usd/platform_dolly.usd filter=lfs diff=lfs merge=lfs -text +assets/pliers/simready_usd/pliers.usd filter=lfs diff=lfs merge=lfs -text diff --git a/assets/handtruck/simready_usd/textures/Handtruck_M_frame_ORM.png b/assets/handtruck/simready_usd/textures/Handtruck_M_frame_ORM.png new file mode 100644 index 0000000000000000000000000000000000000000..5045960ecc3fa34e9c361e766730031a8b35ded3 --- /dev/null +++ b/assets/handtruck/simready_usd/textures/Handtruck_M_frame_ORM.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0d3f6143f1d7ea307a8e6558be938ed4ada14a47c924232c5b3b50936a53f44 +size 660452 diff --git a/assets/handtruck/simready_usd/textures/Handtruck_M_handle_BaseColor.png b/assets/handtruck/simready_usd/textures/Handtruck_M_handle_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..fa5c5a576bae21752a29a6041252a7c6dd49eeb4 --- /dev/null +++ b/assets/handtruck/simready_usd/textures/Handtruck_M_handle_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4a85b9a7c9884cb5c4032b0a7ecad6d6a6f0aafc1cebe329cf81769e3e8bce5 +size 401124 diff --git a/assets/handtruck/simready_usd/textures/Handtruck_M_handle_Normal.png b/assets/handtruck/simready_usd/textures/Handtruck_M_handle_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..f3efe06d38fb57afd496d7bfecf7a894f8b5f95b --- /dev/null +++ b/assets/handtruck/simready_usd/textures/Handtruck_M_handle_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8bc3af08036561b352843db80dddef77ed2d72c9caebdf190e77bd040856541 +size 3387870 diff --git a/assets/handtruck/simready_usd/textures/Handtruck_M_handle_ORM.png b/assets/handtruck/simready_usd/textures/Handtruck_M_handle_ORM.png new file mode 100644 index 0000000000000000000000000000000000000000..bf775b5eda00f59e6504fd0a8f8fc3be478f5ba9 --- /dev/null +++ b/assets/handtruck/simready_usd/textures/Handtruck_M_handle_ORM.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2956822bc2b8bf538f133339b1dbf8e95e930b91f6f2ee4c9dc854c37f86031a +size 965656 diff --git a/assets/handtruck/simready_usd/textures/Handtruck_M_wheel_BaseColor.png b/assets/handtruck/simready_usd/textures/Handtruck_M_wheel_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..e34ee4e862147f1db923a2367aab475a0d4cc151 --- /dev/null +++ b/assets/handtruck/simready_usd/textures/Handtruck_M_wheel_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a9d879b55481338a303f5faad1612d552a523d7d427828796d972a5a7cacfcd +size 1091308 diff --git a/assets/handtruck/simready_usd/textures/Handtruck_M_wheel_Normal.png b/assets/handtruck/simready_usd/textures/Handtruck_M_wheel_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..1c8a43bdc274c8d12692539245a866696bc0012a --- /dev/null +++ b/assets/handtruck/simready_usd/textures/Handtruck_M_wheel_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d752b4001b0489e7c84a5551b18c9777daad8825157bd66387e28a9581b7069 +size 3282637 diff --git a/assets/handtruck/simready_usd/textures/Handtruck_M_wheel_ORM.png b/assets/handtruck/simready_usd/textures/Handtruck_M_wheel_ORM.png new file mode 100644 index 0000000000000000000000000000000000000000..c40b6942a284a780dc5a33a81424316675424a4a --- /dev/null +++ b/assets/handtruck/simready_usd/textures/Handtruck_M_wheel_ORM.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a68d1f5cf4da779a2bb0f330703f6f77ec40e1bc9bc994968f23b7023bf03a9 +size 1484551 diff --git a/assets/handtruck/simready_usd/textures/Handtruck_M_wheelcap_001_BaseColor.png b/assets/handtruck/simready_usd/textures/Handtruck_M_wheelcap_001_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..7a7a0e455b267e9ea20271e2ecbc8d8ecb6e1915 --- /dev/null +++ b/assets/handtruck/simready_usd/textures/Handtruck_M_wheelcap_001_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f96d83a53b0b970f2ad947c9cd0b26f0669cf3e4728ca3d16796ad45eab0fe5 +size 928834 diff --git a/assets/handtruck/simready_usd/textures/Handtruck_M_wheelcap_Normal.png b/assets/handtruck/simready_usd/textures/Handtruck_M_wheelcap_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..97b452705251947b486516160a599220b09c6506 --- /dev/null +++ b/assets/handtruck/simready_usd/textures/Handtruck_M_wheelcap_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d65d8bdefcfe38da0e79a002452840e9d2fc170ba101b605bd2f97c7d5b23bb +size 2798431 diff --git a/assets/handtruck/simready_usd/textures/Handtruck_M_wheelcap_ORM.png b/assets/handtruck/simready_usd/textures/Handtruck_M_wheelcap_ORM.png new file mode 100644 index 0000000000000000000000000000000000000000..e497d1f8ed52938d0e0cd22fb8c8776eb9628184 --- /dev/null +++ b/assets/handtruck/simready_usd/textures/Handtruck_M_wheelcap_ORM.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec2ee0f23b81e4fbc731d57337495399e640da0fd066402b9f77641f723ce59a +size 1427987 diff --git a/assets/industrial_cabinet/simready_usd/.simready/validation.json b/assets/industrial_cabinet/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..32c7579026033d33f74ebd891439ace860219898 --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/.simready/validation.json @@ -0,0 +1,174 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/industrial_cabinet/simready_usd/.thumbs/256x256/industrial_cabinet.usd.png b/assets/industrial_cabinet/simready_usd/.thumbs/256x256/industrial_cabinet.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..17dc30f8eb485f3954ac5d1d4e9ee955d43abf8a --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/.thumbs/256x256/industrial_cabinet.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bb4881076393d6b0f16d0511095a4010f6f2556afde3abd64f59b97c8fc057b9 +size 44447 diff --git a/assets/industrial_cabinet/simready_usd/.thumbs/256x256/industrial_cabinet.usd_light.png b/assets/industrial_cabinet/simready_usd/.thumbs/256x256/industrial_cabinet.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..f502f30fbd731192fe053185631b5366f02916aa --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/.thumbs/256x256/industrial_cabinet.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:635b235fb80134fae9789b6796109d17791e51b06d3e0a8fb110ec4e03579684 +size 29268 diff --git a/assets/industrial_cabinet/simready_usd/.thumbs/256x256/industrial_cabinet.usd_transparent.png b/assets/industrial_cabinet/simready_usd/.thumbs/256x256/industrial_cabinet.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..2008f80c2f9aee7a5a6208fcfda68d5db2d94b83 --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/.thumbs/256x256/industrial_cabinet.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9faa9f34dd58a177a7d9d0388b4b04f07197320295580e2f5b63d86ac0a078ae +size 23738 diff --git a/assets/industrial_cabinet/simready_usd/industrial_cabinet.usd b/assets/industrial_cabinet/simready_usd/industrial_cabinet.usd new file mode 100644 index 0000000000000000000000000000000000000000..c194a7d494f0626ab01c9705f1efbcc6093f4dd7 --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/industrial_cabinet.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cde66b30175a9a5e6a4f397a84c5d9d9dba8efd0251284de3da6fbc65618084a +size 125218720 diff --git a/assets/industrial_cabinet/simready_usd/materials/OmniPBR.mdl b/assets/industrial_cabinet/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/industrial_cabinet/simready_usd/materials/OmniPBRBase.mdl b/assets/industrial_cabinet/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/industrial_cabinet/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/industrial_cabinet/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/industrial_cabinet/simready_usd/post_validation.json b/assets/industrial_cabinet/simready_usd/post_validation.json new file mode 100644 index 0000000000000000000000000000000000000000..c69641ded2ca59ea84c089993f5c03b4d20cce5d --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/post_validation.json @@ -0,0 +1,18 @@ +{ + "C:/srtest/art/pkg_repo/.packages/industrial_cabinet/1.0.0/Industrial_Cabinet.usd": { + "features_summary": { + "FET030_PACKAGING_CORE": { + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET032_PACKAGING_INTROSPECTION": { + "dependencies": "[{'FET030_PACKAGING_CORE': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.1.0" + } + }, + "profile_id": "Package", + "profile_version": "1.0.0" + } +} \ No newline at end of file diff --git a/assets/industrial_cabinet/simready_usd/textures/T_Steel_BaseColor.png b/assets/industrial_cabinet/simready_usd/textures/T_Steel_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..1023c3336728ddae3b7b73098aa91b48a5b6eacf --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/textures/T_Steel_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c5b79696dac011bd3c4a2c9a2aeacda323323ba905e815d2976b0cf3089b7f4 +size 604150 diff --git a/assets/industrial_cabinet/simready_usd/textures/T_Steel_Chrome_BaseColor.png b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Chrome_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..e55c114c73c3052270eb7cf9b719c4d30a890cdd --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Chrome_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7b7f4cf369fc5a3c68c8dfac137a20b095c948eea42e289b41c6e9c03461095 +size 349774 diff --git a/assets/industrial_cabinet/simready_usd/textures/T_Steel_Chrome_Normal.png b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Chrome_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..ddc7c25c2e49ca80ed8664e4ad612b9cafe7364d --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Chrome_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82501214c29b50a5a2c174ebb01386a6485c1290665a4a399448d7a45cf6f42c +size 2325872 diff --git a/assets/industrial_cabinet/simready_usd/textures/T_Steel_Chrome_OcclusionRoughnessMetallic.png b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Chrome_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..5a64a36c855483e66de9e15b3d4547b8d8e38f9d --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Chrome_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9972bb73165e132bf1d829335ed5c4894b28ad37db83e9576c760fa5b8b74fa +size 339989 diff --git a/assets/industrial_cabinet/simready_usd/textures/T_Steel_Normal.png b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..e00296465fd745f0a6c19b5a25156f640d7d9f51 --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41d224a573a2dce4eb270449f2568990d225e7d6de49e3dfbe598ba8d4fb9f34 +size 1853560 diff --git a/assets/industrial_cabinet/simready_usd/textures/T_Steel_OcclusionRoughnessMetallic.png b/assets/industrial_cabinet/simready_usd/textures/T_Steel_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..728091b6dccac1992705bc8de399cc8fdd4f1eb1 --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/textures/T_Steel_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0bb821dd0a670bbf4c069c83263bdcfaabb7c6c3fdd71f60887f5af69d881ca8 +size 591775 diff --git a/assets/industrial_cabinet/simready_usd/textures/T_Steel_Painted_BaseColor.png b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Painted_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..7f070508119c26621b99d100ae897c3d442b6ace --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Painted_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31b7546dcaf1c4d2b9a49a39f9bf07d2e102d03a9ea3368ab22e5f5dacd2b654 +size 664773 diff --git a/assets/industrial_cabinet/simready_usd/textures/T_Steel_Painted_Normal.png b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Painted_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..3fb3cc48b3cd5c89402d3244520099c1af548053 --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Painted_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93053f472b8f831ad545f32d4d4ef29f8830876bd47ed0496a9dfe4eb8a66c1f +size 2314304 diff --git a/assets/industrial_cabinet/simready_usd/textures/T_Steel_Painted_OcclusionRoughnessMetallic.png b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Painted_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..830d917230b9cb12869a61eb052b0aca35b41e6a --- /dev/null +++ b/assets/industrial_cabinet/simready_usd/textures/T_Steel_Painted_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42acfb7ad6c13afe11199d387f253630a573574e0d6fe53921c6bda0273e80c2 +size 1862716 diff --git a/assets/jerrycan/simready_usd/.simready/validation.json b/assets/jerrycan/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..14b4b14ef1fb917401af651446e114e40959084d --- /dev/null +++ b/assets/jerrycan/simready_usd/.simready/validation.json @@ -0,0 +1,176 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/jerrycan/simready_usd/.thumbs/256x256/jerrycan.usd.png b/assets/jerrycan/simready_usd/.thumbs/256x256/jerrycan.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..826c5280cd59a850bb921a50b580c12e22efb4ef --- /dev/null +++ b/assets/jerrycan/simready_usd/.thumbs/256x256/jerrycan.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f62d96c1feea2e6ecc7ec4953270a13127db07fefb6f15753fd4c969bb987e19 +size 54449 diff --git a/assets/jerrycan/simready_usd/.thumbs/256x256/jerrycan.usd_light.png b/assets/jerrycan/simready_usd/.thumbs/256x256/jerrycan.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..89c6ff63fedf1fc0e94de77a286795b6a8dcf5b2 --- /dev/null +++ b/assets/jerrycan/simready_usd/.thumbs/256x256/jerrycan.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53177885e0242a5fd2a1d434137a2b513df898b2643bdd4c5e8bd2a17a063e4b +size 47903 diff --git a/assets/jerrycan/simready_usd/.thumbs/256x256/jerrycan.usd_transparent.png b/assets/jerrycan/simready_usd/.thumbs/256x256/jerrycan.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..ce6c3e4ff748b24092f0c2ef3c3b4c73be141d35 --- /dev/null +++ b/assets/jerrycan/simready_usd/.thumbs/256x256/jerrycan.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:222ea61b36f5bd0187bb9bc4a55f96cbf6965a2d68718a7d37c111e2762b2d31 +size 43517 diff --git a/assets/jerrycan/simready_usd/jerrycan.usd b/assets/jerrycan/simready_usd/jerrycan.usd new file mode 100644 index 0000000000000000000000000000000000000000..c63d44131c6ed821726fdc618d82585803bd1c04 --- /dev/null +++ b/assets/jerrycan/simready_usd/jerrycan.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:867569465a31d24f2df85be6b2562c5bcc37d92ede236ee78f51b8af0bc79e37 +size 2707416 diff --git a/assets/jerrycan/simready_usd/materials/OmniPBR.mdl b/assets/jerrycan/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/jerrycan/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/jerrycan/simready_usd/materials/OmniPBRBase.mdl b/assets/jerrycan/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/jerrycan/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/jerrycan/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/jerrycan/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/jerrycan/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_001_BaseColor.png b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_001_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..acd8312b2bd3be7b04b478d1d19f4bf1eb79841b --- /dev/null +++ b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_001_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2dda3735cefdb953ad1161f32b638aa3902f0238c32623cde6ad130914c61c5e +size 130701 diff --git a/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_001_Normal.png b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_001_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..4a428b3371459e9cc11aaa2fdd615dec049706f1 --- /dev/null +++ b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_001_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c21c25a47a07f04b549104e7dd7417e4a078b449180f9bac922d9c4a1c57147 +size 6193576 diff --git a/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_001_ORM.png b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_001_ORM.png new file mode 100644 index 0000000000000000000000000000000000000000..b747319e8c69dbd8f3733381f6111d95bfdc7b48 --- /dev/null +++ b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_001_ORM.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5f9a34bfe4bd40712268040e31d1793af0424afe207b2ff6984933f79f4f3cb +size 2096863 diff --git a/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_002_BaseColor.png b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_002_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..d254723396343d680a68231e8e4a3834714e0fd2 --- /dev/null +++ b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_002_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12edef064749ebff5a557c6c18f87b396cee40d41cc2e4c8a6f54d77fa786279 +size 16903 diff --git a/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_002_Normal.png b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_002_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..6c7f221ca24f8c48c69d4a1a22d799d5c1390909 --- /dev/null +++ b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_002_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88a8216e4560430f5a42986c8ba08e216c57a60192a160854c4510dc4ea24f40 +size 2649681 diff --git a/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_002_ORM.png b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_002_ORM.png new file mode 100644 index 0000000000000000000000000000000000000000..82e9f07d2c2d70fe90f4a0bb1ae537cb6d3ba41b --- /dev/null +++ b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_002_ORM.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ba312d9eb08c4232b482d3c08af9b1c24748d69e9b8f98f1cb60dd60f5cd8d8 +size 1347438 diff --git a/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_003_BaseColor.png b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_003_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..884c9018f27ae903012349f6877a8f4bb4d7b97f --- /dev/null +++ b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_003_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:397a48c576039ac29b10b257b54089bc42b95e74c03ba144c2cd0788ce0cd985 +size 389947 diff --git a/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_003_Normal.png b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_003_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..beb33570c1b243b5c4199ce8e1743d073b42e9ef --- /dev/null +++ b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_003_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e076691efa279022011e44ccc3d69c2cea6b6311a33d3e0344e4b20d4faee717 +size 2363008 diff --git a/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_003_ORM.png b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_003_ORM.png new file mode 100644 index 0000000000000000000000000000000000000000..70476bf6f432a66a351b0cc85db08ca6d5455322 --- /dev/null +++ b/assets/jerrycan/simready_usd/textures/Plastic_jerrycan_003_ORM.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1dde71d27619bd089b3e396b0abd408f0b68684b7b1dd27ae2e29d696a478f52 +size 894708 diff --git a/assets/ladder/simready_usd/.simready/validation.json b/assets/ladder/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..14b4b14ef1fb917401af651446e114e40959084d --- /dev/null +++ b/assets/ladder/simready_usd/.simready/validation.json @@ -0,0 +1,176 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/ladder/simready_usd/.thumbs/256x256/ladder.usd.png b/assets/ladder/simready_usd/.thumbs/256x256/ladder.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..5b767d53db95b5f7d7d969ed2b0c8d5d475a11f0 --- /dev/null +++ b/assets/ladder/simready_usd/.thumbs/256x256/ladder.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f53c3fdeaccfdac5316e2c3d482e09f1b6009746a44ab795cccdeea367beb80 +size 46045 diff --git a/assets/ladder/simready_usd/.thumbs/256x256/ladder.usd_light.png b/assets/ladder/simready_usd/.thumbs/256x256/ladder.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..ee0d8747f3060839be07a04ff5e66175595489b4 --- /dev/null +++ b/assets/ladder/simready_usd/.thumbs/256x256/ladder.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2fede30b645bea6cac7ee0d95840eaf04cc6578db8bca14b726284eeeeb8039 +size 26575 diff --git a/assets/ladder/simready_usd/.thumbs/256x256/ladder.usd_transparent.png b/assets/ladder/simready_usd/.thumbs/256x256/ladder.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..da9ed736bca90074c48f4f037140f7dc23b0003c --- /dev/null +++ b/assets/ladder/simready_usd/.thumbs/256x256/ladder.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:589ac4d7fe913b214e2977516e4d0ff6a1f92a25af61dca111b1d3a438e1e16d +size 18164 diff --git a/assets/ladder/simready_usd/ladder.usd b/assets/ladder/simready_usd/ladder.usd new file mode 100644 index 0000000000000000000000000000000000000000..32ad48c12d48b74a5deabde55611c77015fc766c --- /dev/null +++ b/assets/ladder/simready_usd/ladder.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:300595726e091cebfa903acc04b26d8a2b66ab7538b467aba0e6719ea803a707 +size 3025080 diff --git a/assets/ladder/simready_usd/materials/OmniPBR.mdl b/assets/ladder/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/ladder/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/ladder/simready_usd/materials/OmniPBRBase.mdl b/assets/ladder/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/ladder/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/ladder/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/ladder/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/ladder/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/ladder/simready_usd/textures/T_Metal_Alumium_BaseColor.png b/assets/ladder/simready_usd/textures/T_Metal_Alumium_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..e4c0c45d36eaa897be7ab618c0f3c9b3ef6b6414 --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Metal_Alumium_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d70e5a344e21a64bda13d277771513df92ce793576e7774257022459f6b6248b +size 1476997 diff --git a/assets/ladder/simready_usd/textures/T_Metal_Alumium_Normal.png b/assets/ladder/simready_usd/textures/T_Metal_Alumium_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..f74dc5e1385f70cb0210ce9c775babbbb098fff9 --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Metal_Alumium_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c778533cdb2117ed38a5accc76e89644d2db8e699301570bef7c020ebf41c124 +size 2452839 diff --git a/assets/ladder/simready_usd/textures/T_Metal_Alumium_OcclusionRoughnessMetallic.png b/assets/ladder/simready_usd/textures/T_Metal_Alumium_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..11c926f1c7c838b04e4cdf7bf5682d431790112c --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Metal_Alumium_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34f0359ae0f0e5d97c5614ef72fb2147ab3c6d8ba8c08fc1e070b7ba57ebb13d +size 2646455 diff --git a/assets/ladder/simready_usd/textures/T_Metal_Zinc_BaseColor.png b/assets/ladder/simready_usd/textures/T_Metal_Zinc_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..4bc513ce40d433d241d83a68b6a8f3defcb6bce4 --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Metal_Zinc_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:280bd21cc9365188fe7e190c0ffe95eea826eb76485b43bb83e1f07d236b4831 +size 1044871 diff --git a/assets/ladder/simready_usd/textures/T_Metal_Zinc_Normal.png b/assets/ladder/simready_usd/textures/T_Metal_Zinc_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..27e4505b2c36a4acbfc95121c8f2f94f7c737e4d --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Metal_Zinc_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a55a70be6c2a99820dc2949032d6310df45ff96162904a654293053aa89ffeb8 +size 2991647 diff --git a/assets/ladder/simready_usd/textures/T_Metal_Zinc_OcclusionRoughnessMetallic.png b/assets/ladder/simready_usd/textures/T_Metal_Zinc_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..dd4b5e62c7249939d2e2dbc20ab2943cd99d65dd --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Metal_Zinc_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:209beaf82d41ba65982f2b4df02b63fba672ebf07cde11877487c1e77af3c8af +size 1486227 diff --git a/assets/ladder/simready_usd/textures/T_Plastic_Red_BaseColor.png b/assets/ladder/simready_usd/textures/T_Plastic_Red_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..23b4d6fdd092d425023149d43986b9c9a1648d89 --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Plastic_Red_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6b7b531a83dd8960ac9e8e7ba4c42289a55baf2e1654a9887b5a0701fe883ad +size 183047 diff --git a/assets/ladder/simready_usd/textures/T_Plastic_Red_Normal.png b/assets/ladder/simready_usd/textures/T_Plastic_Red_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..b13adf99ad70b580f464581eae2ff32123b49d25 --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Plastic_Red_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1a6668457d5ef0369c7939081597928bc469419509674a79cadb7ec566c4759 +size 2276736 diff --git a/assets/ladder/simready_usd/textures/T_Plastic_Red_OcclusionRoughnessMetallic.png b/assets/ladder/simready_usd/textures/T_Plastic_Red_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..b17dbe2f413ec1d6d0b499809e24b19ab22c660f --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Plastic_Red_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f57df3f4aab5d5ef5315dfb3f1d837de1a65d03e322f816907da43fdb99da363 +size 153789 diff --git a/assets/ladder/simready_usd/textures/T_Rubber_BaseColor.png b/assets/ladder/simready_usd/textures/T_Rubber_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..ce6fc2d88dfc5be7f1a5138943277a6352ad6da6 --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Rubber_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae12915c13bcdf392bc989d82af94eb23cbeea0a7a084eb8c65a3acc087af45f +size 467252 diff --git a/assets/ladder/simready_usd/textures/T_Rubber_Normal.png b/assets/ladder/simready_usd/textures/T_Rubber_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..a3592014510b2b8df6ce53120438810b1eaa5f57 --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Rubber_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e18f3b20440951c649fccf1a6705f12e446377bbbd5d9ac7747a7b5e1938b420 +size 2284173 diff --git a/assets/ladder/simready_usd/textures/T_Rubber_OcclusionRoughnessMetallic.png b/assets/ladder/simready_usd/textures/T_Rubber_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..f7ebe636f80440edee0d2bd52e8309e86e9de8ac --- /dev/null +++ b/assets/ladder/simready_usd/textures/T_Rubber_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6b3bf93c932995f09a3ac273b489a560c6f1109acafbdd109b74af83ff307f8 +size 327231 diff --git a/assets/lancable/simready_usd/.simready/validation.json b/assets/lancable/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..c94852249c43047b64331045beb919e0a8de1e61 --- /dev/null +++ b/assets/lancable/simready_usd/.simready/validation.json @@ -0,0 +1,174 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001', 'com.nvidia.simready.PMT.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001', 'com.nvidia.simready.VM.PBR.003']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/lancable/simready_usd/.thumbs/256x256/lancable.usd.png b/assets/lancable/simready_usd/.thumbs/256x256/lancable.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..ab0afca90ef55fbb7ae153c1e220fc32ea7ee32f --- /dev/null +++ b/assets/lancable/simready_usd/.thumbs/256x256/lancable.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38ef8b382dc47749f247211f4ac82b8043c36df3657460a210039cbf7c4a23dd +size 40267 diff --git a/assets/lancable/simready_usd/.thumbs/256x256/lancable.usd_light.png b/assets/lancable/simready_usd/.thumbs/256x256/lancable.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..c15218a41a691e0cd55d7ee7bc3d2aba79aad0e9 --- /dev/null +++ b/assets/lancable/simready_usd/.thumbs/256x256/lancable.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecdaa035d2748529914ec7436e8367226ebbb0931a0b2e1ab3689cd7a8a9136c +size 15213 diff --git a/assets/lancable/simready_usd/.thumbs/256x256/lancable.usd_transparent.png b/assets/lancable/simready_usd/.thumbs/256x256/lancable.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..21ceba65efe5da77d7a7bf2510c69a2fc590d56d --- /dev/null +++ b/assets/lancable/simready_usd/.thumbs/256x256/lancable.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b74cab9d8a43451773ab207dbc8125194f7989a5452b696c15a22734ba93c644 +size 7980 diff --git a/assets/lancable/simready_usd/lancable.usd b/assets/lancable/simready_usd/lancable.usd new file mode 100644 index 0000000000000000000000000000000000000000..42816659427677e98133850cb49afb41ba7322d8 --- /dev/null +++ b/assets/lancable/simready_usd/lancable.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:725a2773ab698c01f6adb1ccb8907e15111352a8a4d067706033b06d9eb230f8 +size 9427470 diff --git a/assets/lancable/simready_usd/materials/OmniGlass.mdl b/assets/lancable/simready_usd/materials/OmniGlass.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a658cef20edae3e2d269a31ef1b0f50dca2c4f6 --- /dev/null +++ b/assets/lancable/simready_usd/materials/OmniGlass.mdl @@ -0,0 +1,238 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; +import ::anno::*; +import ::base::*; +import ::tex::*; + +using OmniGlass_Opacity import OmniGlass_Opacity; +export annotation distill_off(); + + +export material OmniGlass +( + color absorption_coeff = color(0.f, 0.f, 0.f) // hiding this parameter as it does not exist in the new material + [[ + anno::hidden(), + anno::unused() + ]], + uniform bool use_glass_color_texture = false + [[ + anno::hidden(), + anno::unused() + ]], + uniform color glass_color = color(1.f, 1.f, 1.f) + [[ + anno::display_name("Glass Color"), + anno::description("Sets the color of the glass"), + anno::hard_range(color(0.0), color(1.0)), + anno::in_group("Color") + ]], + uniform texture_2d glass_color_texture = texture_2d() + [[ + anno::display_name("Glass Color Texture"), + anno::description("Specifies the texture to be used for the glass color of the material"), + anno::in_group("Color") + ]], + float frosting_roughness = 0.f + [[ + anno::display_name("Glass Roughness"), + anno::description("Sets the roughness of the glass material "), + anno::hard_range(0.0, 1.0), + anno::in_group("Roughness") + ]], + uniform float glass_ior = 1.491f + [[ + anno::display_name("Glass IOR"), + anno::description("Sets IOR of the glass material "), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Refraction") + ]], + uniform bool thin_walled = false + [[ + anno::display_name("Thin Walled"), + anno::description("When enabled, the material is considered thin-walled. Use this, when you have glass surfaces that are modeled with a single plane"), + anno::in_group("Refraction") + ]], + uniform float depth = 0.001f + [[ + anno::description("Controls how much light is absorbed through the surface"), + anno::display_name("Volume Absorption Scale"), + anno::in_group("Color"), + anno::soft_range(0.f, 1.f), + anno::hard_range(0.f, 1000.f) + ]], + float roughness_texture_influence = 1.f + [[ + anno::display_name("Roughness Texture Influence"), + anno::in_group("Roughness"), + anno::hard_range(0.0f, 1.0f) + ]], + uniform texture_2d roughness_texture = texture_2d() + [[ + anno::description("The roughness texture"), + anno::display_name("Roughness Texture"), + anno::in_group("Roughness"), + anno::usage("roughness") + ]], + uniform texture_2d reflection_color_texture = texture_2d() + [[ + anno::description("The reflection color texture"), + anno::display_name("Reflection Color Texture"), + anno::in_group("Reflection") + ]], + uniform color reflection_color = color(1.f, 1.f, 1.f) + [[ + anno::display_name("Reflection Color"), + anno::in_group("Reflection") + ]], + uniform texture_2d normal_map_texture = texture_2d() + [[ + anno::description("The normal map texture"), + anno::display_name("Normal Map Texture"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float normal_map_strength = 1.0 + [[ + anno::description("Determines the degree of bumpiness"), + anno::display_name("Normal Map Strength"), + anno::in_group("Normal"), + anno::usage(""), + anno::soft_range(0.f, 1.f) + ]], + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.f, 1.f), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + // Cutout Opacity + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform float cutout_opacity = 1.0f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity") + ]], + uniform texture_2d cutout_opacity_texture = texture_2d() + [[ + anno::description("The opacity map"), + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + uniform base::mono_mode cutout_opacity_mono_source = base::mono_alpha + [[ + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::display_name("Opacity Mono Source"), + anno::in_group("Opacity"), + anno::usage("") + ]], + uniform float opacity_threshold = 0.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If negative, disable cutout_opacity; if 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + // UV Projection Group + uniform bool project_uvw = false + [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false + [[ + anno::display_name("Enable World Space"), + anno::description("When set to 'true' uses world space for projection, when 'false' object space is used"), + anno::in_group("UV") + ]], + + // UV Space Selector + uniform int uv_space_index = 0 + [[ + anno::display_name("UV Space Index"), + anno::description("Choose the UV Space Index to be used"), + anno::in_group("UV"), + anno::hard_range(0, 3) + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls the position of the texture."), + anno::in_group("UV") + ]], + uniform float texture_rotate = 0.f + [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of the texture in degrees."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV") + ]] +) +[[ + anno::author("NVIDIA CORPORATION"), + anno::display_name("Omni Glass"), + anno::version( 1, 0, 0), + anno::in_group("Base"), + anno::description("Omni Glass Material V2"), + anno::key_words(string[]("omni", "omniverse", "glass", "transparent", "window", "transparency", "workflow")), + distill_off() +]] += OmniGlass_Opacity( + glass_color: glass_color, + glass_color_texture: glass_color_texture, + frosting_roughness: frosting_roughness, + glass_ior: glass_ior, + thin_walled: thin_walled, + depth: depth, + roughness_texture_influence: roughness_texture_influence, + roughness_texture: roughness_texture, + reflection_color_texture: reflection_color_texture, + reflection_color: reflection_color, + normal_map_texture: normal_map_texture, + normal_map_strength: normal_map_strength, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + enable_opacity: enable_opacity, + cutout_opacity: cutout_opacity, + cutout_opacity_texture: cutout_opacity_texture, + cutout_opacity_mono_source: cutout_opacity_mono_source, + opacity_threshold: opacity_threshold, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale +); \ No newline at end of file diff --git a/assets/lancable/simready_usd/materials/OmniGlass_Opacity.mdl b/assets/lancable/simready_usd/materials/OmniGlass_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..567be528500dc5302d1e919790c2e06b15b3dc75 --- /dev/null +++ b/assets/lancable/simready_usd/materials/OmniGlass_Opacity.mdl @@ -0,0 +1,464 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + + +mdl 1.4; + +import ::tex::*; +import ::base::*; +import ::math::*; +import ::anno::*; +import ::df::*; +import ::state::*; +import OmniPBRBase::*; + +const string COPYRIGHT = +" Copyright 1986, 2020 NVIDIA Corporation. All rights reserved.\n" +" MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT,\n" +" WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR,\n" +" THE MDL MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\n" +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\n" +" COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA\n" +" CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY\n" +" GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN\n" +" AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR\n" +" INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN THE MDL MATERIALS.\n"; + +export annotation distill_off(); + + +float get_float( + uniform texture_2d t, + float f, + base::texture_coordinate_info uvw, + uniform base::mono_mode mono_source = base::mono_maximum +) +{ + return tex::texture_isvalid(t) ? + base::file_texture( + t, + color(0.f, 0.f, 0.f), + color(1.f, 1.f, 1.f), + mono_source, + uvw, + float2(0.f, 1.f), + float2(0.f, 1.f), + tex::wrap_repeat, + tex::wrap_repeat, + false + ).mono : + f; +} + +color get_color( + uniform texture_2d t, + color c, + base::texture_coordinate_info uvw +) +{ + return tex::texture_isvalid(t) ? + base::file_texture( + t, + color(0.f, 0.f, 0.f), + color(1.f, 1.f, 1.f), + base::mono_alpha, + uvw, + float2(0.f, 1.f), + float2(0.f, 1.f), + tex::wrap_repeat, + tex::wrap_repeat, + false + ).tint : + c; +} + +float apply_roughness_influence( + uniform texture_2d roughness_texture, + float constant_roughness, + float roughness_influence, + base::texture_coordinate_info uvw +) +{ + return math::lerp( + constant_roughness, + get_float(roughness_texture, constant_roughness, uvw), + roughness_influence + ); +} + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ + anno::description("Rotation applied to every UVW coordinate") + ]], + uniform float3 translation = float3(0.) + [[ + anno::description("Offset applied to every UVW coordinate") + ]], + uniform float3 scaling = float3(1.) + [[ + anno::description("Scale applied to every UVW coordinate") + ]] +) +[[ + anno::description("Construct transformation matrix from Euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = float4x4( + scaling.x , 0. , 0. , 0., + 0. , scaling.y , 0. , 0., + 0. , 0. , scaling.z , 0., + translation.x, translation.y, translation.z, 1. + ); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + float4x4 rotate = float4x4( + c.y*c.z, -c.x*s.z + s.x*s.y*c.z, s.x*s.z + c.x*s.y*c.z, 0.0, + c.y*s.z, c.x*c.z + s.x*s.y*s.z, -s.x*c.z + c.x*s.y*s.z, 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0. , 0. , 0. , 1. + ); + + return scale*rotate; +} + + +export material OmniGlass_Opacity +( + color absorption_coeff = color(0.f, 0.f, 0.f) // hiding this parameter as it does not exist in the new material + [[ + anno::hidden(), + anno::unused() + ]], + uniform bool use_glass_color_texture = false + [[ + anno::hidden(), + anno::unused() + ]], + uniform color glass_color = color(1.f, 1.f, 1.f) + [[ + anno::display_name("Glass Color"), + anno::description("Sets the color of the glass"), + anno::hard_range(color(0.0), color(1.0)), + anno::in_group("Color") + ]], + uniform texture_2d glass_color_texture = texture_2d() + [[ + anno::display_name("Glass Color Texture"), + anno::description("Specifies the texture to be used for the glass color of the material"), + anno::in_group("Color") + ]], + float frosting_roughness = 0.f + [[ + anno::display_name("Glass Roughness"), + anno::description("Sets the roughness of the glass material "), + anno::hard_range(0.0, 1.0), + anno::in_group("Roughness") + ]], + uniform float glass_ior = 1.491f + [[ + anno::display_name("Glass IOR"), + anno::description("Sets IOR of the glass material "), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Refraction") + ]], + uniform bool thin_walled = false + [[ + anno::display_name("Thin Walled"), + anno::description("When enabled, the material is considered thin-walled. Use this, when you have glass surfaces that are modeled with a single plane"), + anno::in_group("Refraction") + ]], + uniform float depth = 0.001f + [[ + anno::description("Controls how much light is absorbed through the surface"), + anno::display_name("Volume Absorption Scale"), + anno::in_group("Color"), + anno::soft_range(0.f, 1.f), + anno::hard_range(0.f, 1000.f) + ]], + float roughness_texture_influence = 1.f + [[ + anno::display_name("Roughness Texture Influence"), + anno::in_group("Roughness"), + anno::hard_range(0.0f, 1.0f) + ]], + uniform texture_2d roughness_texture = texture_2d() + [[ + anno::description("The roughness texture"), + anno::display_name("Roughness Texture"), + anno::in_group("Roughness"), + anno::usage("") + ]], + uniform texture_2d reflection_color_texture = texture_2d() + [[ + anno::description("The reflection color texture"), + anno::display_name("Reflection Color Texture"), + anno::in_group("Reflection") + ]], + uniform color reflection_color = color(1.f, 1.f, 1.f) + [[ + anno::display_name("Reflection Color"), + anno::in_group("Reflection") + ]], + uniform texture_2d normal_map_texture = texture_2d() + [[ + anno::description("The normal map texture"), + anno::display_name("Normal Map Texture"), + anno::in_group("Normal"), + anno::usage("") + ]], + uniform float normal_map_strength = 1.0 + [[ + anno::description("Determines the degree of bumpiness"), + anno::display_name("Normal Map Strength"), + anno::in_group("Normal"), + anno::usage(""), + anno::soft_range(0.f, 1.f) + ]], + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.f, 1.f), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + // Cutout Opacity + uniform bool enable_opacity = true + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform float cutout_opacity = 1.0f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity") + ]], + uniform texture_2d cutout_opacity_texture = texture_2d() + [[ + anno::description("The opacity map"), + anno::display_name("Opacity Map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode cutout_opacity_mono_source = base::mono_alpha + [[ + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::display_name("Opacity Mono Source"), + anno::in_group("Opacity"), + anno::usage("") + ]], + uniform float opacity_threshold = 0.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If negative, disable cutout_opacity; if 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + // UV Projection Group + uniform bool project_uvw = false + [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false + [[ + anno::display_name("Enable World Space"), + anno::description("When set to 'true' uses world space for projection, when 'false' object space is used"), + anno::in_group("UV") + ]], + + // UV Space Selector + uniform int uv_space_index = 0 + [[ + anno::display_name("UV Space Index"), + anno::description("Choose the UV Space Index to be used"), + anno::in_group("UV"), + anno::hard_range(0, 3) + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls the position of the texture."), + anno::in_group("UV") + ]], + uniform float texture_rotate = 0.f + [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of the texture in degrees."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger numbers increase the size."), + anno::in_group("UV") + ]] +) +[[ + anno::copyright_notice(COPYRIGHT), + anno::author("NVIDIA CORPORATION"), + anno::display_name("Omni Glass Opacity"), + anno::version( 1, 0, 0), + anno::description("Omni Glass Opacity Material"), + anno::in_group("Base"), + anno::key_words(string[]("omni", "omniverse", "glass", "transparent", "window", "transparency", "workflow")), + distill_off() +]] += let { + // Material Properties + bool local_thin_walled = (tex::texture_isvalid(cutout_opacity_texture) || cutout_opacity != 1.f) ? true : thin_walled; + color local_glass_ior = glass_ior; + + + // UVW Properties + // Generating the texture coordinates for the texture lookups + base::texture_coordinate_system the_system = world_or_object ? + base::texture_coordinate_world : + base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? + base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + + // Opacity Properties + float opacity_value = get_float(cutout_opacity_texture, cutout_opacity, transformed_uvw, cutout_opacity_mono_source); + + // The opacity_threshold is interpreted as follows: + // 1. opacity_threshold > 0: binary opacity masking mode + // i.e.: if opacity_value > opacity_threshold we remap opacity_value to 1.0, otherwise to 0.0 + // 2. opacity_threshold == 0: fractional opacity mode. Leaves the opacity_value untouched, + // allowing the renderer to use fractional cutout_opacity values, if it supports this feature + // + // NOTE: when the renderer does not enable 'fractional cutout opacity' it interprets + // cutout_opacity values of 1.0 as opaque and anything below as fully transparent + float local_cutout_opacity = enable_opacity ? + ((opacity_threshold == 0.0) ? + opacity_value : + ((opacity_value >= opacity_threshold) ? 1.0 : 0) + ) : + 1.0; + + + // Surface Properties + color local_reflection_color = get_color(reflection_color_texture, reflection_color, transformed_uvw); + color local_transmission_color = get_color(glass_color_texture, glass_color, transformed_uvw); + + OmniPBRBase::NormalData defaultData(state::normal(), float2(0.f)); + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normal_map_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + normal_map_texture, + normal_map_strength, + flip_tangent_u, + flip_tangent_v, + transformed_uvw, + float2(0.f, 1.f), + float2(0.f, 1.f), + tex::wrap_repeat, + tex::wrap_repeat, + false, + 1.f, + 0.f, + 0.f, + int2(0), + tex::wrap_repeat, + 30.f + ) : + defaultData; + + float local_roughness = apply_roughness_influence( + roughness_texture, + frosting_roughness, + roughness_texture_influence, + transformed_uvw + ); + float2 local_roughness_squared( + (local_roughness * local_roughness + + geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x), + (local_roughness * local_roughness + + geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y) + ); + + float3 the_normal = normal_data.normal; + + bsdf ggx_1 = ::df::microfacet_ggx_smith_bsdf( + roughness_u: local_roughness_squared.x, + roughness_v: local_roughness_squared.y, + tint: local_reflection_color, + tangent_u: ::state::texture_tangent_u(0), + mode: ::df::scatter_reflect + ); + + bsdf ggx_2 = ::df::microfacet_ggx_smith_bsdf( + roughness_u: local_roughness_squared.x, + roughness_v: local_roughness_squared.y, + tint: local_transmission_color, + tangent_u: ::state::texture_tangent_u(0), + mode: ::df::scatter_transmit + ); + + material_surface local_surface( + ::df::fresnel_layer( + ior: glass_ior, + weight: 1.f, + layer: ggx_1, + base: ggx_2, + normal: the_normal + ), + material_emission() + ); + + + // Volume Properties + color local_volume_absorption = depth; + color local_volume_scattering = color(0.f, 0.f, 0.f); + + material_volume local_volume(vdf(), local_volume_absorption, local_volume_scattering); + + + // Geometry Properties + material_geometry local_geometry(float3(0.f), local_cutout_opacity, the_normal); + +} in material( + thin_walled: local_thin_walled, + surface: local_surface, + ior: local_glass_ior, + volume: local_volume, + geometry: local_geometry +); diff --git a/assets/lancable/simready_usd/materials/OmniPBR.mdl b/assets/lancable/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/lancable/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/lancable/simready_usd/materials/OmniPBRBase.mdl b/assets/lancable/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/lancable/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/lancable/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/lancable/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/lancable/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/lancable/simready_usd/post_validation.json b/assets/lancable/simready_usd/post_validation.json new file mode 100644 index 0000000000000000000000000000000000000000..2802f5d613946da778d20c84c1fff692b229478b --- /dev/null +++ b/assets/lancable/simready_usd/post_validation.json @@ -0,0 +1,18 @@ +{ + "C:/srtest/def/pkg_repo/.packages/lancable/1.0.0/LanCable.usd": { + "features_summary": { + "FET030_PACKAGING_CORE": { + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET032_PACKAGING_INTROSPECTION": { + "dependencies": "[{'FET030_PACKAGING_CORE': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.1.0" + } + }, + "profile_id": "Package", + "profile_version": "1.0.0" + } +} \ No newline at end of file diff --git a/assets/lancable/simready_usd/textures/T_Plastic_Pp_BaseColor.png b/assets/lancable/simready_usd/textures/T_Plastic_Pp_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..da87712828baf57f57ea4f588fbc915c782f01a7 --- /dev/null +++ b/assets/lancable/simready_usd/textures/T_Plastic_Pp_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8878fe9bff1b7f040bfd62dce110941e23e8bbfa04a93db954e8f1f5583530a +size 235703 diff --git a/assets/lancable/simready_usd/textures/T_Plastic_Pp_Normal.png b/assets/lancable/simready_usd/textures/T_Plastic_Pp_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..e659e8472867f47ea26ad71ef3d8b1c9ebaa56a1 --- /dev/null +++ b/assets/lancable/simready_usd/textures/T_Plastic_Pp_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c6f1051a75c594765f112b45b6684092e7449a1a910839815070f2edb3201a2e +size 3390042 diff --git a/assets/lancable/simready_usd/textures/T_Plastic_Pp_Roughness.png b/assets/lancable/simready_usd/textures/T_Plastic_Pp_Roughness.png new file mode 100644 index 0000000000000000000000000000000000000000..4d29288d4682edb0d4e47000c7d526aa6feff4d8 --- /dev/null +++ b/assets/lancable/simready_usd/textures/T_Plastic_Pp_Roughness.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb11e8b0c2d27e8cc66838b0d6bebd2bda6a04bfc8adeca3d2f135af87143ed6 +size 350670 diff --git a/assets/lancable/simready_usd/textures/T_Plastic_Pvc_BaseColor.png b/assets/lancable/simready_usd/textures/T_Plastic_Pvc_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..12bed1047252456c0af7a29c233b3e73f4a79074 --- /dev/null +++ b/assets/lancable/simready_usd/textures/T_Plastic_Pvc_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d357a1987698c3dcfc5fcf831d8206345400a84caf900d12c6b677bb2bb20a04 +size 212798 diff --git a/assets/lancable/simready_usd/textures/T_Plastic_Pvc_Normal.png b/assets/lancable/simready_usd/textures/T_Plastic_Pvc_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..47d6855b2f1ce8171c1c73956d0e79ec04502e40 --- /dev/null +++ b/assets/lancable/simready_usd/textures/T_Plastic_Pvc_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de1713cc21e10180b1a1b42c663748f75991d1adcae4c5fce0183de801390e23 +size 2419415 diff --git a/assets/lancable/simready_usd/textures/T_Plastic_Pvc_OcclusionRoughnessMetallic.png b/assets/lancable/simready_usd/textures/T_Plastic_Pvc_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..41ec388e8ca24e63b3a9c681e1dd58271b2a4f5b --- /dev/null +++ b/assets/lancable/simready_usd/textures/T_Plastic_Pvc_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7692b1eb7b0a8fe0392a2344971809e872c5416614b7f98694651ac486a14191 +size 1382070 diff --git a/assets/machine_guard/simready_usd/.simready/validation.json b/assets/machine_guard/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..14b4b14ef1fb917401af651446e114e40959084d --- /dev/null +++ b/assets/machine_guard/simready_usd/.simready/validation.json @@ -0,0 +1,176 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/machine_guard/simready_usd/.thumbs/256x256/machine_guard.usd.png b/assets/machine_guard/simready_usd/.thumbs/256x256/machine_guard.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..b53aa58e658266bd56b080e06156b905ce444fc4 --- /dev/null +++ b/assets/machine_guard/simready_usd/.thumbs/256x256/machine_guard.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8be3b2c7f9b8e29c937fbdd587c49a6c7522a9d7a2cdcaffe1ae1508c8d75f88 +size 32265 diff --git a/assets/machine_guard/simready_usd/.thumbs/256x256/machine_guard.usd_light.png b/assets/machine_guard/simready_usd/.thumbs/256x256/machine_guard.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..b53aa58e658266bd56b080e06156b905ce444fc4 --- /dev/null +++ b/assets/machine_guard/simready_usd/.thumbs/256x256/machine_guard.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8be3b2c7f9b8e29c937fbdd587c49a6c7522a9d7a2cdcaffe1ae1508c8d75f88 +size 32265 diff --git a/assets/machine_guard/simready_usd/.thumbs/256x256/machine_guard.usd_transparent.png b/assets/machine_guard/simready_usd/.thumbs/256x256/machine_guard.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..8c17f2cb4c8ad969ac868bef989420b0101ba415 --- /dev/null +++ b/assets/machine_guard/simready_usd/.thumbs/256x256/machine_guard.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91480ae2812bee7584832865a5908b41f661c581e6ccbc34dc2e6870edcf2e42 +size 22228 diff --git a/assets/machine_guard/simready_usd/machine_guard.usd b/assets/machine_guard/simready_usd/machine_guard.usd new file mode 100644 index 0000000000000000000000000000000000000000..44b90bfcb4db7b09a8367e42d1526f75908c6493 --- /dev/null +++ b/assets/machine_guard/simready_usd/machine_guard.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f61c8a97c7647d26f7c084173cad34504d5ca365e2423c039e3bfb76e6d5a0c +size 2941407 diff --git a/assets/machine_guard/simready_usd/materials/OmniGlass.mdl b/assets/machine_guard/simready_usd/materials/OmniGlass.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a658cef20edae3e2d269a31ef1b0f50dca2c4f6 --- /dev/null +++ b/assets/machine_guard/simready_usd/materials/OmniGlass.mdl @@ -0,0 +1,238 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; +import ::anno::*; +import ::base::*; +import ::tex::*; + +using OmniGlass_Opacity import OmniGlass_Opacity; +export annotation distill_off(); + + +export material OmniGlass +( + color absorption_coeff = color(0.f, 0.f, 0.f) // hiding this parameter as it does not exist in the new material + [[ + anno::hidden(), + anno::unused() + ]], + uniform bool use_glass_color_texture = false + [[ + anno::hidden(), + anno::unused() + ]], + uniform color glass_color = color(1.f, 1.f, 1.f) + [[ + anno::display_name("Glass Color"), + anno::description("Sets the color of the glass"), + anno::hard_range(color(0.0), color(1.0)), + anno::in_group("Color") + ]], + uniform texture_2d glass_color_texture = texture_2d() + [[ + anno::display_name("Glass Color Texture"), + anno::description("Specifies the texture to be used for the glass color of the material"), + anno::in_group("Color") + ]], + float frosting_roughness = 0.f + [[ + anno::display_name("Glass Roughness"), + anno::description("Sets the roughness of the glass material "), + anno::hard_range(0.0, 1.0), + anno::in_group("Roughness") + ]], + uniform float glass_ior = 1.491f + [[ + anno::display_name("Glass IOR"), + anno::description("Sets IOR of the glass material "), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Refraction") + ]], + uniform bool thin_walled = false + [[ + anno::display_name("Thin Walled"), + anno::description("When enabled, the material is considered thin-walled. Use this, when you have glass surfaces that are modeled with a single plane"), + anno::in_group("Refraction") + ]], + uniform float depth = 0.001f + [[ + anno::description("Controls how much light is absorbed through the surface"), + anno::display_name("Volume Absorption Scale"), + anno::in_group("Color"), + anno::soft_range(0.f, 1.f), + anno::hard_range(0.f, 1000.f) + ]], + float roughness_texture_influence = 1.f + [[ + anno::display_name("Roughness Texture Influence"), + anno::in_group("Roughness"), + anno::hard_range(0.0f, 1.0f) + ]], + uniform texture_2d roughness_texture = texture_2d() + [[ + anno::description("The roughness texture"), + anno::display_name("Roughness Texture"), + anno::in_group("Roughness"), + anno::usage("roughness") + ]], + uniform texture_2d reflection_color_texture = texture_2d() + [[ + anno::description("The reflection color texture"), + anno::display_name("Reflection Color Texture"), + anno::in_group("Reflection") + ]], + uniform color reflection_color = color(1.f, 1.f, 1.f) + [[ + anno::display_name("Reflection Color"), + anno::in_group("Reflection") + ]], + uniform texture_2d normal_map_texture = texture_2d() + [[ + anno::description("The normal map texture"), + anno::display_name("Normal Map Texture"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float normal_map_strength = 1.0 + [[ + anno::description("Determines the degree of bumpiness"), + anno::display_name("Normal Map Strength"), + anno::in_group("Normal"), + anno::usage(""), + anno::soft_range(0.f, 1.f) + ]], + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.f, 1.f), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + // Cutout Opacity + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform float cutout_opacity = 1.0f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity") + ]], + uniform texture_2d cutout_opacity_texture = texture_2d() + [[ + anno::description("The opacity map"), + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + uniform base::mono_mode cutout_opacity_mono_source = base::mono_alpha + [[ + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::display_name("Opacity Mono Source"), + anno::in_group("Opacity"), + anno::usage("") + ]], + uniform float opacity_threshold = 0.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If negative, disable cutout_opacity; if 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + // UV Projection Group + uniform bool project_uvw = false + [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false + [[ + anno::display_name("Enable World Space"), + anno::description("When set to 'true' uses world space for projection, when 'false' object space is used"), + anno::in_group("UV") + ]], + + // UV Space Selector + uniform int uv_space_index = 0 + [[ + anno::display_name("UV Space Index"), + anno::description("Choose the UV Space Index to be used"), + anno::in_group("UV"), + anno::hard_range(0, 3) + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls the position of the texture."), + anno::in_group("UV") + ]], + uniform float texture_rotate = 0.f + [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of the texture in degrees."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV") + ]] +) +[[ + anno::author("NVIDIA CORPORATION"), + anno::display_name("Omni Glass"), + anno::version( 1, 0, 0), + anno::in_group("Base"), + anno::description("Omni Glass Material V2"), + anno::key_words(string[]("omni", "omniverse", "glass", "transparent", "window", "transparency", "workflow")), + distill_off() +]] += OmniGlass_Opacity( + glass_color: glass_color, + glass_color_texture: glass_color_texture, + frosting_roughness: frosting_roughness, + glass_ior: glass_ior, + thin_walled: thin_walled, + depth: depth, + roughness_texture_influence: roughness_texture_influence, + roughness_texture: roughness_texture, + reflection_color_texture: reflection_color_texture, + reflection_color: reflection_color, + normal_map_texture: normal_map_texture, + normal_map_strength: normal_map_strength, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + enable_opacity: enable_opacity, + cutout_opacity: cutout_opacity, + cutout_opacity_texture: cutout_opacity_texture, + cutout_opacity_mono_source: cutout_opacity_mono_source, + opacity_threshold: opacity_threshold, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale +); \ No newline at end of file diff --git a/assets/machine_guard/simready_usd/materials/OmniGlass_Opacity.mdl b/assets/machine_guard/simready_usd/materials/OmniGlass_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..567be528500dc5302d1e919790c2e06b15b3dc75 --- /dev/null +++ b/assets/machine_guard/simready_usd/materials/OmniGlass_Opacity.mdl @@ -0,0 +1,464 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + + +mdl 1.4; + +import ::tex::*; +import ::base::*; +import ::math::*; +import ::anno::*; +import ::df::*; +import ::state::*; +import OmniPBRBase::*; + +const string COPYRIGHT = +" Copyright 1986, 2020 NVIDIA Corporation. All rights reserved.\n" +" MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT,\n" +" WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR,\n" +" THE MDL MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\n" +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\n" +" COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA\n" +" CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY\n" +" GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN\n" +" AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR\n" +" INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN THE MDL MATERIALS.\n"; + +export annotation distill_off(); + + +float get_float( + uniform texture_2d t, + float f, + base::texture_coordinate_info uvw, + uniform base::mono_mode mono_source = base::mono_maximum +) +{ + return tex::texture_isvalid(t) ? + base::file_texture( + t, + color(0.f, 0.f, 0.f), + color(1.f, 1.f, 1.f), + mono_source, + uvw, + float2(0.f, 1.f), + float2(0.f, 1.f), + tex::wrap_repeat, + tex::wrap_repeat, + false + ).mono : + f; +} + +color get_color( + uniform texture_2d t, + color c, + base::texture_coordinate_info uvw +) +{ + return tex::texture_isvalid(t) ? + base::file_texture( + t, + color(0.f, 0.f, 0.f), + color(1.f, 1.f, 1.f), + base::mono_alpha, + uvw, + float2(0.f, 1.f), + float2(0.f, 1.f), + tex::wrap_repeat, + tex::wrap_repeat, + false + ).tint : + c; +} + +float apply_roughness_influence( + uniform texture_2d roughness_texture, + float constant_roughness, + float roughness_influence, + base::texture_coordinate_info uvw +) +{ + return math::lerp( + constant_roughness, + get_float(roughness_texture, constant_roughness, uvw), + roughness_influence + ); +} + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ + anno::description("Rotation applied to every UVW coordinate") + ]], + uniform float3 translation = float3(0.) + [[ + anno::description("Offset applied to every UVW coordinate") + ]], + uniform float3 scaling = float3(1.) + [[ + anno::description("Scale applied to every UVW coordinate") + ]] +) +[[ + anno::description("Construct transformation matrix from Euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = float4x4( + scaling.x , 0. , 0. , 0., + 0. , scaling.y , 0. , 0., + 0. , 0. , scaling.z , 0., + translation.x, translation.y, translation.z, 1. + ); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + float4x4 rotate = float4x4( + c.y*c.z, -c.x*s.z + s.x*s.y*c.z, s.x*s.z + c.x*s.y*c.z, 0.0, + c.y*s.z, c.x*c.z + s.x*s.y*s.z, -s.x*c.z + c.x*s.y*s.z, 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0. , 0. , 0. , 1. + ); + + return scale*rotate; +} + + +export material OmniGlass_Opacity +( + color absorption_coeff = color(0.f, 0.f, 0.f) // hiding this parameter as it does not exist in the new material + [[ + anno::hidden(), + anno::unused() + ]], + uniform bool use_glass_color_texture = false + [[ + anno::hidden(), + anno::unused() + ]], + uniform color glass_color = color(1.f, 1.f, 1.f) + [[ + anno::display_name("Glass Color"), + anno::description("Sets the color of the glass"), + anno::hard_range(color(0.0), color(1.0)), + anno::in_group("Color") + ]], + uniform texture_2d glass_color_texture = texture_2d() + [[ + anno::display_name("Glass Color Texture"), + anno::description("Specifies the texture to be used for the glass color of the material"), + anno::in_group("Color") + ]], + float frosting_roughness = 0.f + [[ + anno::display_name("Glass Roughness"), + anno::description("Sets the roughness of the glass material "), + anno::hard_range(0.0, 1.0), + anno::in_group("Roughness") + ]], + uniform float glass_ior = 1.491f + [[ + anno::display_name("Glass IOR"), + anno::description("Sets IOR of the glass material "), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Refraction") + ]], + uniform bool thin_walled = false + [[ + anno::display_name("Thin Walled"), + anno::description("When enabled, the material is considered thin-walled. Use this, when you have glass surfaces that are modeled with a single plane"), + anno::in_group("Refraction") + ]], + uniform float depth = 0.001f + [[ + anno::description("Controls how much light is absorbed through the surface"), + anno::display_name("Volume Absorption Scale"), + anno::in_group("Color"), + anno::soft_range(0.f, 1.f), + anno::hard_range(0.f, 1000.f) + ]], + float roughness_texture_influence = 1.f + [[ + anno::display_name("Roughness Texture Influence"), + anno::in_group("Roughness"), + anno::hard_range(0.0f, 1.0f) + ]], + uniform texture_2d roughness_texture = texture_2d() + [[ + anno::description("The roughness texture"), + anno::display_name("Roughness Texture"), + anno::in_group("Roughness"), + anno::usage("") + ]], + uniform texture_2d reflection_color_texture = texture_2d() + [[ + anno::description("The reflection color texture"), + anno::display_name("Reflection Color Texture"), + anno::in_group("Reflection") + ]], + uniform color reflection_color = color(1.f, 1.f, 1.f) + [[ + anno::display_name("Reflection Color"), + anno::in_group("Reflection") + ]], + uniform texture_2d normal_map_texture = texture_2d() + [[ + anno::description("The normal map texture"), + anno::display_name("Normal Map Texture"), + anno::in_group("Normal"), + anno::usage("") + ]], + uniform float normal_map_strength = 1.0 + [[ + anno::description("Determines the degree of bumpiness"), + anno::display_name("Normal Map Strength"), + anno::in_group("Normal"), + anno::usage(""), + anno::soft_range(0.f, 1.f) + ]], + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.f, 1.f), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + // Cutout Opacity + uniform bool enable_opacity = true + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform float cutout_opacity = 1.0f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity") + ]], + uniform texture_2d cutout_opacity_texture = texture_2d() + [[ + anno::description("The opacity map"), + anno::display_name("Opacity Map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode cutout_opacity_mono_source = base::mono_alpha + [[ + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::display_name("Opacity Mono Source"), + anno::in_group("Opacity"), + anno::usage("") + ]], + uniform float opacity_threshold = 0.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If negative, disable cutout_opacity; if 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + // UV Projection Group + uniform bool project_uvw = false + [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false + [[ + anno::display_name("Enable World Space"), + anno::description("When set to 'true' uses world space for projection, when 'false' object space is used"), + anno::in_group("UV") + ]], + + // UV Space Selector + uniform int uv_space_index = 0 + [[ + anno::display_name("UV Space Index"), + anno::description("Choose the UV Space Index to be used"), + anno::in_group("UV"), + anno::hard_range(0, 3) + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls the position of the texture."), + anno::in_group("UV") + ]], + uniform float texture_rotate = 0.f + [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of the texture in degrees."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger numbers increase the size."), + anno::in_group("UV") + ]] +) +[[ + anno::copyright_notice(COPYRIGHT), + anno::author("NVIDIA CORPORATION"), + anno::display_name("Omni Glass Opacity"), + anno::version( 1, 0, 0), + anno::description("Omni Glass Opacity Material"), + anno::in_group("Base"), + anno::key_words(string[]("omni", "omniverse", "glass", "transparent", "window", "transparency", "workflow")), + distill_off() +]] += let { + // Material Properties + bool local_thin_walled = (tex::texture_isvalid(cutout_opacity_texture) || cutout_opacity != 1.f) ? true : thin_walled; + color local_glass_ior = glass_ior; + + + // UVW Properties + // Generating the texture coordinates for the texture lookups + base::texture_coordinate_system the_system = world_or_object ? + base::texture_coordinate_world : + base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? + base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + + // Opacity Properties + float opacity_value = get_float(cutout_opacity_texture, cutout_opacity, transformed_uvw, cutout_opacity_mono_source); + + // The opacity_threshold is interpreted as follows: + // 1. opacity_threshold > 0: binary opacity masking mode + // i.e.: if opacity_value > opacity_threshold we remap opacity_value to 1.0, otherwise to 0.0 + // 2. opacity_threshold == 0: fractional opacity mode. Leaves the opacity_value untouched, + // allowing the renderer to use fractional cutout_opacity values, if it supports this feature + // + // NOTE: when the renderer does not enable 'fractional cutout opacity' it interprets + // cutout_opacity values of 1.0 as opaque and anything below as fully transparent + float local_cutout_opacity = enable_opacity ? + ((opacity_threshold == 0.0) ? + opacity_value : + ((opacity_value >= opacity_threshold) ? 1.0 : 0) + ) : + 1.0; + + + // Surface Properties + color local_reflection_color = get_color(reflection_color_texture, reflection_color, transformed_uvw); + color local_transmission_color = get_color(glass_color_texture, glass_color, transformed_uvw); + + OmniPBRBase::NormalData defaultData(state::normal(), float2(0.f)); + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normal_map_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + normal_map_texture, + normal_map_strength, + flip_tangent_u, + flip_tangent_v, + transformed_uvw, + float2(0.f, 1.f), + float2(0.f, 1.f), + tex::wrap_repeat, + tex::wrap_repeat, + false, + 1.f, + 0.f, + 0.f, + int2(0), + tex::wrap_repeat, + 30.f + ) : + defaultData; + + float local_roughness = apply_roughness_influence( + roughness_texture, + frosting_roughness, + roughness_texture_influence, + transformed_uvw + ); + float2 local_roughness_squared( + (local_roughness * local_roughness + + geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x), + (local_roughness * local_roughness + + geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y) + ); + + float3 the_normal = normal_data.normal; + + bsdf ggx_1 = ::df::microfacet_ggx_smith_bsdf( + roughness_u: local_roughness_squared.x, + roughness_v: local_roughness_squared.y, + tint: local_reflection_color, + tangent_u: ::state::texture_tangent_u(0), + mode: ::df::scatter_reflect + ); + + bsdf ggx_2 = ::df::microfacet_ggx_smith_bsdf( + roughness_u: local_roughness_squared.x, + roughness_v: local_roughness_squared.y, + tint: local_transmission_color, + tangent_u: ::state::texture_tangent_u(0), + mode: ::df::scatter_transmit + ); + + material_surface local_surface( + ::df::fresnel_layer( + ior: glass_ior, + weight: 1.f, + layer: ggx_1, + base: ggx_2, + normal: the_normal + ), + material_emission() + ); + + + // Volume Properties + color local_volume_absorption = depth; + color local_volume_scattering = color(0.f, 0.f, 0.f); + + material_volume local_volume(vdf(), local_volume_absorption, local_volume_scattering); + + + // Geometry Properties + material_geometry local_geometry(float3(0.f), local_cutout_opacity, the_normal); + +} in material( + thin_walled: local_thin_walled, + surface: local_surface, + ior: local_glass_ior, + volume: local_volume, + geometry: local_geometry +); diff --git a/assets/machine_guard/simready_usd/materials/OmniPBR.mdl b/assets/machine_guard/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/machine_guard/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/machine_guard/simready_usd/materials/OmniPBRBase.mdl b/assets/machine_guard/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/machine_guard/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/machine_guard/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/machine_guard/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/machine_guard/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/machine_guard/simready_usd/textures/T_Plastic_Acrylic_BaseColor.png b/assets/machine_guard/simready_usd/textures/T_Plastic_Acrylic_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..d1e393c1320cb4f28153234cea347d79590f8656 --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Plastic_Acrylic_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba9d7e5d4a8cc8a0d1d84f4cbc8e89c441fdf2cd0de4fda66352b5e31e640f17 +size 64367 diff --git a/assets/machine_guard/simready_usd/textures/T_Plastic_Acrylic_Normal.png b/assets/machine_guard/simready_usd/textures/T_Plastic_Acrylic_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..53762f2b518d8dbe506dcc71dfc75a82d5855d54 --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Plastic_Acrylic_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f7052586a4c3f82eefeb8e7e5b279b34b40ea62bff1c77e59172f9f69a2401b +size 2115697 diff --git a/assets/machine_guard/simready_usd/textures/T_Plastic_Acrylic_OcclusionRoughnessMetallic.png b/assets/machine_guard/simready_usd/textures/T_Plastic_Acrylic_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..2ca77ff45e84440eab271bf3e5f54d147b26975e --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Plastic_Acrylic_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:766d9ba1df992250ae0af5c10b749a24583f6e9a748baa84453856410c46bd8f +size 638654 diff --git a/assets/machine_guard/simready_usd/textures/T_Plastic_PP_BaseColor.png b/assets/machine_guard/simready_usd/textures/T_Plastic_PP_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..a2859ab9d625a8bc4d5adc13e329199c47a1143d --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Plastic_PP_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e366838f15d5c8e2bdadebb185432b81cf959250ad67051bc8fd422d9bac664a +size 167961 diff --git a/assets/machine_guard/simready_usd/textures/T_Plastic_PP_Normal.png b/assets/machine_guard/simready_usd/textures/T_Plastic_PP_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..0d7352e19658ab7836bffc04bf6e2b5f8b11f880 --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Plastic_PP_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:776c1e0feecece7272a9a7f898d821f8f5c12664e714253126992f96284081cc +size 2589413 diff --git a/assets/machine_guard/simready_usd/textures/T_Plastic_PP_OcclusionRoughnessMetallic.png b/assets/machine_guard/simready_usd/textures/T_Plastic_PP_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..0fe6c831883f881783923388c919bd689fd4a70f --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Plastic_PP_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fcc974b167ce8f7eb8ba07b87637e3e9da4c4e6de93bff54c11e2a18c8fb790 +size 564680 diff --git a/assets/machine_guard/simready_usd/textures/T_Steel_Black_BaseColor.png b/assets/machine_guard/simready_usd/textures/T_Steel_Black_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..56c84ca56d77970edc3a44fcc4311a5d34034034 --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Steel_Black_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b2ba86ab64b660d173468d74a11591b9a479a2cec818d610eb9c235c2507772 +size 215338 diff --git a/assets/machine_guard/simready_usd/textures/T_Steel_Black_Normal.png b/assets/machine_guard/simready_usd/textures/T_Steel_Black_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..6b5aff21f15146f26ecd64e3a97e41ca1958e5e0 --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Steel_Black_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62dc97add5d3dcf133a3697a636892e475dadc012ac11767ac2cb54dc7adccd5 +size 2519053 diff --git a/assets/machine_guard/simready_usd/textures/T_Steel_Black_OcclusionRoughnessMetallic.png b/assets/machine_guard/simready_usd/textures/T_Steel_Black_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..97a295484137ab68d24cbcdf0f39c591740bbebd --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Steel_Black_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4979ef114a660b21384b41602d59d06e012101e54e71a4fdb6fbca8a2eaefe07 +size 362811 diff --git a/assets/machine_guard/simready_usd/textures/T_Steel_Carbon_BaseColor.png b/assets/machine_guard/simready_usd/textures/T_Steel_Carbon_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..6b5278b8ae809a956b041ce353af44cf119eaea4 --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Steel_Carbon_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2c68f0ef6a5ec578bf2dc5411a0318352df1fcdf128d2c18f3d16498513f899 +size 793797 diff --git a/assets/machine_guard/simready_usd/textures/T_Steel_Carbon_Normal.png b/assets/machine_guard/simready_usd/textures/T_Steel_Carbon_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..a35f7ec998ea70eb6e6800673b6896291606398a --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Steel_Carbon_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef9e431b05cf2692d161e1fa52bb908b08a2ad647a8ee417511f449d33cfbc7b +size 2565084 diff --git a/assets/machine_guard/simready_usd/textures/T_Steel_Carbon_OcclusionRoughnessMetallic.png b/assets/machine_guard/simready_usd/textures/T_Steel_Carbon_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..9354b40a923f1e65165ca1e2702ac62399b8ad1b --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Steel_Carbon_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8e174257ceed5d02bc04144fda54c1752ad7cf3321645af56caac42fae27b60 +size 915084 diff --git a/assets/machine_guard/simready_usd/textures/T_Steel_Yellow_BaseColor.png b/assets/machine_guard/simready_usd/textures/T_Steel_Yellow_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..49e1a133821b7f1fdf216bc92f47435242ad00bd --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Steel_Yellow_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0cfc1a83c238412d2a47c2fb7515943b4d4eb419137fe0b3f8ab74e107dbdfee +size 463185 diff --git a/assets/machine_guard/simready_usd/textures/T_Steel_Yellow_Normal.png b/assets/machine_guard/simready_usd/textures/T_Steel_Yellow_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..4e01a06cce3034fe7df317edfe50de6f180dad9b --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Steel_Yellow_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20dceabc1e0bc05276a03ee91c22637599e85d648d4da04b27ac707639d5eb61 +size 2311090 diff --git a/assets/machine_guard/simready_usd/textures/T_Steel_Yellow_OcclusionRoughnessMetallic.png b/assets/machine_guard/simready_usd/textures/T_Steel_Yellow_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..d18bb7c745cf325302e25143b17e50bd32bb7740 --- /dev/null +++ b/assets/machine_guard/simready_usd/textures/T_Steel_Yellow_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0327abe4f7948fb5021c6dfc5450ad365f61e1c1cf05ebad9ec797f7ee7ca4e8 +size 609246 diff --git a/assets/monkey_wrench/simready_usd/.simready/validation.json b/assets/monkey_wrench/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..32c7579026033d33f74ebd891439ace860219898 --- /dev/null +++ b/assets/monkey_wrench/simready_usd/.simready/validation.json @@ -0,0 +1,174 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/monkey_wrench/simready_usd/.thumbs/256x256/monkey_wrench.usd.png b/assets/monkey_wrench/simready_usd/.thumbs/256x256/monkey_wrench.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..aeecdb78b6e923be2600b177d3e4fff348e19c5b --- /dev/null +++ b/assets/monkey_wrench/simready_usd/.thumbs/256x256/monkey_wrench.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcb177266c7a3c4eb0a7b564ddb5eada36405a417e006ded45cebcceb31dd7f5 +size 55705 diff --git a/assets/monkey_wrench/simready_usd/.thumbs/256x256/monkey_wrench.usd_light.png b/assets/monkey_wrench/simready_usd/.thumbs/256x256/monkey_wrench.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..124af48730359f6b5a5faf66750538e70b2f52e6 --- /dev/null +++ b/assets/monkey_wrench/simready_usd/.thumbs/256x256/monkey_wrench.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1888dfb495edbb68023db371a05d786d1cf7bb423226e0f56f16ecad239a26d6 +size 32086 diff --git a/assets/monkey_wrench/simready_usd/.thumbs/256x256/monkey_wrench.usd_transparent.png b/assets/monkey_wrench/simready_usd/.thumbs/256x256/monkey_wrench.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..6aba112f6879034d6315b7a51806ab553b71e5d2 --- /dev/null +++ b/assets/monkey_wrench/simready_usd/.thumbs/256x256/monkey_wrench.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79fdf0d7354069848a624f3aa0c9c3ec1bbe40ef5f79712ecbb3cffb9423fd73 +size 28330 diff --git a/assets/monkey_wrench/simready_usd/materials/OmniPBR.mdl b/assets/monkey_wrench/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/monkey_wrench/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/monkey_wrench/simready_usd/materials/OmniPBRBase.mdl b/assets/monkey_wrench/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/monkey_wrench/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/monkey_wrench/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/monkey_wrench/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/monkey_wrench/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/monkey_wrench/simready_usd/monkey_wrench.usd b/assets/monkey_wrench/simready_usd/monkey_wrench.usd new file mode 100644 index 0000000000000000000000000000000000000000..b9e7f7710dc6671908236f39cfe2b2fc39c424e0 --- /dev/null +++ b/assets/monkey_wrench/simready_usd/monkey_wrench.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4215ea2c7d2dc804b871f05247664ec361c2331b5b579ec7b436dd1af1e429a +size 1449160 diff --git a/assets/monkey_wrench/simready_usd/post_validation.json b/assets/monkey_wrench/simready_usd/post_validation.json new file mode 100644 index 0000000000000000000000000000000000000000..4105fc6386a2607dba6b68663dd754a48a6aeb98 --- /dev/null +++ b/assets/monkey_wrench/simready_usd/post_validation.json @@ -0,0 +1,18 @@ +{ + "C:/srtest/art/pkg_repo/.packages/monkey_wrench/1.0.0/Monkey_Wrench.usd": { + "features_summary": { + "FET030_PACKAGING_CORE": { + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET032_PACKAGING_INTROSPECTION": { + "dependencies": "[{'FET030_PACKAGING_CORE': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.1.0" + } + }, + "profile_id": "Package", + "profile_version": "1.0.0" + } +} \ No newline at end of file diff --git a/assets/monkey_wrench/simready_usd/textures/T_Steel_Carbon_BaseColor.png b/assets/monkey_wrench/simready_usd/textures/T_Steel_Carbon_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..ddd2362555b3621c22ca0ccb80db4b7f02141c27 --- /dev/null +++ b/assets/monkey_wrench/simready_usd/textures/T_Steel_Carbon_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f243bdc895294a7730433458e2b25349fa62058c857b449aab24e1a43e8f437 +size 1624229 diff --git a/assets/monkey_wrench/simready_usd/textures/T_Steel_Carbon_Normal.png b/assets/monkey_wrench/simready_usd/textures/T_Steel_Carbon_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..067aa7de7f07af5192b759c99d7479c716cc2fdc --- /dev/null +++ b/assets/monkey_wrench/simready_usd/textures/T_Steel_Carbon_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f01b86070ad76cd4ba139d6ae6549c917141c48f75d13aae4fe368cdef2b65f7 +size 4554267 diff --git a/assets/monkey_wrench/simready_usd/textures/T_Steel_Carbon_OcclusionRoughnessMetallic.png b/assets/monkey_wrench/simready_usd/textures/T_Steel_Carbon_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..89e07835ce6206a8b48cf232a5554055177e5b96 --- /dev/null +++ b/assets/monkey_wrench/simready_usd/textures/T_Steel_Carbon_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd17ae0c74380f1ffe6fc3225cc982e2deb1f09d54a012611cedca4dc69a246d +size 1794526 diff --git a/assets/office_chair/simready_usd/.simready/validation.json b/assets/office_chair/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..32c7579026033d33f74ebd891439ace860219898 --- /dev/null +++ b/assets/office_chair/simready_usd/.simready/validation.json @@ -0,0 +1,174 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/office_chair/simready_usd/.thumbs/256x256/office_chair.usd.png b/assets/office_chair/simready_usd/.thumbs/256x256/office_chair.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..1e988b21e27973f02ec8181f9c32c794db6f41e4 --- /dev/null +++ b/assets/office_chair/simready_usd/.thumbs/256x256/office_chair.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a590914afeb48bd351640bfbe68008bce10e8bda1e1e0fddda27b485dcd8617 +size 59802 diff --git a/assets/office_chair/simready_usd/.thumbs/256x256/office_chair.usd_light.png b/assets/office_chair/simready_usd/.thumbs/256x256/office_chair.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..d1ee19be7391ddf822dd1c6d4401267bc90ff3a6 --- /dev/null +++ b/assets/office_chair/simready_usd/.thumbs/256x256/office_chair.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5929a2b4187540167f9cf6177dcc49c0456cc50f2e225fa80a12f0e0a1c8c1cd +size 44641 diff --git a/assets/office_chair/simready_usd/.thumbs/256x256/office_chair.usd_transparent.png b/assets/office_chair/simready_usd/.thumbs/256x256/office_chair.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..9b65f2b2283e63e6b88a761dd12b06e53ea0a54c --- /dev/null +++ b/assets/office_chair/simready_usd/.thumbs/256x256/office_chair.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:569255715cad8c8104f72e50adfe7a83c3253b6bd59d1eaae87367560cd222a6 +size 39304 diff --git a/assets/office_chair/simready_usd/materials/OmniPBR.mdl b/assets/office_chair/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/office_chair/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/office_chair/simready_usd/materials/OmniPBRBase.mdl b/assets/office_chair/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/office_chair/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/office_chair/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/office_chair/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/office_chair/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/office_chair/simready_usd/office_chair.usd b/assets/office_chair/simready_usd/office_chair.usd new file mode 100644 index 0000000000000000000000000000000000000000..dee2847766c95256e82a109b0fdef17229796e14 --- /dev/null +++ b/assets/office_chair/simready_usd/office_chair.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:969ae199ed76cedf34f76a107ce61a137f25ba1cbbc95d766045d8d2eaf9e13a +size 22408051 diff --git a/assets/office_chair/simready_usd/textures/M_fabric_mesh_BaseColor.1003.png b/assets/office_chair/simready_usd/textures/M_fabric_mesh_BaseColor.1003.png new file mode 100644 index 0000000000000000000000000000000000000000..fc2bca6bba71dbbbb375cf9bd72869a643c57f73 --- /dev/null +++ b/assets/office_chair/simready_usd/textures/M_fabric_mesh_BaseColor.1003.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22b3e6dc198aa1dfedd37a6fd57d0da3aa023a75d5bc665369b8efe1c8aa9ea9 +size 3721300 diff --git a/assets/office_chair/simready_usd/textures/M_fabric_mesh_Normal.1003.png b/assets/office_chair/simready_usd/textures/M_fabric_mesh_Normal.1003.png new file mode 100644 index 0000000000000000000000000000000000000000..261824692a525c72d25d318305bbf35f6c0ad735 --- /dev/null +++ b/assets/office_chair/simready_usd/textures/M_fabric_mesh_Normal.1003.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43aef536e8ba8f2054e97730511aab59bc1379dabad85fe512f7c9c63bc092c2 +size 4863651 diff --git a/assets/office_chair/simready_usd/textures/M_fabric_mesh_OcclusionRoughnessMetallic.1003.png b/assets/office_chair/simready_usd/textures/M_fabric_mesh_OcclusionRoughnessMetallic.1003.png new file mode 100644 index 0000000000000000000000000000000000000000..72e9ec717701f06ac9c22382edb105e4ceaf2833 --- /dev/null +++ b/assets/office_chair/simready_usd/textures/M_fabric_mesh_OcclusionRoughnessMetallic.1003.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6c827ccbe82cf9fdff9b16c0164e9e2c35d328c4e58daafb99d2125a53feee8 +size 1463114 diff --git a/assets/office_chair/simready_usd/textures/M_plastic_dark_BaseColor.1002.png b/assets/office_chair/simready_usd/textures/M_plastic_dark_BaseColor.1002.png new file mode 100644 index 0000000000000000000000000000000000000000..ad07823df695e54741d49ba92de328848041d757 --- /dev/null +++ b/assets/office_chair/simready_usd/textures/M_plastic_dark_BaseColor.1002.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:955970f22602179145b268591ccfe3b0cc370c060342a7fe18dbacb3c806affc +size 980035 diff --git a/assets/office_chair/simready_usd/textures/M_plastic_dark_Normal.1002.png b/assets/office_chair/simready_usd/textures/M_plastic_dark_Normal.1002.png new file mode 100644 index 0000000000000000000000000000000000000000..a9d8c2f1647ef876d5b341342510d8a120d04c34 --- /dev/null +++ b/assets/office_chair/simready_usd/textures/M_plastic_dark_Normal.1002.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2d6a7745c7cb2447285be647aa69507fe5857de02352f6a1cafee7c1c3b28a0 +size 3199128 diff --git a/assets/office_chair/simready_usd/textures/M_plastic_dark_OcclusionRoughnessMetallic.1002.png b/assets/office_chair/simready_usd/textures/M_plastic_dark_OcclusionRoughnessMetallic.1002.png new file mode 100644 index 0000000000000000000000000000000000000000..f7b7089110bb6bfaaf4d0017fd1353e17664ba3b --- /dev/null +++ b/assets/office_chair/simready_usd/textures/M_plastic_dark_OcclusionRoughnessMetallic.1002.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b3fc63e26c4401957608bfcdd9747399bf923826e149aa8d5e72080c5a2a99f +size 875285 diff --git a/assets/office_chair/simready_usd/textures/M_plastic_light_BaseColor.1001.png b/assets/office_chair/simready_usd/textures/M_plastic_light_BaseColor.1001.png new file mode 100644 index 0000000000000000000000000000000000000000..06ea7d7bcf66966bda22ad82596d24d004229506 --- /dev/null +++ b/assets/office_chair/simready_usd/textures/M_plastic_light_BaseColor.1001.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f044be5627e4c1dd408240f18817ede6d16db52ad6c90071fe0f7000f8cf1812 +size 2631896 diff --git a/assets/office_chair/simready_usd/textures/M_plastic_light_Normal.1001.png b/assets/office_chair/simready_usd/textures/M_plastic_light_Normal.1001.png new file mode 100644 index 0000000000000000000000000000000000000000..196de09b4c3c124937600f157af65a2b198bf8fe --- /dev/null +++ b/assets/office_chair/simready_usd/textures/M_plastic_light_Normal.1001.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1e82afcc3da9b9a74ed6b7b1084ba700f181298ccbd21865388bf99f8e2ded9 +size 2599143 diff --git a/assets/office_chair/simready_usd/textures/M_plastic_light_OcclusionRoughnessMetallic.1001.png b/assets/office_chair/simready_usd/textures/M_plastic_light_OcclusionRoughnessMetallic.1001.png new file mode 100644 index 0000000000000000000000000000000000000000..cd95f52c6c1649bb56e36733c5e34b031e42339a --- /dev/null +++ b/assets/office_chair/simready_usd/textures/M_plastic_light_OcclusionRoughnessMetallic.1001.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fec61e5a268c762614b1b8f915227a1e80eacf5bf249d7c6e213b9be3bd03f20 +size 1624054 diff --git a/assets/oil_drain_cart/simready_usd/.simready/validation.json b/assets/oil_drain_cart/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..32c7579026033d33f74ebd891439ace860219898 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/.simready/validation.json @@ -0,0 +1,174 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/oil_drain_cart/simready_usd/.thumbs/256x256/oil_drain_cart.usd.png b/assets/oil_drain_cart/simready_usd/.thumbs/256x256/oil_drain_cart.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..8116843e02307edd43f6bda724b10478ea78f396 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/.thumbs/256x256/oil_drain_cart.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:116f5068ae021b962519df84412efd3309795eeff32d36529703951d91a9c1b2 +size 58291 diff --git a/assets/oil_drain_cart/simready_usd/.thumbs/256x256/oil_drain_cart.usd_light.png b/assets/oil_drain_cart/simready_usd/.thumbs/256x256/oil_drain_cart.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..c3cd4ed4fb8668d4efeed172b487c761aac3305f --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/.thumbs/256x256/oil_drain_cart.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b7a11af1afbfbd19bf3c47c2ed086c998fe8761e5a21f3b72ed3e176ffe0aaa +size 46719 diff --git a/assets/oil_drain_cart/simready_usd/.thumbs/256x256/oil_drain_cart.usd_transparent.png b/assets/oil_drain_cart/simready_usd/.thumbs/256x256/oil_drain_cart.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..9b04bce7d373143d2765cc21d4ef426e15aa8697 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/.thumbs/256x256/oil_drain_cart.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63fd04bf26be23d624a7fcfc3e1030eadf2fd002dd51e4981a34b8584988c26c +size 38094 diff --git a/assets/oil_drain_cart/simready_usd/materials/OmniPBR.mdl b/assets/oil_drain_cart/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/oil_drain_cart/simready_usd/materials/OmniPBRBase.mdl b/assets/oil_drain_cart/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/oil_drain_cart/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/oil_drain_cart/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/oil_drain_cart/simready_usd/oil_drain_cart.usd b/assets/oil_drain_cart/simready_usd/oil_drain_cart.usd new file mode 100644 index 0000000000000000000000000000000000000000..5418c202417449369d42b1d97c28ad907c96e68f --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/oil_drain_cart.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7b886dcd45d0d92308cbad2cccb0814c27cd44fcff1969117a5d1402b708ac8 +size 49614843 diff --git a/assets/oil_drain_cart/simready_usd/post_validation.json b/assets/oil_drain_cart/simready_usd/post_validation.json new file mode 100644 index 0000000000000000000000000000000000000000..99bd895f634f54adb6a61ce3c7819e88abdc23ae --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/post_validation.json @@ -0,0 +1,18 @@ +{ + "C:/srtest/art/pkg_repo/.packages/oil_drain_cart/1.0.0/Oil_Drain_Cart.usd": { + "features_summary": { + "FET030_PACKAGING_CORE": { + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET032_PACKAGING_INTROSPECTION": { + "dependencies": "[{'FET030_PACKAGING_CORE': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.1.0" + } + }, + "profile_id": "Package", + "profile_version": "1.0.0" + } +} \ No newline at end of file diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Plastic_PP_BaseColor.png b/assets/oil_drain_cart/simready_usd/textures/T_Plastic_PP_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..79c95e6e17d75a8b6a1089e639626c71bc6c9346 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Plastic_PP_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:173e15a29f8effac723b1f280717408cf9c4106ac235604c49cacaf6fc99b703 +size 248125 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Plastic_PP_Normal.png b/assets/oil_drain_cart/simready_usd/textures/T_Plastic_PP_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..1afd3e66d82a74b454f53f42b0239e88faedd236 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Plastic_PP_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fb84948f9b14fb8c08b56d4f2094254d7e899e9f6007269c8e3d5f7b8ed6560 +size 2760303 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Plastic_PP_OcclusionRoughnessMetallic.png b/assets/oil_drain_cart/simready_usd/textures/T_Plastic_PP_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..7415f1f5065bc330034c22303608287ee14a5741 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Plastic_PP_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44bd6fdebe152a416fb40ec6f62af25e75017393e7dcaf19b58e59466ff46415 +size 1141939 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Black_BaseColor.png b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Black_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..00a2faa45d78c7fdf7b9f414e9a49f47152e9a4c --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Black_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97f71a20fda162ce7072c6e04befc9392e99dd58bfd7a33bec3c0455593de136 +size 50375 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Black_Normal.png b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Black_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..5707dcd16be843380a320d9fefa495fceaf6c0ae --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Black_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f6b78efec148875b9c9fd27e05876f9a4a37a7d509d56ba2c57fa0b092a0c2d +size 2599318 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Black_OcclusionRoughnessMetallic.png b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Black_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..e7bd2bb2559785b6e4674b24eb6de45277714b79 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Black_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5145d19e154e8f46664c5f30b9b0878e5abe2da74a3d0fd3ecb65bdf9e08dc66 +size 775198 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Red_BaseColor.png b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Red_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..59119530714bb20930e0a5979ea5d254e4f04e7d --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Red_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8fa5e7be94c0dc5520decf6e589aa6b676107573a976e1833f70e09db8da2f18 +size 257173 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Red_Normal.png b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Red_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..65094e6b31fad015a56e1a4bf16cb28cb3334e15 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Red_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e6225accbf32aceec10431a02e56ac859922fd4ae77543e01c2028ca7ad7959 +size 2873248 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Red_OcclusionRoughnessMetallic.png b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Red_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..5e8c0832e87c2cfc7621570c973467e71757a641 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Rubber_Red_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:855cbcdccc93abc6a4776631d5f7352d175c3f9dc44b9d3970999834309361a2 +size 582819 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Steel_Black_BaseColor.png b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Black_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..599b8eb2ba0b803850a5bb925917e4c85d6edacb --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Black_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b79dfec02ad44c906254398cdde51dde15123a9b28a4543d768d094b3e7e6158 +size 2605607 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Steel_Black_Normal.png b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Black_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..801e9cd01941f73664bcbc386fd5cfcafb2b5141 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Black_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbd2c70e1e64f74362b4e59c3782ad586e05f4b10a58e8ef07736c5b23f27d47 +size 2272612 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Steel_Black_OcclusionRoughnessMetallic.png b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Black_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..cf77043ab0c02cde3c7aa5dd271c466f6ba1462f --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Black_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2faa5ae28051c37ecd8ab8b3f01717c0e3c33093954f6d0f0159dbebbbed1c37 +size 2534288 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Steel_Carbon_BaseColor.png b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Carbon_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..d9c7ebbbaa16cbbed09ad19516ee8a1a68f2ffe4 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Carbon_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:749512e2cd0a80b8f79a450422a887b4e2b3863bcd9ed5230c6381bb3694a072 +size 443278 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Steel_Carbon_Normal.png b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Carbon_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..0fbfd6e9dcbded1d7a38d400212cb56577b25e37 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Carbon_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3baf08568dc3314d9d32c92b28c7b67f71a7fd4a14271b02a880ed02941a202d +size 3335990 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Steel_Carbon_OcclusionRoughnessMetallic.png b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Carbon_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..465538e66df4fdf2461ee5df6b3ad1f40edaab46 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Carbon_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c2e1157cdfcf66e7b2415e31044a00b058766e24f74690ad519500815c3d8d9 +size 1890046 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Steel_Red_BaseColor.png b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Red_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..29cf0c8cd5521325eca8aff668feab97126e0d7d --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Red_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bd884aef7e542b23c380a2fc95741c6f19580c6d2a67a55e6073fc6ebb7e2c0 +size 656024 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Steel_Red_Normal.png b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Red_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..3127b723b334e8b6791b8b66cb5a12cf1a2573ee --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Red_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6527ff449bf546da50ebb50af23c8055b9d346ac140d4113ee491fe3981a0227 +size 2482165 diff --git a/assets/oil_drain_cart/simready_usd/textures/T_Steel_Red_OcclusionRoughnessMetallic.png b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Red_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..d7016417597550f485ad081e0744d66b54976031 --- /dev/null +++ b/assets/oil_drain_cart/simready_usd/textures/T_Steel_Red_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1684713e60901c124f5dac97dded8e484362f6279aa8d724ecae5ee755a1da6f +size 704716 diff --git a/assets/paint_bucket/simready_usd/.simready/validation.json b/assets/paint_bucket/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..32c7579026033d33f74ebd891439ace860219898 --- /dev/null +++ b/assets/paint_bucket/simready_usd/.simready/validation.json @@ -0,0 +1,174 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/paint_bucket/simready_usd/.thumbs/256x256/paint_bucket.usd.png b/assets/paint_bucket/simready_usd/.thumbs/256x256/paint_bucket.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..5d0dfdabde2c70c17e816553f1ffc65bed4e1a82 --- /dev/null +++ b/assets/paint_bucket/simready_usd/.thumbs/256x256/paint_bucket.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f19c30d8cefe362aa4f0d4947c35b485ba2ae0e245b8afb540d6e7e9218d7cdc +size 78582 diff --git a/assets/paint_bucket/simready_usd/.thumbs/256x256/paint_bucket.usd_light.png b/assets/paint_bucket/simready_usd/.thumbs/256x256/paint_bucket.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..351ae1714a3fc094b850e970fc65732a9cccbb1e --- /dev/null +++ b/assets/paint_bucket/simready_usd/.thumbs/256x256/paint_bucket.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a411f703774969dc45b799bc270ac57047078d6abb89e47f24c570fffc419aec +size 59035 diff --git a/assets/paint_bucket/simready_usd/.thumbs/256x256/paint_bucket.usd_transparent.png b/assets/paint_bucket/simready_usd/.thumbs/256x256/paint_bucket.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..0d52b1b83ca3ffbde5cbfd047ad34de224728cc5 --- /dev/null +++ b/assets/paint_bucket/simready_usd/.thumbs/256x256/paint_bucket.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9370061b36172917a3a7280483ae0b3a82d0cd621785c09b8f0e15c853578f34 +size 57089 diff --git a/assets/paint_bucket/simready_usd/materials/OmniPBR.mdl b/assets/paint_bucket/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/paint_bucket/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/paint_bucket/simready_usd/materials/OmniPBRBase.mdl b/assets/paint_bucket/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/paint_bucket/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/paint_bucket/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/paint_bucket/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/paint_bucket/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/paint_bucket/simready_usd/paint_bucket.usd b/assets/paint_bucket/simready_usd/paint_bucket.usd new file mode 100644 index 0000000000000000000000000000000000000000..6b44b6a31b2b13e0481f192df0762b5c637f1f89 --- /dev/null +++ b/assets/paint_bucket/simready_usd/paint_bucket.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdca524196f61196af44b6dc27b8f525d1c67e1070b8dc088368f23a408fa79a +size 64823305 diff --git a/assets/paint_bucket/simready_usd/textures/M_paint_bucket_clean_BaseColor.png b/assets/paint_bucket/simready_usd/textures/M_paint_bucket_clean_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..1066018166bbded196bbd2e91307673fd8e39d4e --- /dev/null +++ b/assets/paint_bucket/simready_usd/textures/M_paint_bucket_clean_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74b5d5420ad6864df5cd6e14a022d6d1272870c6b5571747e1c2b739326222f1 +size 1600595 diff --git a/assets/paint_bucket/simready_usd/textures/M_paint_bucket_clean_Normal.png b/assets/paint_bucket/simready_usd/textures/M_paint_bucket_clean_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..4d03c093cc14d67830ef0e6c5a529e1c339ff427 --- /dev/null +++ b/assets/paint_bucket/simready_usd/textures/M_paint_bucket_clean_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:971bfa89a34177d4bc7dfa549249d85c1559df25d3c022e3d5fd3eaeae2db72f +size 145329 diff --git a/assets/paint_bucket/simready_usd/textures/M_paint_bucket_clean_OcclusionRoughnessMetallic.png b/assets/paint_bucket/simready_usd/textures/M_paint_bucket_clean_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..f916b01c59763495f840b76e27a0a6887a6a1cf8 --- /dev/null +++ b/assets/paint_bucket/simready_usd/textures/M_paint_bucket_clean_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:116b413653f31bd5025f5054fafe4719928943255ef8f3e8654fe76ac24d4485 +size 1744403 diff --git a/assets/pallet/simready_usd/.simready/validation.json b/assets/pallet/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..14b4b14ef1fb917401af651446e114e40959084d --- /dev/null +++ b/assets/pallet/simready_usd/.simready/validation.json @@ -0,0 +1,176 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/pallet/simready_usd/.thumbs/256x256/pallet.usd.png b/assets/pallet/simready_usd/.thumbs/256x256/pallet.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..e5432a144b2c7a1493c6a1e415f651de8433f5cf --- /dev/null +++ b/assets/pallet/simready_usd/.thumbs/256x256/pallet.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ad01d16582b5cede7339f9af3144f9065a2cecfd464538b0ca2d995446f4952 +size 77053 diff --git a/assets/pallet/simready_usd/.thumbs/256x256/pallet.usd_light.png b/assets/pallet/simready_usd/.thumbs/256x256/pallet.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..e6a30cb253204fb1779ed2ccaca8da02bf610e30 --- /dev/null +++ b/assets/pallet/simready_usd/.thumbs/256x256/pallet.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4db1747fdc010f9617adaad195ed26cc5f3f97de2da0e483ea1c83a78a79a2fc +size 65253 diff --git a/assets/pallet/simready_usd/.thumbs/256x256/pallet.usd_transparent.png b/assets/pallet/simready_usd/.thumbs/256x256/pallet.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..595fbc03c0fdaa322e8955abad2a51718f554ec3 --- /dev/null +++ b/assets/pallet/simready_usd/.thumbs/256x256/pallet.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f81a50c05f2c07aebdc33cb03502d2051fabc9e874d4bce987d4d0f1dc5c42b9 +size 64166 diff --git a/assets/pallet/simready_usd/materials/OmniPBR.mdl b/assets/pallet/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/pallet/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/pallet/simready_usd/materials/OmniPBRBase.mdl b/assets/pallet/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/pallet/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/pallet/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/pallet/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/pallet/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/pallet/simready_usd/pallet.usd b/assets/pallet/simready_usd/pallet.usd new file mode 100644 index 0000000000000000000000000000000000000000..f71a690f941a4dc2e0690b4830215659553be008 --- /dev/null +++ b/assets/pallet/simready_usd/pallet.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48a15abdbdb1714f63d9be733d8b6d4cce38d6ae2a0484731c2b438094d8d892 +size 5870454 diff --git a/assets/pallet/simready_usd/textures/M_pallet_black_BaseColor.png b/assets/pallet/simready_usd/textures/M_pallet_black_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..ae04dcbbf273c8189f2ebc55c8ed8112cf365dd7 --- /dev/null +++ b/assets/pallet/simready_usd/textures/M_pallet_black_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:74cf8fa08a85a7f8d0a34655712fcc94ef594f2e382f699a435e45cb4c9745d3 +size 3554838 diff --git a/assets/pallet/simready_usd/textures/M_pallet_black_Normal.png b/assets/pallet/simready_usd/textures/M_pallet_black_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..72a74a95f7f0c0a3bc82f4ad42f345535582fbf9 --- /dev/null +++ b/assets/pallet/simready_usd/textures/M_pallet_black_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebf13662de9c84c96e9589313ed6a503f2faf823ec6e6d4b0908eff1b5e90655 +size 3196662 diff --git a/assets/pallet/simready_usd/textures/M_pallet_black_OcclusionRoughnessMetallic.png b/assets/pallet/simready_usd/textures/M_pallet_black_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..2fabac1447aab99474715c9759b7278e587fcb0e --- /dev/null +++ b/assets/pallet/simready_usd/textures/M_pallet_black_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb0245f854656349a9138a6e733c181300801fd732c44bbbd210b1ee2b0a67af +size 3990612 diff --git a/assets/pallet_stand/simready_usd/.simready/validation.json b/assets/pallet_stand/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..14b4b14ef1fb917401af651446e114e40959084d --- /dev/null +++ b/assets/pallet_stand/simready_usd/.simready/validation.json @@ -0,0 +1,176 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/pallet_stand/simready_usd/.thumbs/256x256/pallet_stand.usd.png b/assets/pallet_stand/simready_usd/.thumbs/256x256/pallet_stand.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..ae8e1d7af827497702b640ca9e58ffd8edebe500 --- /dev/null +++ b/assets/pallet_stand/simready_usd/.thumbs/256x256/pallet_stand.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35a0d04ccbc4b076712d5a64753ece5566247795b478f3c80838226d44566416 +size 65820 diff --git a/assets/pallet_stand/simready_usd/.thumbs/256x256/pallet_stand.usd_light.png b/assets/pallet_stand/simready_usd/.thumbs/256x256/pallet_stand.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..4bf22f060326a2165f73fbb9ccde7a94d21526aa --- /dev/null +++ b/assets/pallet_stand/simready_usd/.thumbs/256x256/pallet_stand.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3849aec8e32e3d361e298f6bf6a053f20ecf7b3b2998892bc12c42ed737f05fd +size 47365 diff --git a/assets/pallet_stand/simready_usd/.thumbs/256x256/pallet_stand.usd_transparent.png b/assets/pallet_stand/simready_usd/.thumbs/256x256/pallet_stand.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..e820f9c59f60e42b7e9ca4ecfb4d365b7248f9a5 --- /dev/null +++ b/assets/pallet_stand/simready_usd/.thumbs/256x256/pallet_stand.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5132ca9ac69a37ace661441c86c54fb9939959fe2403714a989d74e7e0a35a1 +size 42417 diff --git a/assets/pallet_stand/simready_usd/materials/OmniPBR.mdl b/assets/pallet_stand/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/pallet_stand/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/pallet_stand/simready_usd/materials/OmniPBRBase.mdl b/assets/pallet_stand/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/pallet_stand/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/pallet_stand/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/pallet_stand/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/pallet_stand/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/pallet_stand/simready_usd/pallet_stand.usd b/assets/pallet_stand/simready_usd/pallet_stand.usd new file mode 100644 index 0000000000000000000000000000000000000000..4ed10cf19443c1380429348ee7fa1315e745a97e --- /dev/null +++ b/assets/pallet_stand/simready_usd/pallet_stand.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1be5e99eaaddc583c78a987c284fe66f4e9182a366c3e9ac771e51f2283133a +size 244324 diff --git a/assets/pallet_stand/simready_usd/textures/M_pallet_stand_BaseColor.png b/assets/pallet_stand/simready_usd/textures/M_pallet_stand_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..231a2804abcf34fe102bfa148bc29df78264b836 --- /dev/null +++ b/assets/pallet_stand/simready_usd/textures/M_pallet_stand_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c165ac4fc5e793340848d56edb3eb9d79a7133eb8313e112ff0535a9c80882b +size 1889546 diff --git a/assets/pallet_stand/simready_usd/textures/M_pallet_stand_Normal.png b/assets/pallet_stand/simready_usd/textures/M_pallet_stand_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..967066ba09a842306f0e0ccdf9d008afd5013b7a --- /dev/null +++ b/assets/pallet_stand/simready_usd/textures/M_pallet_stand_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f471eefbade904845553feb4edad4155e36e74587b0629a398341d87dd37e80 +size 3108836 diff --git a/assets/pallet_stand/simready_usd/textures/M_pallet_stand_OcclusionRoughnessMetallic.png b/assets/pallet_stand/simready_usd/textures/M_pallet_stand_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..47db9b774c74c1eb6abf3fc7720f34e718b38bf2 --- /dev/null +++ b/assets/pallet_stand/simready_usd/textures/M_pallet_stand_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e7755e92e438a0c684c3538116206b70b64bb503d8c832b968ebab73bb20efc +size 2118943 diff --git a/assets/pegboard/simready_usd/.simready/validation.json b/assets/pegboard/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..14b4b14ef1fb917401af651446e114e40959084d --- /dev/null +++ b/assets/pegboard/simready_usd/.simready/validation.json @@ -0,0 +1,176 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001', 'com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "optional requirements": "['com.nvidia.simready.RB.MB.001']", + "passed": false, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/pegboard/simready_usd/.thumbs/256x256/pegboard.usd.png b/assets/pegboard/simready_usd/.thumbs/256x256/pegboard.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..27bbea86050a53a011422bcbdf2660c71fc76828 --- /dev/null +++ b/assets/pegboard/simready_usd/.thumbs/256x256/pegboard.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29ccd3748d52afe626fd84b3e9090cf364f056597d2dbcf51c41b82ddc42c95a +size 61547 diff --git a/assets/pegboard/simready_usd/.thumbs/256x256/pegboard.usd_light.png b/assets/pegboard/simready_usd/.thumbs/256x256/pegboard.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..054ab11ed48b64add1b424e0247e264c742c323f --- /dev/null +++ b/assets/pegboard/simready_usd/.thumbs/256x256/pegboard.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2cf21a9781402b19a971a495b02c04296cd1aa5e2e5911eabf65e284192f238 +size 52570 diff --git a/assets/pegboard/simready_usd/.thumbs/256x256/pegboard.usd_transparent.png b/assets/pegboard/simready_usd/.thumbs/256x256/pegboard.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..b05c070a2132763d91bb2869f3caf47dca6b271c --- /dev/null +++ b/assets/pegboard/simready_usd/.thumbs/256x256/pegboard.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c919c35292d4d06331544837ed9d2571b54eb43fbdeaf1d8e1cdb9bba7869a69 +size 54937 diff --git a/assets/pegboard/simready_usd/materials/OmniPBR.mdl b/assets/pegboard/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/pegboard/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/pegboard/simready_usd/materials/OmniPBRBase.mdl b/assets/pegboard/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/pegboard/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/pegboard/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/pegboard/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/pegboard/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/pegboard/simready_usd/pegboard.usd b/assets/pegboard/simready_usd/pegboard.usd new file mode 100644 index 0000000000000000000000000000000000000000..08708ff1ba3170aee9f9dfbbc1260a4a6cad420a --- /dev/null +++ b/assets/pegboard/simready_usd/pegboard.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af0e1e19fc1677f180ef195f02b465362d7a71a73b28db945dc498cb24ebf90b +size 647019 diff --git a/assets/pegboard/simready_usd/textures/T_Plastic_PP_BaseColor.png b/assets/pegboard/simready_usd/textures/T_Plastic_PP_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..8e5cd33ffd2531f06a2bad35852f60a51de02dfe --- /dev/null +++ b/assets/pegboard/simready_usd/textures/T_Plastic_PP_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b22dd0c24ab951642656e3b6ae630ab5c8937bf5cd965cb09d4d0c9c0875324d +size 381928 diff --git a/assets/pegboard/simready_usd/textures/T_Plastic_PP_Normal.png b/assets/pegboard/simready_usd/textures/T_Plastic_PP_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..88f7f52138705981c9e72de195d3961f03e77fff --- /dev/null +++ b/assets/pegboard/simready_usd/textures/T_Plastic_PP_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39d82a5f529c69809252794db99c5989a98e59e041d0de221cc89c6dd4b0d4a7 +size 2573362 diff --git a/assets/pegboard/simready_usd/textures/T_Plastic_PP_OcclusionRoughnessMetallic.png b/assets/pegboard/simready_usd/textures/T_Plastic_PP_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..210a29221f9c2361582f789ed83f9bea4af7120c --- /dev/null +++ b/assets/pegboard/simready_usd/textures/T_Plastic_PP_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a572208c30049f9edc897e7b3c7782306f99c12266daf4613895f5602f7826a4 +size 1751153 diff --git a/assets/platform_dolly/simready_usd/.simready/validation.json b/assets/platform_dolly/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..32c7579026033d33f74ebd891439ace860219898 --- /dev/null +++ b/assets/platform_dolly/simready_usd/.simready/validation.json @@ -0,0 +1,174 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/platform_dolly/simready_usd/.thumbs/256x256/platform_dolly.usd.png b/assets/platform_dolly/simready_usd/.thumbs/256x256/platform_dolly.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..2ad81b5e6b3c5cbbd44f1aed81cb3dd4c1a7cb78 --- /dev/null +++ b/assets/platform_dolly/simready_usd/.thumbs/256x256/platform_dolly.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3721aafb9af9a026ae21aa113c3cc2545d18e357fc5dd4b9c54e06a330cc769 +size 62560 diff --git a/assets/platform_dolly/simready_usd/.thumbs/256x256/platform_dolly.usd_light.png b/assets/platform_dolly/simready_usd/.thumbs/256x256/platform_dolly.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..8dd14ce5a66e7cf7a6e6ba7fc7ca936b03832cfd --- /dev/null +++ b/assets/platform_dolly/simready_usd/.thumbs/256x256/platform_dolly.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:506eb7eaf792e0e07b5318ee805c18834a8b325c0999e75ef4a8acce371f9e40 +size 51206 diff --git a/assets/platform_dolly/simready_usd/.thumbs/256x256/platform_dolly.usd_transparent.png b/assets/platform_dolly/simready_usd/.thumbs/256x256/platform_dolly.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..a6779a54a388ccf97646234acfeadb267eb023b0 --- /dev/null +++ b/assets/platform_dolly/simready_usd/.thumbs/256x256/platform_dolly.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67bec85daf78777d685e7ea5843892fe645aa18b84dc0e33eed1e85fcf11e4a0 +size 44718 diff --git a/assets/platform_dolly/simready_usd/materials/OmniPBR.mdl b/assets/platform_dolly/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/platform_dolly/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/platform_dolly/simready_usd/materials/OmniPBRBase.mdl b/assets/platform_dolly/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/platform_dolly/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/platform_dolly/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/platform_dolly/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/platform_dolly/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/platform_dolly/simready_usd/platform_dolly.usd b/assets/platform_dolly/simready_usd/platform_dolly.usd new file mode 100644 index 0000000000000000000000000000000000000000..8df5fc2e991a3cc59124589a1160e88808a7674d --- /dev/null +++ b/assets/platform_dolly/simready_usd/platform_dolly.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7477cd64cceb7d409cb3254f755f1fe2c39bd5ea8dee2b3c1851b62ba7ff58b6 +size 3101231 diff --git a/assets/platform_dolly/simready_usd/post_validation.json b/assets/platform_dolly/simready_usd/post_validation.json new file mode 100644 index 0000000000000000000000000000000000000000..faf34a979076556d85bdbe27c0b28ee8dd3b824e --- /dev/null +++ b/assets/platform_dolly/simready_usd/post_validation.json @@ -0,0 +1,18 @@ +{ + "C:/srtest/art/pkg_repo/.packages/platform_dolly/1.0.0/Platform_Dolly.usd": { + "features_summary": { + "FET030_PACKAGING_CORE": { + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET032_PACKAGING_INTROSPECTION": { + "dependencies": "[{'FET030_PACKAGING_CORE': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.1.0" + } + }, + "profile_id": "Package", + "profile_version": "1.0.0" + } +} \ No newline at end of file diff --git a/assets/platform_dolly/simready_usd/textures/T_Metal_Carbon_BaseColor.png b/assets/platform_dolly/simready_usd/textures/T_Metal_Carbon_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..4e7a7455c853ad8e7cc8773291241995382db37e --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Metal_Carbon_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:779d2631dcc273f58c332f240ce205fe47c38f1c3fd67e07a8cd9d3252e6b25a +size 281101 diff --git a/assets/platform_dolly/simready_usd/textures/T_Metal_Carbon_Normal.png b/assets/platform_dolly/simready_usd/textures/T_Metal_Carbon_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..65201c052a932f48cefdec8010fd01fdde58307f --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Metal_Carbon_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf7f373b75a2e46d6749464a575e14478e2037a9285894b7750b81e17f1fe1c4 +size 1583762 diff --git a/assets/platform_dolly/simready_usd/textures/T_Metal_Carbon_OcclusionRoughnessMetallic.png b/assets/platform_dolly/simready_usd/textures/T_Metal_Carbon_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..b3102a004a876f21c1c2332dadb558cfeda1fe07 --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Metal_Carbon_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e5a1c2cc75ba2de9c4b3dacdf4c504b67fae14efa077b938614b9d10cd9f4fb +size 340679 diff --git a/assets/platform_dolly/simready_usd/textures/T_Metal_Steel_BaseColor.png b/assets/platform_dolly/simready_usd/textures/T_Metal_Steel_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..7f51020207a4dac2e49970c64fb6da53eba8798f --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Metal_Steel_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f0acc091689defceaca683f07b9c5c4774d003d668c287bd62ba731a983c962 +size 484089 diff --git a/assets/platform_dolly/simready_usd/textures/T_Metal_Steel_Normal.png b/assets/platform_dolly/simready_usd/textures/T_Metal_Steel_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..a8dc0cb8d9d51dfb0212f8ccc100e340414fa0a9 --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Metal_Steel_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ab1203ab7705606320bb00c027a162eb838432e2dcd09bcf6f9e4cf7ea19679 +size 2422591 diff --git a/assets/platform_dolly/simready_usd/textures/T_Metal_Steel_OcclusionRoughnessMetallic.png b/assets/platform_dolly/simready_usd/textures/T_Metal_Steel_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..e7737c76a08ccca816ac6a9c57ba1eff32f3e59e --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Metal_Steel_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5afe348df206932f0ac00fd9ed0b14f968ed4e480eed3e3b323d76e2fc797ea +size 820360 diff --git a/assets/platform_dolly/simready_usd/textures/T_Plastic_Pp_BaseColor.png b/assets/platform_dolly/simready_usd/textures/T_Plastic_Pp_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..a764a7cb5dd54c46a52b1bac7bb7e9b6b4942068 --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Plastic_Pp_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc372ffe8d45a8ddbc0f58b2858c610a71c6827e6feb54e77ec2d65d8fb2497d +size 1809057 diff --git a/assets/platform_dolly/simready_usd/textures/T_Plastic_Pp_Normal.png b/assets/platform_dolly/simready_usd/textures/T_Plastic_Pp_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..58ca38bf2ff7f6bf53fdb00d5217d46829896327 --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Plastic_Pp_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:514c40423c0ae105ff29dc8a422ac879cb893415d353da31d04e2a009a37a57f +size 3458027 diff --git a/assets/platform_dolly/simready_usd/textures/T_Plastic_Pp_OcclusionRoughnessMetallic.png b/assets/platform_dolly/simready_usd/textures/T_Plastic_Pp_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..33522f2388deef04821ddfa91276a7d5fbb2337f --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Plastic_Pp_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f9adec59a8f982122248213b9698aafb43c7249898c4cf80bfe96dcec412904 +size 2535136 diff --git a/assets/platform_dolly/simready_usd/textures/T_Rubber_Tpu_BaseColor.png b/assets/platform_dolly/simready_usd/textures/T_Rubber_Tpu_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..456491f381e84e217fbf1b28e03f8a2cb3e1b478 --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Rubber_Tpu_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36be3727695d59825f3a9a8435a3148955e057b5ad262295e8a9cd951b058865 +size 668527 diff --git a/assets/platform_dolly/simready_usd/textures/T_Rubber_Tpu_Normal.png b/assets/platform_dolly/simready_usd/textures/T_Rubber_Tpu_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..801e9cd01941f73664bcbc386fd5cfcafb2b5141 --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Rubber_Tpu_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbd2c70e1e64f74362b4e59c3782ad586e05f4b10a58e8ef07736c5b23f27d47 +size 2272612 diff --git a/assets/platform_dolly/simready_usd/textures/T_Rubber_Tpu_OcclusionRoughnessMetallic.png b/assets/platform_dolly/simready_usd/textures/T_Rubber_Tpu_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..5c15db8432c60385221fe5ec0681c3ebf7199cc2 --- /dev/null +++ b/assets/platform_dolly/simready_usd/textures/T_Rubber_Tpu_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cfc6312aae714d42495c6026a424c66f6b0a574227a937982cb0e7d978e8d248 +size 260435 diff --git a/assets/pliers/simready_usd/.simready/validation.json b/assets/pliers/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..32c7579026033d33f74ebd891439ace860219898 --- /dev/null +++ b/assets/pliers/simready_usd/.simready/validation.json @@ -0,0 +1,174 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/pliers/simready_usd/.thumbs/256x256/pliers.usd.png b/assets/pliers/simready_usd/.thumbs/256x256/pliers.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..187f288429c079a82bbbde05147cefa24628e701 --- /dev/null +++ b/assets/pliers/simready_usd/.thumbs/256x256/pliers.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c26242143a42816aa608dbbe320cc0d937efe834b811c5bf9cb6430f1aabeac +size 51801 diff --git a/assets/pliers/simready_usd/.thumbs/256x256/pliers.usd_light.png b/assets/pliers/simready_usd/.thumbs/256x256/pliers.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..102b938ff9381f13c9d27907736ef8ea187704ae --- /dev/null +++ b/assets/pliers/simready_usd/.thumbs/256x256/pliers.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8db4af5ef113b9374315d2d14eca97e5a8c6c714707a5d1374aafac73f7ea99c +size 35116 diff --git a/assets/pliers/simready_usd/.thumbs/256x256/pliers.usd_transparent.png b/assets/pliers/simready_usd/.thumbs/256x256/pliers.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..76aed705380131c5d210cfe1c97fdd6a9de7597f --- /dev/null +++ b/assets/pliers/simready_usd/.thumbs/256x256/pliers.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fef007f25643ba19035aa08d39300d593910e613548bc21f562e25d6bd6d2642 +size 30424 diff --git a/assets/pliers/simready_usd/materials/OmniPBR.mdl b/assets/pliers/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/pliers/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/pliers/simready_usd/materials/OmniPBRBase.mdl b/assets/pliers/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/pliers/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/pliers/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/pliers/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/pliers/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/pliers/simready_usd/pliers.usd b/assets/pliers/simready_usd/pliers.usd new file mode 100644 index 0000000000000000000000000000000000000000..9f27752da75ec44b2b2f587940ad5df3b971e09b --- /dev/null +++ b/assets/pliers/simready_usd/pliers.usd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d8f7b4f3a834c4943bbe246cc860d0ae6081703ab187b00e0562733024887496 +size 2609367 diff --git a/assets/pliers/simready_usd/post_validation.json b/assets/pliers/simready_usd/post_validation.json new file mode 100644 index 0000000000000000000000000000000000000000..2b4844ef19858fd53390c4ee2e50260f33e83641 --- /dev/null +++ b/assets/pliers/simready_usd/post_validation.json @@ -0,0 +1,18 @@ +{ + "C:/srtest/art/pkg_repo/.packages/pliers/1.0.0/Pliers.usd": { + "features_summary": { + "FET030_PACKAGING_CORE": { + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET032_PACKAGING_INTROSPECTION": { + "dependencies": "[{'FET030_PACKAGING_CORE': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.1.0" + } + }, + "profile_id": "Package", + "profile_version": "1.0.0" + } +} \ No newline at end of file diff --git a/assets/pliers/simready_usd/textures/T_Rubber_Red_BaseColor.png b/assets/pliers/simready_usd/textures/T_Rubber_Red_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..67dba2aa77c148e5994f1fb7130dc69dc4232b9b --- /dev/null +++ b/assets/pliers/simready_usd/textures/T_Rubber_Red_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34e567bae1bd29171d2215c059628554763bedf24228f001c9e98eab528525fe +size 275360 diff --git a/assets/pliers/simready_usd/textures/T_Rubber_Red_Normal.png b/assets/pliers/simready_usd/textures/T_Rubber_Red_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..e5592e1c71fbe0fe95891c14403435004f697b1c --- /dev/null +++ b/assets/pliers/simready_usd/textures/T_Rubber_Red_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79608f5bbbc81194a81602032a1d861da866973d330a6633bdf7d22484b2c04d +size 2668392 diff --git a/assets/pliers/simready_usd/textures/T_Rubber_Red_OcclusionRoughnessMetallic.png b/assets/pliers/simready_usd/textures/T_Rubber_Red_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..8d1d6cd8cd4f7da2e16fa0a226fad49eb9a0e83c --- /dev/null +++ b/assets/pliers/simready_usd/textures/T_Rubber_Red_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4db5f1d0232cfc638b07d59a87b7083e5b93493d5fb1c49f0ac1ab92c53b3a09 +size 1531662 diff --git a/assets/pliers/simready_usd/textures/T_Steel_Alloy_BaseColor.png b/assets/pliers/simready_usd/textures/T_Steel_Alloy_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..73b963c1cf64a92a902949886787e140ad882e69 --- /dev/null +++ b/assets/pliers/simready_usd/textures/T_Steel_Alloy_BaseColor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0da78bc721be8c77a70119edadd40c3c2e00e8e8e80830e37d817fd7f57f799c +size 1006880 diff --git a/assets/pliers/simready_usd/textures/T_Steel_Alloy_Normal.png b/assets/pliers/simready_usd/textures/T_Steel_Alloy_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..3c1ac76c59d0f739546245953125b5c146031dbc --- /dev/null +++ b/assets/pliers/simready_usd/textures/T_Steel_Alloy_Normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c992221d55403202bfbcf5944b7ead6b5779a5879bed3f8a87f890871f0b68f5 +size 3837352 diff --git a/assets/pliers/simready_usd/textures/T_Steel_Alloy_OcclusionRoughnessMetallic.png b/assets/pliers/simready_usd/textures/T_Steel_Alloy_OcclusionRoughnessMetallic.png new file mode 100644 index 0000000000000000000000000000000000000000..a6203fc68f67bf33742876cbc74a26ce44a511b0 --- /dev/null +++ b/assets/pliers/simready_usd/textures/T_Steel_Alloy_OcclusionRoughnessMetallic.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b9bd15977393e564c965ce264d0c58ace994b4ca1058d6dbadca80e6da4427b +size 1549347 diff --git a/assets/power_drill/simready_usd/.simready/validation.json b/assets/power_drill/simready_usd/.simready/validation.json new file mode 100644 index 0000000000000000000000000000000000000000..32c7579026033d33f74ebd891439ace860219898 --- /dev/null +++ b/assets/power_drill/simready_usd/.simready/validation.json @@ -0,0 +1,174 @@ +{ + "SimReady_Metadata": { + "validation": { + "profile": "Robotics-Prop", + "profile_version": "4.0.0", + "validated_features": { + "2026-10-30": { + "FET_000_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.007']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.004']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_000_STANDARD': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.RV.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_000_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_001_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "1.0.1" + }, + "FET_003_MUJOCO": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_NEWTON": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_003_PHYSX": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.4.0" + }, + "FET_003_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_004_MUJOCO": { + "blocking_failure": false, + "dependencies": "[{'FET_003_MUJOCO': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.MUJOCO.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_NEWTON": { + "blocking_failure": false, + "dependencies": "[{'FET_003_NEWTON': {'version': '0.1.0'}}]", + "optional requirements": "['com.nvidia.simready.NEWTON.COL.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_004_PHYSX": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_004_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_003_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.2.0" + }, + "FET_005_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.GSP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_MDL": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_006_OPENPBR": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.VM.PBR.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_006_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_007_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.NVM.001', 'com.nvidia.simready.NVM.002', 'com.nvidia.simready.NVM.003']", + "passed": false, + "version": "0.2.0" + }, + "FET_010_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "optional requirements": "['com.nvidia.simready.DISP.001']", + "passed": false, + "version": "0.1.0" + }, + "FET_011_RTX": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_011_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.2.0" + }, + "FET_031_STANDARD": { + "blocking_failure": false, + "dependencies": "[]", + "passed": true, + "version": "0.1.0" + }, + "FET_033_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_031_STANDARD': {'version': '0.1.0'}}]", + "passed": true, + "version": "0.4.0" + }, + "FET_046_STANDARD": { + "blocking_failure": false, + "dependencies": "[{'FET_011_STANDARD': {'version': '0.2.0'}}]", + "passed": true, + "version": "0.1.0" + }, + "FET_100_ISAAC": { + "blocking_failure": false, + "dependencies": "[{'FET_003_PHYSX': {'version': '0.4.0'}}]", + "optional requirements": "['com.nvidia.simready.ISA.001']", + "passed": false, + "version": "0.4.0" + } + } + } + } + } +} diff --git a/assets/power_drill/simready_usd/.thumbs/256x256/power_drill.usd.png b/assets/power_drill/simready_usd/.thumbs/256x256/power_drill.usd.png new file mode 100644 index 0000000000000000000000000000000000000000..7c9914ea4378b1786ee4add92dcb8462192c7239 --- /dev/null +++ b/assets/power_drill/simready_usd/.thumbs/256x256/power_drill.usd.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc5a56093c86ef5ea99c8227f87ce4f8df9d59752c553affda646ede6bf4e7eb +size 55225 diff --git a/assets/power_drill/simready_usd/.thumbs/256x256/power_drill.usd_light.png b/assets/power_drill/simready_usd/.thumbs/256x256/power_drill.usd_light.png new file mode 100644 index 0000000000000000000000000000000000000000..9e5609e8b05a49ad3b44128c6f732ab3aa0fce75 --- /dev/null +++ b/assets/power_drill/simready_usd/.thumbs/256x256/power_drill.usd_light.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12b8f613a956d330fb0f597e09ccd956e7d29356cbeb54d8c1a87f44587a267c +size 41832 diff --git a/assets/power_drill/simready_usd/.thumbs/256x256/power_drill.usd_transparent.png b/assets/power_drill/simready_usd/.thumbs/256x256/power_drill.usd_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..4520e6b10c1b08b8d641bd5aacc6624b21eb4467 --- /dev/null +++ b/assets/power_drill/simready_usd/.thumbs/256x256/power_drill.usd_transparent.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0109e9550103acdd47cce894ffbfa52ece37b58c741e47c8391a8549395499e4 +size 38811 diff --git a/assets/power_drill/simready_usd/materials/OmniPBR.mdl b/assets/power_drill/simready_usd/materials/OmniPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2937decbf0c38e1175d499a0ad2ca3a311c470a4 --- /dev/null +++ b/assets/power_drill/simready_usd/materials/OmniPBR.mdl @@ -0,0 +1,396 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBR_ClearCoat::*; + + +// OmniPBR // + +export material OmniPBR( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity") + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls the repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 2), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] = let { + +material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat( + diffuse_color_constant: diffuse_color_constant, + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_tint: diffuse_tint, + reflection_roughness_constant: reflection_roughness_constant, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + reflectionroughness_texture: reflectionroughness_texture, + metallic_constant: metallic_constant, + metallic_texture_influence: metallic_texture_influence, + metallic_texture: metallic_texture, + specular_level: specular_level, + enable_ORM_texture: enable_ORM_texture, + ORM_texture: ORM_texture, + ao_to_diffuse: ao_to_diffuse, + ao_texture: ao_texture, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + enable_opacity_texture: enable_opacity_texture, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + geometry_normal_roughness_strength: geometry_normal_roughness_strength, + bump_factor: bump_factor, + normalmap_texture: normalmap_texture, + detail_bump_factor: detail_bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v, + project_uvw: project_uvw, + world_or_object: world_or_object, + uv_space_index: uv_space_index, + texture_translate: texture_translate, + texture_rotate: texture_rotate, + texture_scale: texture_scale, + detail_texture_translate: detail_texture_translate, + detail_texture_rotate: detail_texture_rotate, + detail_texture_scale: detail_texture_scale, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials +); + +} in material( +surface: base.surface, +geometry: base.geometry +); diff --git a/assets/power_drill/simready_usd/materials/OmniPBRBase.mdl b/assets/power_drill/simready_usd/materials/OmniPBRBase.mdl new file mode 100644 index 0000000000000000000000000000000000000000..417cec0a705f3ed09ceded3f85f5b919acf8dd20 --- /dev/null +++ b/assets/power_drill/simready_usd/materials/OmniPBRBase.mdl @@ -0,0 +1,470 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; +import ::anno::*; + +export float3 HemiOctahedronToUnitVector( float2 Oct ) [[ + anno::hidden() +]] +{ + Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5; + float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) ); + return math::normalize(N); +} + +export struct NormalData [[ + anno::hidden() +]] +{ + float3 normal; + float2 roughness; +}; + +export NormalData tangent_space_normal_roughness_texture( + uniform texture_2d texture + [[ + anno::description("The input texture"), + anno::usage("normal") + ]], + uniform float factor = 1.0f + [[ anno::description("Determines the degree of bumpiness") ]], + uniform bool flip_tangent_u = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + uniform bool flip_tangent_v = false + [[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]], + uniform float2 crop_u = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]], + uniform float2 crop_v = float2( 0.0, 1.0) + [[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]], + uniform tex::wrap_mode wrap_u = tex::wrap_repeat + [[ anno::description("Wrapping mode in the u direction") ]], + uniform tex::wrap_mode wrap_v = tex::wrap_repeat + [[ anno::description("Wrapping mode in the v direction") ]], + uniform bool clip = false + [[ + anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"), + anno::hidden() + ]], + uniform float scale = 1. + [[ + anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float offset = 0. + [[ + anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"), + anno::unused() + ]], + uniform float animation_start_time = 0. + [[ anno::description("When to start playing first frame of the animation ") ]], + uniform int2 animation_crop = int2(0, 0) + [[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]], + uniform tex::wrap_mode animation_wrap = tex::wrap_repeat + [[ anno::description("Defines what to do outside of regular animation time") ]], + uniform float animation_fps = 30 + [[ anno::description("Framerate to use for animation playback") ]] +) +[[ + anno::description("Interprets the color values of a bitmap as a vector in tangent space"), + anno::hidden(), + anno::noinline() +]] +{ + NormalData normalData; + normalData.roughness = float2(0); + normalData.normal = state::normal(); + + float frame = 0.0; + if(animation_crop != int2(0,0)) //only if we have an animation + { + frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation + switch ( animation_wrap) { + case tex::wrap_repeat: + frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x: + math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y; + break; + case tex::wrap_mirrored_repeat: + float animation_crop_2y = 2.0*animation_crop.y; + frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x: + math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x; + if(frame>animation_crop.y) + frame = animation_crop_2y-frame; + break; + case tex::wrap_clamp: + frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y); + break; + case tex::wrap_clip: + frame += animation_crop.x; + if(frame < animation_crop.x || frame > animation_crop.y) return normalData; + break; + } + } + + if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource + factor == 0.0f) + return normalData; + { + if (clip) { + if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) { + return normalData; + } + if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) { + return normalData; + } + } + bool pixel_flip_u = flip_tangent_u; + bool pixel_flip_v = flip_tangent_v; + //if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile + if (wrap_u == tex::wrap_mirrored_repeat) { + if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1) + pixel_flip_u = ! pixel_flip_u; + else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0) + pixel_flip_u = ! pixel_flip_u; + } + if (wrap_v == tex::wrap_mirrored_repeat) { + if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1) + pixel_flip_v = ! pixel_flip_v; + else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0) + pixel_flip_v = ! pixel_flip_v; + } + + float3 transformed_tangent_u = uvw.tangent_u; + float3 transformed_tangent_v = uvw.tangent_v; + + if (pixel_flip_u) + transformed_tangent_u=-transformed_tangent_u; + if (pixel_flip_v) + transformed_tangent_v=-transformed_tangent_v; + + float3 tangent_space_normal; + float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame); + if(normal_raw.x > 1.5) + { + // octahedron packed by OV + normal_raw.x -= 2.0; + normal_raw.x -= 0.5; + normal_raw.y -= 0.5; + tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0); + normalData.roughness = float2(normal_raw.z, normal_raw.w); + } + else + { + // regular + tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0; + normalData.roughness = float2(0); + } + + normalData.normal = math::normalize( + transformed_tangent_u * tangent_space_normal.x * factor + + transformed_tangent_v * tangent_space_normal.y * factor + + state::normal() * tangent_space_normal.z); + + return normalData; +} + + +export material OmniPBRBase( + + + // Albdeo // + + color diffuse_reflection_color = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Albedo Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflecitivity // + + float specular_reflection_roughness = float(0.0) [[ + anno::display_name("Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hidden() + ]], + float metalness = float(0.0) [[ + anno::display_name("Metalness"), + anno::description("Bias towards pure specular reflection"), + anno::in_group("Reflectivity"), + anno::hard_range(0.0, 1.0) + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(0.0, 1.0) + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emission_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + float emission_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::soft_range(0.0, 1000.0), + anno::enable_if("enable_emission == true") + ]], + + + // Geometry Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + float geometry_opacity = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + uniform float geometry_opacity_threshold = 0.f + [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(0.0, 1.0) + ]], + + + // Clearcoat // + + uniform bool enable_coat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a coat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float coat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for coat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + color coat_color = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float coat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float coat_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(0.0, 1.0) + ]], + float2 coat_aniso_roughness = float2(0.0, 0.0) [[ + anno::display_name("Clearcoat aniso roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hidden() + ]], + float coat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the coat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(0.0, 4.0) + ]], + float3 clearcoat_geometry_normal = state::normal() [[ + anno::display_name("Clearcoat Normal"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]], + float3 geometry_normal = state::normal() [[ + anno::display_name("Geometry Normal"), + anno::in_group("Geometry"), + anno::usage("normal") + ]] + +) +[[ + anno::display_name("OmniPBR Base"), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Omni Materials"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = let{ + + // Diffuse Bsdf // + + color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint; + + color base_color = tinted_diffuse_color; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: base_color, + roughness: float(0.0) + ), + base: bsdf(), + normal: geometry_normal + ); + + // Glossy Reflection Bsdf // + + float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1); + float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness + + specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1); + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.08, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular_level, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: geometry_normal + ); + + bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf); + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metalness, + layer: directional_factor_bsdf, + base: custom_curve_layer_bsdf, + normal: geometry_normal + ); + + // Clear Coat // + + float coat_roughness_u = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1); + float coat_roughness_v = math::clamp(coat_roughness * coat_roughness + + coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1); + bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: coat_roughness_u, + roughness_v: coat_roughness_v, + tint: color(1.0), + mode: df::scatter_reflect + ); + + bsdf opaque_coat = df::weighted_layer( + weight: coat_transparency, + layer: ::df::tint( + tint: coat_color, + base: omni_PBR_bsdf + ), + base: ::df::diffuse_reflection_bsdf( + tint: coat_color + ) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: coat_ior, + weight: coat_weight, + layer: coat_bsdf, + base: opaque_coat, + normal: clearcoat_geometry_normal + ); + + bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0); + + float opacity_value = geometry_opacity; + float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0; + + material_emission emission = material_emission( + df::diffuse_edf(), + intensity: emission_value + ); + + material_surface surface = material_surface( + scattering: final_bsdf, + emission: emission + ); + + material_geometry geometry = material_geometry( + normal: state::rounded_corner_normal( + radius: round_edges_radius, + across_materials: round_edges_across_materials, + roundness: round_edges_roundness + ), + cutout_opacity: cutout_opacity + ); + +} in material( + surface: surface, + geometry: geometry +); diff --git a/assets/power_drill/simready_usd/materials/OmniPBR_ClearCoat.mdl b/assets/power_drill/simready_usd/materials/OmniPBR_ClearCoat.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1a3128e6bae5402a39d620cda0f6fa7f3a766ec1 --- /dev/null +++ b/assets/power_drill/simready_usd/materials/OmniPBR_ClearCoat.mdl @@ -0,0 +1,711 @@ +/* + * SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + +mdl 1.7; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::state::*; +import ::tex::*; +import ::anno::*; + +import ::debug::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +import OmniPBRBase::*; + +// Functions // + + +// Returns a matrix from R,T,S. inputs // + +uniform float4x4 rotation_translation_scale( + uniform float3 rotation = float3(0.) + [[ anno::description("Rotation applied to every UVW coordinate") ]], + uniform float3 translation = float3(0.) + [[ anno::description("Offset applied to every UVW coordinate") ]], + uniform float3 scaling = float3(1.) + [[ anno::description("Scale applied to every UVW coordinate") ]] +) +[[ + anno::description("Construct a transformation matrix from euler rotation, translation and scale"), + anno::hidden() +]] +{ + float4x4 scale = + float4x4(scaling.x , 0.0 , 0.0 , 0.0, + 0.0 , scaling.y , 0.0 , 0.0, + 0.0 , 0.0 , scaling.z , 0.0, + translation.x , translation.y , translation.z , 1.0); + + float3 s = math::sin(rotation); + float3 c = math::cos(rotation); + + float4x4 rotate = + float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, + c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, + -s.y , s.x*c.y , c.x*c.y , 0.0, + 0.0 , 0.0 , 0 , 1.0); + + return scale * rotate; +} + +// Returns the normal n in tangent space, given n is in internal space. // + +float3 transform_internal_to_tangent(float3 n) +{ + /* flip_tangent_v */ + return + n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+ + n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+ + n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z); +} + +// Returns the normal n in internal space, given n is in tangent space. +float3 transform_tangent_to_internal(float3 n) +{ + return state::texture_tangent_u(0) * n.x - + state::texture_tangent_v(0) * n.y + /* flip_tangent_v */ + state::normal() * n.z; +} + +// Returns a normal by adding a detail normal to a global normal. +export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal()) +{ + // http://blog.selfshadow.com/publications/blending-in-detail/ + float3 n_t = transform_internal_to_tangent(n); + float3 nd_t = transform_internal_to_tangent(nd); + n_t = n_t + float3(0.,0.,1.); + nd_t = nd_t * float3(-1.,-1.,1.); + n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t; + return math::normalize(transform_tangent_to_internal(n)); +} + +base::texture_return multiply_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 + ) +[[ + anno::hidden() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_multiply + )), + base: color_1 + ); +} + + +// OmniPBR Clearcoat // + +export material OmniPBR_ClearCoat( + + // Albdeo // + + color diffuse_color_constant = color(0.2) [[ + anno::display_name("Albedo Color"), + anno::description("This is the albedo base color"), + anno::in_group("Albedo") + ]], + uniform texture_2d diffuse_texture = texture_2d() [[ + anno::display_name("Albedo Map"), + anno::in_group("Albedo") + ]], + float albedo_desaturation = float(0.0) [[ + anno::display_name("Albedo Map Desaturation"), + anno::description("Desaturates the albedo map"), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + float albedo_add = float(0.0) [[ + anno::display_name("Albedo Add"), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(-1.0), float(1.0)) + ]], + float albedo_brightness = float(1.0) [[ + anno::display_name("Albedo Brightness"), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo"), + anno::soft_range(float(0.0), float(1.0)) + ]], + color diffuse_tint = color(1.0) [[ + anno::display_name("Color Tint"), + anno::description("When enabled, this color value is multiplied over the final albedo color"), + anno::in_group("Albedo") + ]], + + + // Reflectivity // + + float reflection_roughness_constant = float(0.5) [[ + anno::display_name("Roughness Amount"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float reflection_roughness_texture_influence = float(0.0) [[ + anno::display_name("Roughness Map Influence"), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + float metallic_constant = float(0.0) [[ + anno::display_name("Metallic Amount"), + anno::description("Metallic Material"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float metallic_texture_influence = float(0.0) [[ + anno::display_name("Metallic Map Influence"), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d metallic_texture = texture_2d() [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity"), + anno::usage("metalness") + ]], + float specular_level = float(0.5) [[ + anno::display_name("Specular"), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity"), + anno::soft_range(float(0.0), float(1.0)) + ]], + + + // ORM // + + uniform bool enable_ORM_texture = false [[ + anno::display_name("Enable ORM Texture"), + anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() [[ + anno::display_name("ORM Map"), + anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"), + anno::in_group("Reflectivity"), + anno::usage("roughness") + ]], + + + // AO Group // + + float ao_to_diffuse = 0.0 [[ + anno::display_name("AO to diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform texture_2d ao_texture = texture_2d() [[ + anno::display_name("Ambient Occlusion Map"), + anno::description("The ambient occlusion texture for the material"), + anno::in_group("AO"), + anno::usage("occlusion") + ]], + + + // Emission // + + uniform bool enable_emission = false [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + color emissive_color = color(1.0,0.1,0.1) [[ + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_color_texture = texture_2d() [[ + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture"), + anno::enable_if("enable_emission == true") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() [[ + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true"), + anno::usage("occlusion") + ]], + float emissive_intensity = float(40.0) [[ + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive"), + anno::enable_if("enable_emission == true") + ]], + + + // Cutout Opacity // + + uniform bool enable_opacity = false [[ + anno::display_name("Enable Opacity"), + anno::description("Enables the use of cutout opacity"), + anno::in_group("Opacity") + ]], + uniform texture_2d opacity_texture = texture_2d() [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity"), + anno::usage("opacity") + ]], + float opacity_constant = float(1.0) [[ + anno::display_name("Opacity Amount"), + anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + uniform bool enable_opacity_texture = false [[ + anno::display_name("Enable Opacity Texture"), + anno::description("Enables or disables the usage of the opacity texture map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average [[ + anno::display_name("Opacity Mono Source"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"), + anno::in_group("Opacity") + ]], + uniform float opacity_threshold = float(0.0) [[ + anno::display_name("Opacity Threshold"), + anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"), + anno::in_group("Opacity"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Clearcoat // + + uniform bool enable_clearcoat = false [[ + anno::display_name("Enable Clearcoat Layer"), + anno::description("Adds a clearcoat layer on top of the material when enabled"), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = float(1.0) [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + color clearcoat_tint = color(1.0) [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = float(1.0) [[ + anno::display_name("Clearcoat Transparency"), + anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_reflection_roughness = float(0.0) [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + float clearcoat_ior = float(1.56) [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(4.0)) + ]], + uniform float clearcoat_bump_factor = float(1.0) [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[ + anno::display_name("Clearcoat Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Clearcoat"), + anno::usage("normal") + ]], + uniform float2 clearcoat_texture_translate = float2(0.0) [[ + anno::display_name("Clearcoat Texture Translate"), + anno::description("Controls the position of the clearcoat texture"), + anno::ui_order(1), + anno::in_group("UV") + ]], + uniform float clearcoat_texture_rotate = float(0.0) [[ + anno::display_name("Clearcoat Texture Rotate"), + anno::description("Rotates angle of the clearcoat texture in degrees"), + anno::ui_order(2), + anno::in_group("UV") + ]], + uniform float2 clearcoat_texture_scale = float2(1.0) [[ + anno::display_name("Clearcoat Texture Tiling"), + anno::description("Controls the repetition of the clearcoat texture"), + anno::ui_order(3), + anno::in_group("UV") + ]], + float clearcoat_flatten = float(1.0) [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::in_group("Clearcoat"), + anno::hard_range(float(0.0), float(1.0)) + ]], + + + // Normal // + + uniform float geometry_normal_roughness_strength = 1.f + [[ + anno::hard_range(0.0, 1.0), + anno::display_name("Normal map to roughness weight"), + anno::description("Enables and weights roughness induced by normal maps"), + anno::in_group("Normal") + ]], + uniform float bump_factor = float(1.0) [[ + anno::display_name("Normal Strength"), + anno::description("Strength of normal map"), + anno::in_group("Normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d normalmap_texture = texture_2d() [[ + anno::display_name("Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform float detail_bump_factor = float(0.3) [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::description("Strength of the detail normal"), + anno::soft_range(float(0.0), float(1.0)) + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal"), + anno::usage("normal") + ]], + uniform bool flip_tangent_u = false [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::in_group("Normal") + ]], + + + // UVW Projection Group // + + uniform bool project_uvw = false [[ + anno::display_name("Enable Project UVW Coordinates"), + anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"), + anno::in_group("UV") + ]], + uniform bool world_or_object = false [[ + anno::display_name("Enable World Space"), + anno::description("When enabled, uses world space for projection, otherwise object space is used"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform int uv_space_index = 0 [[ + anno::display_name("UV Space Index"), + anno::description("UV Space Index"), + anno::in_group("UV"), + anno::enable_if("project_uvw == true"), + anno::hard_range(int(0), int(3)) + ]], + + + // UVW Adjustments Group // + + uniform float2 texture_translate = float2(0.0) [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float texture_rotate = float(0.0) [[ + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 texture_scale = float2(1.0) [[ + anno::display_name("Texture Tiling"), + anno::description("Controls repetition of the texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_translate = float2(0.0) [[ + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float detail_texture_rotate = float(0.0) [[ + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + uniform float2 detail_texture_scale = float2(1.0) [[ + anno::display_name("Detail Texture Tiling"), + anno::description("Controls repetition of the detail texture."), + anno::in_group("UV"), + anno::enable_if("project_uvw == true") + ]], + + + // Geometry // + + uniform float round_edges_radius = float(0.0) [[ + anno::display_name("Round Edge Radius"), + anno::description("Influence radius around the edges in meters"), + anno::in_group("Geometry"), + anno::soft_range(0.0, 1.0) + ]], + uniform float round_edges_roundness = float(1.0) [[ + anno::display_name("Round Edge Roundness"), + anno::description("Determines how round the edge will look"), + anno::in_group("Geometry"), + anno::hard_range(0.0, 1.0) + ]], + uniform bool round_edges_across_materials = false [[ + anno::display_name("Round Edge Across Materials"), + anno::description("Normal smoothing happens only between facets of equal material, \n" + "\t\tunless this parameter is set true, in which case the smoothing \n" + "\t\thappens between facets irrespective of their materials"), + anno::in_group("Geometry") + ]] +) +[[ + anno::display_name("OmniPBR ClearCoat "), + anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."), + anno::in_group("Base"), + anno::version( 2, 1, 1), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic")) +]] = let { + + // UVW lookup and transformation // + base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object; + + base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection( + coordinate_system: the_system, + texture_space: uv_space_index, + projection_type: base::projection_cubic + ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: uv_space_index + ); + + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ), + translation: float3(texture_translate.x, texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ), + translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0) + ), + coordinate: uvw + ); + + base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate( + transform: rotation_translation_scale( + scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ), + translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f) + ), + coordinate: uvw + ); + + // Normal calculations // + OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0)); + + OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + //flip_tangent_v: true + + ) : defaultData; + float3 the_normal = normal_data.normal; + + OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: detail_normalmap_texture, + factor: detail_bump_factor, + uvw: detail_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 detail_normal = detail_normal_data.normal; + + OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ? + OmniPBRBase::tangent_space_normal_roughness_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: clearcoat_transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v // true for dx, false for opengl + ) : defaultData; + float3 clearcoat_normal = clearcoat_normal_data.normal; + + + float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal; + float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal) + : flattened_clearcoat_normal; + + + // ORM Handling // + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + + float3 roughness_lookup = tex::lookup_float3( + tex: reflectionroughness_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x; + float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)), + math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y))); + + float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)), + math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y))); + + // Diffuse Color Lookup and AO // + + base::texture_return base_lookup = base::file_texture( + texture: diffuse_texture, + color_offset: color(albedo_add), + color_scale: color(albedo_brightness), + mono_source: base::mono_luminance, + uvw: transformed_uvw, + clip: false + ); + + base::texture_return ao_lookup = base::file_texture( + texture: ao_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ); + + + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint; + color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation); + color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant; + color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint; + + color base_color = multiply_colors( + color_1: tinted_diffuse, + color_2: ao_color, + weight: ao_to_diffuse + ).tint; + + + // Metalness // + + float3 metallic_lookup = tex::lookup_float3( + tex: metallic_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x; + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + + // Emission // + + color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ? + base::file_texture( + texture: emissive_color_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : emissive_color; + + color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ? + base::file_texture( + texture: emissive_mask_texture, + color_offset: color(0.0, 0.0, 0.0), + color_scale: color(1.0, 1.0, 1.0), + mono_source: base::mono_average, + uvw: transformed_uvw, + clip: false + ).tint : color(1.0); + + color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0); + + // Opacity // + + float opacity_value = enable_opacity_texture ? base::file_texture( + texture: opacity_texture, + mono_source: opacity_mode, + uvw: transformed_uvw + ).mono : opacity_constant; + + float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0; + + material base = OmniPBRBase::OmniPBRBase( + diffuse_reflection_color: base_color, + specular_reflection_aniso_roughness: reflection_roughness, + specular_level: specular_level, + metalness: metallic, + enable_emission: enable_emission, + emission_color: final_emission_color, + emission_intensity: emissive_intensity, + enable_coat: enable_clearcoat, + coat_weight: clearcoat_weight, + coat_color: clearcoat_tint, + coat_transparency: clearcoat_transparency, + coat_aniso_roughness: clearcoat_reflection_roughness2, + coat_ior: clearcoat_ior, + enable_opacity: enable_opacity, + geometry_opacity: cutout_opacity, + clearcoat_geometry_normal: final_clearcoat_normal, + round_edges_radius: round_edges_radius, + round_edges_roundness: round_edges_roundness, + round_edges_across_materials: round_edges_across_materials, + geometry_normal: diffuse_gloss_normal + ); + +} in material( +surface: base.surface, +geometry: base.geometry +);