diff --git a/assets/objects/dojo/blocks/blue_block.usdc b/assets/objects/dojo/blocks/blue_block.usdc new file mode 100644 index 0000000000000000000000000000000000000000..9a38f3c97a3f825a64807a648b591bd4e7e02886 Binary files /dev/null and b/assets/objects/dojo/blocks/blue_block.usdc differ diff --git a/assets/objects/dojo/blocks/green_block.usdc b/assets/objects/dojo/blocks/green_block.usdc new file mode 100644 index 0000000000000000000000000000000000000000..db2171f8637ffd5edf1a62b6bb61ec9745f0b2bc Binary files /dev/null and b/assets/objects/dojo/blocks/green_block.usdc differ diff --git a/assets/objects/dojo/blocks/red_block.usdc b/assets/objects/dojo/blocks/red_block.usdc new file mode 100644 index 0000000000000000000000000000000000000000..efe4052e33ccd595b6863f17ac6c4e6bca57b5bc Binary files /dev/null and b/assets/objects/dojo/blocks/red_block.usdc differ diff --git a/assets/objects/dojo/blocks/sources.json b/assets/objects/dojo/blocks/sources.json new file mode 100644 index 0000000000000000000000000000000000000000..ae7ce312e780631d7f365d4cca0b1c9c09016c0d --- /dev/null +++ b/assets/objects/dojo/blocks/sources.json @@ -0,0 +1,109 @@ +{ + "source_visuals": { + "texture_6": { + "source_url": "https://huggingface.co/datasets/RoboDojo-Benchmark/RoboDojo/resolve/1127bda94f172d757386945af3eb3a6754d1a4e6/Assets/Object/RoboDojo/Rigid/block/00006/object.usdz", + "source_sha256": "4ef81752cbaaf830dfd0e0d547f2e1f088c41adbee5833c28bf774f159675d00", + "visual_prim": "/World/visual", + "extent_m": [ + 0.035, + 0.035, + 0.035 + ], + "visual_vertices": 2253, + "diffuse_rgb": [ + 1.0, + 1.0, + 1.0 + ], + "albedo_sha256": "5595f8e35632965d3d7b68c0d88e950fa5913e5f3a3d81b169b250d28ed90c23" + }, + "texture_9": { + "source_url": "https://huggingface.co/datasets/RoboDojo-Benchmark/RoboDojo/resolve/1127bda94f172d757386945af3eb3a6754d1a4e6/Assets/Object/RoboDojo/Rigid/block/00009/object.usdz", + "source_sha256": "edce904abea5428dbcc91972d3a26ac9bf6482511d962c9485d9c96ed7d1f46e", + "visual_prim": "/World/visual", + "extent_m": [ + 0.035, + 0.035, + 0.035 + ], + "visual_vertices": 2257, + "diffuse_rgb": [ + 1.0, + 1.0, + 1.0 + ], + "albedo_sha256": "5e251710d634109b46e4b91a7f1d87ce9571f1f161a2e79b120a1d4e11688bb6" + }, + "texture_12": { + "source_url": "https://huggingface.co/datasets/RoboDojo-Benchmark/RoboDojo/resolve/1127bda94f172d757386945af3eb3a6754d1a4e6/Assets/Object/RoboDojo/Rigid/block/00012/object.usdz", + "source_sha256": "de1de2a3912a3a3cba5cc4d07c41205272eb958e50c4882d0fe28ea690730c6e", + "visual_prim": "/World/visual", + "extent_m": [ + 0.035, + 0.035, + 0.035 + ], + "visual_vertices": 2244, + "diffuse_rgb": [ + 1.0, + 1.0, + 1.0 + ], + "albedo_sha256": "a1da35b7de8acca4fa70ae24ad373e830f0f88881f5c48f5ce2ce91f72d414f7" + }, + "blue_block": { + "source_url": "https://huggingface.co/datasets/RoboDojo-Benchmark/RoboDojo/resolve/1127bda94f172d757386945af3eb3a6754d1a4e6/Assets/Object/RoboDojo/Rigid/cube/00001/object.usdz", + "source_sha256": "95a555a472401952403660e99faa3b0791d523b71e28c3e923c6fc6aaf89bba4", + "visual_prim": "/World/visual/model", + "extent_m": [ + 0.035, + 0.035, + 0.035 + ], + "visual_vertices": 36, + "diffuse_rgb": [ + 0.0, + 0.0, + 1.0 + ], + "albedo_sha256": null + }, + "green_block": { + "source_url": "https://huggingface.co/datasets/RoboDojo-Benchmark/RoboDojo/resolve/1127bda94f172d757386945af3eb3a6754d1a4e6/Assets/Object/RoboDojo/Rigid/cube/00002/object.usdz", + "source_sha256": "d2e6b6b0a40d599b30a4dbcf84fa5081a71cbe55ae5b3c90bbe35f03d9c510b1", + "visual_prim": "/World/visual/model", + "extent_m": [ + 0.035, + 0.035, + 0.035 + ], + "visual_vertices": 36, + "diffuse_rgb": [ + 0.0, + 1.0, + 0.0 + ], + "albedo_sha256": null + }, + "red_block": { + "source_url": "https://huggingface.co/datasets/RoboDojo-Benchmark/RoboDojo/resolve/1127bda94f172d757386945af3eb3a6754d1a4e6/Assets/Object/RoboDojo/Rigid/cube/00003/object.usdz", + "source_sha256": "66eb66bdd05680c118dc0c8996a392625c712f244735a487f323038e7ccf4640", + "visual_prim": "/World/visual/model", + "extent_m": [ + 0.035, + 0.035, + 0.035 + ], + "visual_vertices": 36, + "diffuse_rgb": [ + 1.0, + 0.0, + 0.0 + ], + "albedo_sha256": null + } + }, + "host_physics": "RubiksCubeTask cuboid proxy: local mass 0.20 kg, cube material 2.0/2.0/0.1. Source mass, friction and colliders excluded.", + "host_fixture": "rubiks_cube_bowl.usda", + "render_finish": "Official mesh, UV, solid color or exact original base-color JPG; local neutral PBR finish." +} diff --git a/assets/objects/dojo/bowl/sources.json b/assets/objects/dojo/bowl/sources.json new file mode 100644 index 0000000000000000000000000000000000000000..2956b936ad798f2b0b372205e88f3626ca3df0e9 --- /dev/null +++ b/assets/objects/dojo/bowl/sources.json @@ -0,0 +1,16 @@ +{ + "visual_source": { + "path": "Assets/Object/RoboDojo/Rigid/bowl/00009/object.usdz", + "sha256": "b31ce3031f173faf9810e43fa5c7e3e2daae61823914a46a88cc51d33290c21f", + "bytes": 5136768, + "url": "https://huggingface.co/datasets/RoboDojo-Benchmark/RoboDojo/resolve/1127bda94f172d757386945af3eb3a6754d1a4e6/Assets/Object/RoboDojo/Rigid/bowl/00009/object.usdz" + }, + "visual_prim": "/root/visual/model", + "texture": "SubUSDs/textures/shaded.png", + "host_dynamics_reference": "assets/objects/ycb/bowl.usd", + "mass_kg": 0.5, + "static_friction": 2, + "dynamic_friction": 2, + "restitution": 0.1, + "converter": "tools/dojo/build_bowl.py" +} diff --git a/assets/objects/dojo/pickup/book.usdc b/assets/objects/dojo/pickup/book.usdc new file mode 100644 index 0000000000000000000000000000000000000000..4a05b667f0e95dceb3704942dee4724fb76ecac4 Binary files /dev/null and b/assets/objects/dojo/pickup/book.usdc differ diff --git a/assets/objects/dojo/pickup/book_book (3).jpg b/assets/objects/dojo/pickup/book_book (3).jpg new file mode 100644 index 0000000000000000000000000000000000000000..add9adc1a3baab8fb26d772e9bbb4221e3d0ab55 Binary files /dev/null and b/assets/objects/dojo/pickup/book_book (3).jpg differ diff --git a/assets/objects/dojo/pickup/book_texturs a (2).jpg b/assets/objects/dojo/pickup/book_texturs a (2).jpg new file mode 100644 index 0000000000000000000000000000000000000000..908a4aca298e4027eeb55987a2b6d3eb45522607 Binary files /dev/null and b/assets/objects/dojo/pickup/book_texturs a (2).jpg differ diff --git a/assets/objects/dojo/pickup/eraser.usdc b/assets/objects/dojo/pickup/eraser.usdc new file mode 100644 index 0000000000000000000000000000000000000000..6646ca5928b1dabaab84a373b8d444f749ebb089 Binary files /dev/null and b/assets/objects/dojo/pickup/eraser.usdc differ diff --git a/assets/objects/dojo/pickup/eraser_scan.jpg b/assets/objects/dojo/pickup/eraser_scan.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7c9a90e21ecabd94f6c0ce97118b64f2ff56bc96 Binary files /dev/null and b/assets/objects/dojo/pickup/eraser_scan.jpg differ diff --git a/assets/objects/fruits_veggies/materials/SimPBR.mdl b/assets/objects/fruits_veggies/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..ef536b92bbcad83a606a587cd764426db2e59d09 --- /dev/null +++ b/assets/objects/fruits_veggies/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using SimPBR_Model import *; +using baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/fruits_veggies/materials/SimPBR_Model.mdl b/assets/objects/fruits_veggies/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7fa67c2708604f1fff5e5d8ce8a0678d1f8a547a --- /dev/null +++ b/assets/objects/fruits_veggies/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/fruits_veggies/materials/baking_annotations.mdl b/assets/objects/fruits_veggies/materials/baking_annotations.mdl new file mode 100644 index 0000000000000000000000000000000000000000..43a4d72950e5835976de7490d3db98e595e81395 --- /dev/null +++ b/assets/objects/fruits_veggies/materials/baking_annotations.mdl @@ -0,0 +1,38 @@ +mdl 1.4; +import ::anno::*; + +export const string TRANSFORM_NONE = "NONE"; +export const string TRANSFORM_UNORM_VECTOR = "UNORM_VECTOR"; + +export const string FORMAT_RGBA8_UNORM = "RGBA8_UNORM"; +export const string FORMAT_R8_UNORM = "R8_UNORM"; +export const string FORMAT_RGBA16_SFLOAT = "RGBA16_SFLOAT"; + +export const string BLEND_MODE_OPACITY = "opacity_blend"; +export const string BLEND_MODE_REPLACE = "replace"; + +// This annotation is used to mark a material as target material for baking. +// It is that is detected by the MDL SDK and neuray. +export annotation target_material_model(); + +export annotation target_material_rendering( + string rendering_material_override = "" // if set, the baked material will be rendering using this material, + // otherwise the target itself is used +); + +export annotation target_baked_argument( + // the name of the baked texture parameter in the rendering material + string baked_name, + + // the name of the constant parameter in the rendering material in case baking was not necessary + string constant_name = "", + + // texture format to bake to + string format = "", + + // transformations, like encoding normals into [0,1] range + string transform = TRANSFORM_NONE, + + // blending, e.g., based on alpha or replace + string blend_mode = BLEND_MODE_OPACITY +); diff --git a/assets/objects/fruits_veggies/textures/lemon_01/materials/OmniPBR_Opacity.mdl b/assets/objects/fruits_veggies/textures/lemon_01/materials/OmniPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..4f0881ab450759598c19178eaadf677d7b164d0d --- /dev/null +++ b/assets/objects/fruits_veggies/textures/lemon_01/materials/OmniPBR_Opacity.mdl @@ -0,0 +1,426 @@ +/*************************************************************************************************** + * Copyright 2020 NVIDIA Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of NVIDIA CORPORATION nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************************/ +mdl 1.4; + +import ::base::*; +import ::anno::*; + +using OmniPBR_ClearCoat_Opacity import OmniPBR_ClearCoat_Opacity; + + + +export material OmniPBR_Opacity( + + color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Base Color"), + anno::description("This is the 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 Desaturation"), + anno::soft_range(float(0.0f), float(1.0f)), + anno::description("Desaturates the diffuse color"), + anno::in_group("Albedo") + ]], + float albedo_add = float(0.0) + [[ + anno::display_name("Albedo Add"), + anno::soft_range(float(-1.0f), float(1.0f)), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo") + ]], + float albedo_brightness = float(1.0) + [[ + anno::display_name("Albedo Brightness"), + anno::soft_range(float(0.0f), float(1.0f)), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0f) + [[ + 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 = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity") + ]], + float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity") + ]], + + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Reflectivity") + ]], + float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity") + ]], + float specular_level = float(0.5) + [[ + anno::display_name("Specular"), + anno::soft_range(float(0.0f), float(1.0f)), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity") + ]], + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = false + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AO Group ---------------------- + + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(0.0f, 1.0f) + ]], + 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") + ]], + + + // -------------------- EMISSIVE ---------------------- + + + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + + ]], + uniform texture_2d emissive_color_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + + // 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 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 float opacity_constant = 1.f + [[ + 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 opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average + [[ + anno::display_name("Opacity Mono Source"), + anno::in_group("Opacity"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum") + ]], + 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") + ]], + + // -------------------- Normal ---------------------- + + + + /* + uniform bool enable_normalmap_texture = false + [[ + anno::display_name("Enable Normal Texture"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Features") + ]], + */ + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal"), + anno::soft_range(0.0f, 1.0f) + ]], + + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Normal") + ]], + + + +/* uniform bool enable_detail_normalmap_texture = false + [[ + anno::display_name("Enable Detail Normal Texture"), + anno::in_group("Features"), + anno::description("Enables the usage of the detail normalmap texture") + ]], +*/ + uniform float detail_bump_factor = .3f + [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::soft_range(0.0f, 1.0f), + anno::description("Strength of the detail normal") + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() + [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal") + ]], + // 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::enable_if("project_uvw == true"), + 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") + ]], + + uniform int uv_space_index = 0 + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::hard_range(0, 3) + ]], + + // Adjustments Group + uniform float2 texture_translate = float2(0.0f) + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float texture_rotate = 0.f + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + + uniform float2 detail_texture_translate = float2(0.0f) + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV") + ]], + uniform float detail_texture_rotate = 0.f + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV") + ]], + uniform float2 detail_texture_scale = float2(1.0f) + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Detail Texture Scale"), + anno::description("Larger numbers increase the size of the detail texture"), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("OmniPBR Opacity"), + anno::description("OmniPBR supports opacity and ORM textures"), + anno::in_group("Base"), + anno::version( 2, 1, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = OmniPBR_ClearCoat_Opacity( + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_color_constant: diffuse_color_constant, + diffuse_tint: diffuse_tint, + //ao + ao_texture: ao_texture, + ao_to_diffuse: ao_to_diffuse, + //ORM + ORM_texture: ORM_texture, + enable_ORM_texture: enable_ORM_texture, + //reflectivity + reflection_roughness_constant: reflection_roughness_constant, + reflectionroughness_texture: reflectionroughness_texture, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + metallic_constant: metallic_constant, + metallic_texture: metallic_texture, + metallic_texture_influence: metallic_texture_influence, + specular_level: specular_level, + //opacity + enable_opacity: enable_opacity, + enable_opacity_texture: enable_opacity_texture, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + //emissive + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + //clearcoat + enable_clearcoat: false, + clearcoat_tint: color(1.0f), + clearcoat_transparency: 1.0f, + clearcoat_reflection_roughness: 0.0f, + clearcoat_weight: 1.0f, + clearcoat_flatten: 1.0f, + clearcoat_ior: 1.56f, + clearcoat_bump_factor: 1.f, + clearcoat_normalmap_texture: texture_2d(), + //normal + normalmap_texture: normalmap_texture, + bump_factor: bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + detail_bump_factor: detail_bump_factor, + 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, + clearcoat_texture_translate: float2(0.0f), + clearcoat_texture_rotate: 0.0f, + clearcoat_texture_scale: float2(1.0f) + ); \ No newline at end of file diff --git a/assets/objects/fruits_veggies/textures/lemon_02/materials/OmniPBR_Opacity.mdl b/assets/objects/fruits_veggies/textures/lemon_02/materials/OmniPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..4f0881ab450759598c19178eaadf677d7b164d0d --- /dev/null +++ b/assets/objects/fruits_veggies/textures/lemon_02/materials/OmniPBR_Opacity.mdl @@ -0,0 +1,426 @@ +/*************************************************************************************************** + * Copyright 2020 NVIDIA Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of NVIDIA CORPORATION nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************************/ +mdl 1.4; + +import ::base::*; +import ::anno::*; + +using OmniPBR_ClearCoat_Opacity import OmniPBR_ClearCoat_Opacity; + + + +export material OmniPBR_Opacity( + + color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Base Color"), + anno::description("This is the 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 Desaturation"), + anno::soft_range(float(0.0f), float(1.0f)), + anno::description("Desaturates the diffuse color"), + anno::in_group("Albedo") + ]], + float albedo_add = float(0.0) + [[ + anno::display_name("Albedo Add"), + anno::soft_range(float(-1.0f), float(1.0f)), + anno::description("Adds a constant value to the diffuse color "), + anno::in_group("Albedo") + ]], + float albedo_brightness = float(1.0) + [[ + anno::display_name("Albedo Brightness"), + anno::soft_range(float(0.0f), float(1.0f)), + anno::description("Multiplier for the diffuse color "), + anno::in_group("Albedo") + ]], + color diffuse_tint = color(1.0f) + [[ + 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 = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Reflectivity") + ]], + float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Reflectivity") + ]], + + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Reflectivity") + ]], + float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Reflectivity") + ]], + float specular_level = float(0.5) + [[ + anno::display_name("Specular"), + anno::soft_range(float(0.0f), float(1.0f)), + anno::description("The specular level (intensity) of the material"), + anno::in_group("Reflectivity") + ]], + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = false + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AO Group ---------------------- + + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO"), + anno::hard_range(0.0f, 1.0f) + ]], + 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") + ]], + + + // -------------------- EMISSIVE ---------------------- + + + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + + ]], + uniform texture_2d emissive_color_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color map"), + anno::in_group("Emissive"), + anno::description("The emissive color texture") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + + // 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 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 float opacity_constant = 1.f + [[ + 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 opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::in_group("Opacity") + ]], + uniform base::mono_mode opacity_mode = base::mono_average + [[ + anno::display_name("Opacity Mono Source"), + anno::in_group("Opacity"), + anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum") + ]], + 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") + ]], + + // -------------------- Normal ---------------------- + + + + /* + uniform bool enable_normalmap_texture = false + [[ + anno::display_name("Enable Normal Texture"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Features") + ]], + */ + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal"), + anno::soft_range(0.0f, 1.0f) + ]], + + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::description("Enables the usage of the normalmap texture"), + anno::in_group("Normal") + ]], + + + +/* uniform bool enable_detail_normalmap_texture = false + [[ + anno::display_name("Enable Detail Normal Texture"), + anno::in_group("Features"), + anno::description("Enables the usage of the detail normalmap texture") + ]], +*/ + uniform float detail_bump_factor = .3f + [[ + anno::display_name("Detail Normal Strength"), + anno::in_group("Normal"), + anno::soft_range(0.0f, 1.0f), + anno::description("Strength of the detail normal") + ]], + uniform texture_2d detail_normalmap_texture = texture_2d() + [[ + anno::display_name("Detail Normal Map"), + anno::in_group("Normal") + ]], + // 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::enable_if("project_uvw == true"), + 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") + ]], + + uniform int uv_space_index = 0 + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("UV Space Index"), + anno::description("UV Space Index."), + anno::in_group("UV"), + anno::hard_range(0, 3) + ]], + + // Adjustments Group + uniform float2 texture_translate = float2(0.0f) + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float texture_rotate = 0.f + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Texture Rotate"), + anno::description("Rotates angle of texture in degrees."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + + uniform float2 detail_texture_translate = float2(0.0f) + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Detail Texture Translate"), + anno::description("Controls the position of the detail texture."), + anno::in_group("UV") + ]], + uniform float detail_texture_rotate = 0.f + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Detail Texture Rotate"), + anno::description("Rotates angle of the detail texture in degrees."), + anno::in_group("UV") + ]], + uniform float2 detail_texture_scale = float2(1.0f) + [[ + anno::enable_if("project_uvw == true"), + anno::display_name("Detail Texture Scale"), + anno::description("Larger numbers increase the size of the detail texture"), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("OmniPBR Opacity"), + anno::description("OmniPBR supports opacity and ORM textures"), + anno::in_group("Base"), + anno::version( 2, 1, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic")) +]] + = OmniPBR_ClearCoat_Opacity( + diffuse_texture: diffuse_texture, + albedo_desaturation: albedo_desaturation, + albedo_add: albedo_add, + albedo_brightness: albedo_brightness, + diffuse_color_constant: diffuse_color_constant, + diffuse_tint: diffuse_tint, + //ao + ao_texture: ao_texture, + ao_to_diffuse: ao_to_diffuse, + //ORM + ORM_texture: ORM_texture, + enable_ORM_texture: enable_ORM_texture, + //reflectivity + reflection_roughness_constant: reflection_roughness_constant, + reflectionroughness_texture: reflectionroughness_texture, + reflection_roughness_texture_influence: reflection_roughness_texture_influence, + metallic_constant: metallic_constant, + metallic_texture: metallic_texture, + metallic_texture_influence: metallic_texture_influence, + specular_level: specular_level, + //opacity + enable_opacity: enable_opacity, + enable_opacity_texture: enable_opacity_texture, + opacity_texture: opacity_texture, + opacity_constant: opacity_constant, + opacity_mode: opacity_mode, + opacity_threshold: opacity_threshold, + //emissive + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_color_texture: emissive_color_texture, + emissive_mask_texture: emissive_mask_texture, + emissive_intensity: emissive_intensity, + //clearcoat + enable_clearcoat: false, + clearcoat_tint: color(1.0f), + clearcoat_transparency: 1.0f, + clearcoat_reflection_roughness: 0.0f, + clearcoat_weight: 1.0f, + clearcoat_flatten: 1.0f, + clearcoat_ior: 1.56f, + clearcoat_bump_factor: 1.f, + clearcoat_normalmap_texture: texture_2d(), + //normal + normalmap_texture: normalmap_texture, + bump_factor: bump_factor, + detail_normalmap_texture: detail_normalmap_texture, + detail_bump_factor: detail_bump_factor, + 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, + clearcoat_texture_translate: float2(0.0f), + clearcoat_texture_rotate: 0.0f, + clearcoat_texture_scale: float2(1.0f) + ); \ No newline at end of file diff --git a/assets/objects/vomp/antiquelvasesmall/materials/SimPBR.mdl b/assets/objects/vomp/antiquelvasesmall/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/antiquelvasesmall/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/antiquelvasesmall/materials/SimPBR_Model.mdl b/assets/objects/vomp/antiquelvasesmall/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/antiquelvasesmall/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/antiquelvasesmall/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/antiquelvasesmall/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/antiquelvasesmall/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/antiquelvasesmall/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/antiquelvasesmall/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/antiquelvasesmall/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/anza_large/materials/SimPBR.mdl b/assets/objects/vomp/anza_large/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/anza_large/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/anza_large/materials/SimPBR_Model.mdl b/assets/objects/vomp/anza_large/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/anza_large/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/anza_large/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/anza_large/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/anza_large/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/anza_large/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/anza_large/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/anza_large/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/anza_medium/materials/SimPBR.mdl b/assets/objects/vomp/anza_medium/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/anza_medium/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/anza_medium/materials/SimPBR_Model.mdl b/assets/objects/vomp/anza_medium/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/anza_medium/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/anza_medium/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/anza_medium/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/anza_medium/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/anza_medium/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/anza_medium/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/anza_medium/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/bin_a01/materials/Plastic_B.mdl b/assets/objects/vomp/bin_a01/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/bin_a01/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/bin_a03/materials/Plastic_B.mdl b/assets/objects/vomp/bin_a03/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/bin_a03/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/bin_a05/materials/Plastic_B.mdl b/assets/objects/vomp/bin_a05/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/bin_a05/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/bin_b01/materials/Plastic_B.mdl b/assets/objects/vomp/bin_b01/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/bin_b01/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/bin_b04/materials/Plastic_B.mdl b/assets/objects/vomp/bin_b04/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/bin_b04/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/bin_b06/materials/Plastic_B.mdl b/assets/objects/vomp/bin_b06/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/bin_b06/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/bin_b07/materials/Plastic_B.mdl b/assets/objects/vomp/bin_b07/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/bin_b07/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR.mdl b/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR_Model.mdl b/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/blackandbrassbowl_large/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR.mdl b/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR_Model.mdl b/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/blackandbrassbowl_small/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/box_a01/materials/Plastic_B.mdl b/assets/objects/vomp/box_a01/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/box_a01/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a01/materials/Plastic_Black_A.mdl b/assets/objects/vomp/box_a01/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/box_a01/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a03/materials/Plastic_B.mdl b/assets/objects/vomp/box_a03/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/box_a03/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a03/materials/Plastic_Black_A.mdl b/assets/objects/vomp/box_a03/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/box_a03/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a06/materials/Plastic_B.mdl b/assets/objects/vomp/box_a06/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/box_a06/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a06/materials/Plastic_Black_A.mdl b/assets/objects/vomp/box_a06/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/box_a06/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a07/materials/Plastic_B.mdl b/assets/objects/vomp/box_a07/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/box_a07/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a07/materials/Plastic_Black_A.mdl b/assets/objects/vomp/box_a07/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/box_a07/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a08/materials/Plastic_B.mdl b/assets/objects/vomp/box_a08/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/box_a08/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a08/materials/Plastic_Black_A.mdl b/assets/objects/vomp/box_a08/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/box_a08/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a09/materials/Plastic_B.mdl b/assets/objects/vomp/box_a09/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/box_a09/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a09/materials/Plastic_Black_A.mdl b/assets/objects/vomp/box_a09/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/box_a09/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a10/materials/Plastic_B.mdl b/assets/objects/vomp/box_a10/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/box_a10/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/box_a10/materials/Plastic_Black_A.mdl b/assets/objects/vomp/box_a10/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/box_a10/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/bulkstoragerack_a01/materials/Metal_Painted_White_Rough_A.mdl b/assets/objects/vomp/bulkstoragerack_a01/materials/Metal_Painted_White_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..8ff431ef39686e8aa6b082715461207b53e3e8b1 --- /dev/null +++ b/assets/objects/vomp/bulkstoragerack_a01/materials/Metal_Painted_White_Rough_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Painted_White_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/bulkstoragerack_a01/materials/Wood_Pressed_A.mdl b/assets/objects/vomp/bulkstoragerack_a01/materials/Wood_Pressed_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2c15e2e8514b7ba0dcda075c382333e24b493f28 --- /dev/null +++ b/assets/objects/vomp/bulkstoragerack_a01/materials/Wood_Pressed_A.mdl @@ -0,0 +1,17 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Wood_Pressed_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/Wood_Pressed_A/T_Wood_Pressed_A1_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/Wood_Pressed_A/T_Wood_Pressed_A1_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/Wood_Pressed_A/T_Wood_Pressed_A1_ORM.png", ::tex::gamma_linear), + project_uvw: true, + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(0.045, 0.045)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a01/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_a01/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_a01/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a01/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_a01/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_a01/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a01/materials/Plastic_Black_B.mdl b/assets/objects/vomp/case_a01/materials/Plastic_Black_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1dadfc5edb81d1cb43b083809f4f426d1c636200 --- /dev/null +++ b/assets/objects/vomp/case_a01/materials/Plastic_Black_B.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_B(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_B_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_B_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 0.5, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_B_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(2, 2), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a02/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_a02/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_a02/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a02/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_a02/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_a02/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a02/materials/Plastic_Black_B.mdl b/assets/objects/vomp/case_a02/materials/Plastic_Black_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1dadfc5edb81d1cb43b083809f4f426d1c636200 --- /dev/null +++ b/assets/objects/vomp/case_a02/materials/Plastic_Black_B.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_B(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_B_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_B_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 0.5, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_B_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(2, 2), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a04/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_a04/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_a04/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a04/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_a04/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_a04/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a04/materials/Plastic_Black_B.mdl b/assets/objects/vomp/case_a04/materials/Plastic_Black_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1dadfc5edb81d1cb43b083809f4f426d1c636200 --- /dev/null +++ b/assets/objects/vomp/case_a04/materials/Plastic_Black_B.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_B(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_B_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_B_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 0.5, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_B_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(2, 2), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a05/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_a05/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_a05/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a05/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_a05/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_a05/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_a05/materials/Plastic_Black_B.mdl b/assets/objects/vomp/case_a05/materials/Plastic_Black_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1dadfc5edb81d1cb43b083809f4f426d1c636200 --- /dev/null +++ b/assets/objects/vomp/case_a05/materials/Plastic_Black_B.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_B(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_B_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_B_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 0.5, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_B_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(2, 2), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c01/materials/Chrome_A.mdl b/assets/objects/vomp/case_c01/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/case_c01/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/case_c01/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_c01/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_c01/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c01/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_c01/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_c01/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c01/materials/Metal_Rough_A.mdl b/assets/objects/vomp/case_c01/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/case_c01/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c01/materials/Plastic_Black_A.mdl b/assets/objects/vomp/case_c01/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/case_c01/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c03/materials/Chrome_A.mdl b/assets/objects/vomp/case_c03/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/case_c03/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/case_c03/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_c03/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_c03/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c03/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_c03/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_c03/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c03/materials/Metal_Rough_A.mdl b/assets/objects/vomp/case_c03/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/case_c03/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c03/materials/Plastic_Black_A.mdl b/assets/objects/vomp/case_c03/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/case_c03/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c04/materials/Chrome_A.mdl b/assets/objects/vomp/case_c04/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/case_c04/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/case_c04/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_c04/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_c04/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c04/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_c04/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_c04/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c04/materials/Metal_Rough_A.mdl b/assets/objects/vomp/case_c04/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/case_c04/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_c04/materials/Plastic_Black_A.mdl b/assets/objects/vomp/case_c04/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/case_c04/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d01/materials/Chrome_A.mdl b/assets/objects/vomp/case_d01/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/case_d01/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/case_d01/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_d01/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_d01/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d01/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_d01/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_d01/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d01/materials/Metal_Rough_A.mdl b/assets/objects/vomp/case_d01/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/case_d01/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d01/materials/Plastic_Black_A.mdl b/assets/objects/vomp/case_d01/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/case_d01/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d02/materials/Chrome_A.mdl b/assets/objects/vomp/case_d02/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/case_d02/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/case_d02/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_d02/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_d02/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d02/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_d02/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_d02/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d02/materials/Metal_Rough_A.mdl b/assets/objects/vomp/case_d02/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/case_d02/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d02/materials/Plastic_Black_A.mdl b/assets/objects/vomp/case_d02/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/case_d02/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d03/materials/Chrome_A.mdl b/assets/objects/vomp/case_d03/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/case_d03/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/case_d03/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_d03/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_d03/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d03/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_d03/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_d03/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d03/materials/Metal_Rough_A.mdl b/assets/objects/vomp/case_d03/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/case_d03/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d03/materials/Plastic_Black_A.mdl b/assets/objects/vomp/case_d03/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/case_d03/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d04/materials/Chrome_A.mdl b/assets/objects/vomp/case_d04/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/case_d04/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/case_d04/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_d04/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_d04/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d04/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_d04/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_d04/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d04/materials/Metal_Rough_A.mdl b/assets/objects/vomp/case_d04/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/case_d04/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_d04/materials/Plastic_Black_A.mdl b/assets/objects/vomp/case_d04/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/case_d04/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_e02/materials/Chrome_A.mdl b/assets/objects/vomp/case_e02/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/case_e02/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/case_e02/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_e02/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_e02/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_e02/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_e02/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_e02/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_e02/materials/Metal_Rough_A.mdl b/assets/objects/vomp/case_e02/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/case_e02/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_e02/materials/Plastic_Black_A.mdl b/assets/objects/vomp/case_e02/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/case_e02/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/case_e03/materials/Chrome_A.mdl b/assets/objects/vomp/case_e03/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/case_e03/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/case_e03/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/case_e03/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/case_e03/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_e03/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/case_e03/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/case_e03/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_e03/materials/Metal_Rough_A.mdl b/assets/objects/vomp/case_e03/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/case_e03/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/case_e03/materials/Plastic_Black_A.mdl b/assets/objects/vomp/case_e03/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/case_e03/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/closedheadpail_a01/materials/Natural_Plastic_E.mdl b/assets/objects/vomp/closedheadpail_a01/materials/Natural_Plastic_E.mdl new file mode 100644 index 0000000000000000000000000000000000000000..720c324b820731f7873a9d1abe45dc74bfa4b6cd --- /dev/null +++ b/assets/objects/vomp/closedheadpail_a01/materials/Natural_Plastic_E.mdl @@ -0,0 +1,171 @@ +mdl 1.7; + +using m_mdl = "mdl"; + +import ::state::normal; +import ::OmniSurface::OmniImage::alpha_mode; +import ::OmniSurface::OmniImage::projection_mode; +import ::OmniSurface::OmniImage::tangent_bitangent_mapping; +import ::OmniSurface::OmniImage::wrap_mode; +import ::OmniSurface::OmniShared::displacement_mode; +import ::OmniSurface::OmniShared::emission_mode; +import ::OmniSurface::OmniShared::ior_presets; +import ::OmniSurface::OmniShared::scattering_colors_presets; +import ::OmniSurface::OmniSurface; +import ::base::texture_coordinate_system; +import ::tex::gamma_mode; + +export material Natural_Plastic_E(*) + = ::OmniSurface::OmniSurface( + diffuse_reflection_weight: 1.f, + diffuse_reflection_weight_image: texture_2d(), + diffuse_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + diffuse_reflection_color: color(1.f, 1.f, 1.f), + diffuse_reflection_color_image: texture_2d(), + diffuse_reflection_roughness: 0.f, + diffuse_reflection_roughness_image: texture_2d(), + diffuse_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + metalness: 0.049999997f, + metalness_image: texture_2d(), + metalness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_weight: 0.f, + specular_reflection_weight_image: texture_2d(), + specular_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_color: color(1.f, 1.f, 1.f), + specular_reflection_color_image: texture_2d(), + specular_reflection_roughness: 0.299999982f, + specular_reflection_roughness_image: texture_2d(), + specular_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_ior_preset: OmniSurface::OmniShared::ior_custom, + specular_reflection_ior: 2.f, + specular_reflection_anisotropy: 0.f, + specular_reflection_anisotropy_image: texture_2d(), + specular_reflection_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_anisotropy_rotation: 0.f, + specular_reflection_anisotropy_rotation_image: texture_2d(), + specular_reflection_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_specular_transmission: true, + specular_transmission_weight: 0.799999952f, + specular_transmission_weight_image: texture_2d(), + specular_transmission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_color: color(1.f, 1.f, 1.f), + specular_transmission_color_image: texture_2d(), + specular_transmission_scattering_depth: 0.f, + specular_transmission_scattering_depth_image: texture_2d(), + specular_transmission_scattering_depth_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_scattering_color: color(0.f, 0.f, 0.f), + specular_transmission_scattering_color_image: texture_2d(), + specular_transmission_scatter_anisotropy: 0.f, + specular_transmission_scatter_anisotropy_image: texture_2d(), + specular_transmission_scatter_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_dispersion_abbe: 0.f, + enable_diffuse_transmission: true, + subsurface_weight: 1.f, + subsurface_weight_image: texture_2d(), + subsurface_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_scattering_colors_preset: OmniSurface::OmniShared::scattering_colors_custom, + subsurface_transmission_color: color(1.f, 1.f, 1.f), + subsurface_transmission_color_image: texture_2d(), + subsurface_scattering_color: color(1.f, 1.f, 1.f), + subsurface_scattering_color_image: texture_2d(), + subsurface_scale: 1.f, + subsurface_scale_image: texture_2d(), + subsurface_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_anisotropy: 0.f, + subsurface_anisotropy_image: texture_2d(), + subsurface_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_weight: 1.f, + coat_weight_image: texture_2d(), + coat_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_color: color(1.f, 1.f, 1.f), + coat_color_image: texture_2d(), + coat_roughness: 0.299999982f, + coat_roughness_image: texture_2d(), + coat_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_ior_preset: OmniSurface::OmniShared::ior_custom, + coat_ior: 1.5f, + coat_anisotropy: 0.f, + coat_anisotropy_image: texture_2d(), + coat_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_anisotropy_rotation: 0.f, + coat_anisotropy_rotation_image: texture_2d(), + coat_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_color: 0.f, + coat_affect_color_image: texture_2d(), + coat_affect_color_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_roughness: 0.f, + coat_affect_roughness_image: texture_2d(), + coat_affect_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_normal_strength: 1.f, + coat_normal: state::normal(), + coat_normal_image: texture_2d(), + coat_normal_image_flip_r_channel: false, + coat_normal_image_flip_g_channel: false, + coat_normal_image_flip_b_channel: false, + specular_retro_reflection_weight: 0.699999988f, + specular_retro_reflection_weight_image: texture_2d(), + specular_retro_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_retro_reflection_color: color(1.f, 1.f, 1.f), + specular_retro_reflection_color_image: texture_2d(), + specular_retro_reflection_roughness: 0.300000012f, + specular_retro_reflection_roughness_image: texture_2d(), + specular_retro_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_weight: 0.f, + emission_weight_image: texture_2d(), + emission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_mode: OmniSurface::OmniShared::emission_lx, + emission_intensity: 1.f, + emission_intensity_image: texture_2d(), + emission_intensity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_color: color(1.f, 1.f, 1.f), + emission_color_image: texture_2d(), + emission_use_temperature: false, + emission_temperature: 6500.f, + emission_temperature_image: texture_2d(), + emission_temperature_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_thin_film: false, + thin_film_thickness: 400.f, + thin_film_thickness_image: texture_2d(), + thin_film_thickness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + thin_film_ior_preset: OmniSurface::OmniShared::ior_custom, + thin_film_ior: 1.5f, + thin_walled: false, + enable_opacity: false, + geometry_opacity: 1.f, + geometry_opacity_image: texture_2d(), + geometry_opacity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_opacity_threshold: 0.f, + geometry_normal_strength: 1.f, + geometry_normal: state::normal(), + geometry_normal_image: texture_2d(), + geometry_normal_image_flip_r_channel: false, + geometry_normal_image_flip_g_channel: false, + geometry_normal_image_flip_b_channel: false, + geometry_tangent_bitangent_mapping: OmniSurface::OmniImage::red_green, + geometry_displacement: float3(0.f), + geometry_displacement_mode: OmniSurface::OmniShared::displacement_height, + geometry_displacement_image: texture_2d(), + geometry_displacement_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scale: 1.f, + geometry_displacement_scale_image: texture_2d(), + geometry_displacement_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scalar_zero_value: 0.f, + uvw_texture_coordinate_system: base::texture_coordinate_uvw, + uvw_uv_set: 0, + uvw_ignore_missing_textures: false, + uvw_missing_texture_color: color(0.f, 0.f, 0.f), + uvw_use_uv_coords: false, + uvw_uv_coords: float2(0.f), + uvw_s_offset: 0.f, + uvw_t_offset: 0.f, + uvw_s_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_t_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_s_scale: 1.f, + uvw_t_scale: 1.f, + uvw_s_flip: false, + uvw_t_flip: false, + uvw_swap_st: false, + uvw_projection_mode: OmniSurface::OmniImage::projection_cubic, + uvw_projection_translate: float3(0.f), + uvw_projection_rotate: float3(0.f), + uvw_projection_scale: float3(1.f)); \ No newline at end of file diff --git a/assets/objects/vomp/closedheadpail_a01/materials/Plastic_Blue_A.mdl b/assets/objects/vomp/closedheadpail_a01/materials/Plastic_Blue_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..79f9b4dcd68659d7de3a9c87ffe82b2a222f44f7 --- /dev/null +++ b/assets/objects/vomp/closedheadpail_a01/materials/Plastic_Blue_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Blue_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Blue_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Blue_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Blue_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/closedheadpail_a01/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/closedheadpail_a01/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/closedheadpail_a01/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_a01/materials/Chrome_A.mdl b/assets/objects/vomp/container_a01/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_a01/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_a02/materials/Chrome_A.mdl b/assets/objects/vomp/container_a02/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_a02/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_a02/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_a02/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_a02/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_a04/materials/Chrome_A.mdl b/assets/objects/vomp/container_a04/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_a04/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_a04/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_a04/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_a04/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b02/materials/Plastic_B.mdl b/assets/objects/vomp/container_b02/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b02/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b03/materials/Plastic_B.mdl b/assets/objects/vomp/container_b03/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b03/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b05/materials/Plastic_B.mdl b/assets/objects/vomp/container_b05/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b05/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b06/materials/Plastic_B.mdl b/assets/objects/vomp/container_b06/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b06/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b07/materials/Plastic_B.mdl b/assets/objects/vomp/container_b07/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b07/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b08/materials/Plastic_B.mdl b/assets/objects/vomp/container_b08/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b08/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b09/materials/Plastic_B.mdl b/assets/objects/vomp/container_b09/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b09/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b10/materials/Plastic_B.mdl b/assets/objects/vomp/container_b10/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b10/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b12/materials/Plastic_B.mdl b/assets/objects/vomp/container_b12/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b12/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b13/materials/Plastic_B.mdl b/assets/objects/vomp/container_b13/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b13/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b14/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/container_b14/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/container_b14/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b14/materials/Plastic_B.mdl b/assets/objects/vomp/container_b14/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b14/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b15/materials/Plastic_B.mdl b/assets/objects/vomp/container_b15/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b15/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b16/materials/Plastic_B.mdl b/assets/objects/vomp/container_b16/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b16/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_b17/materials/Plastic_B.mdl b/assets/objects/vomp/container_b17/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_b17/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c02/materials/Plastic_B.mdl b/assets/objects/vomp/container_c02/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c02/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c03/materials/Plastic_B.mdl b/assets/objects/vomp/container_c03/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c03/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c05/materials/Plastic_B.mdl b/assets/objects/vomp/container_c05/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c05/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c07/materials/Plastic_B.mdl b/assets/objects/vomp/container_c07/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c07/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c08/materials/Plastic_B.mdl b/assets/objects/vomp/container_c08/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c08/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c09/materials/Plastic_B.mdl b/assets/objects/vomp/container_c09/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c09/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c10/materials/Plastic_B.mdl b/assets/objects/vomp/container_c10/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c10/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c14/materials/Plastic_B.mdl b/assets/objects/vomp/container_c14/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c14/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c15/materials/Plastic_B.mdl b/assets/objects/vomp/container_c15/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c15/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c17/materials/Plastic_B.mdl b/assets/objects/vomp/container_c17/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c17/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c18/materials/Plastic_B.mdl b/assets/objects/vomp/container_c18/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c18/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c22/materials/Plastic_B.mdl b/assets/objects/vomp/container_c22/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c22/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c23/materials/Plastic_B.mdl b/assets/objects/vomp/container_c23/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c23/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_c24/materials/Plastic_B.mdl b/assets/objects/vomp/container_c24/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_c24/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d02/materials/Plastic_B.mdl b/assets/objects/vomp/container_d02/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_d02/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d02/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_d02/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_d02/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d03/materials/Plastic_B.mdl b/assets/objects/vomp/container_d03/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_d03/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d03/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_d03/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_d03/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d04/materials/Plastic_B.mdl b/assets/objects/vomp/container_d04/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_d04/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d04/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_d04/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_d04/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d05/materials/Plastic_B.mdl b/assets/objects/vomp/container_d05/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_d05/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d05/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_d05/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_d05/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d07/materials/Plastic_B.mdl b/assets/objects/vomp/container_d07/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_d07/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d07/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_d07/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_d07/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d09/materials/Plastic_B.mdl b/assets/objects/vomp/container_d09/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_d09/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_d09/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_d09/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_d09/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_e01/materials/Plastic_B.mdl b/assets/objects/vomp/container_e01/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_e01/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_e02/materials/Plastic_B.mdl b/assets/objects/vomp/container_e02/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_e02/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_e04/materials/Plastic_B.mdl b/assets/objects/vomp/container_e04/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_e04/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_e05/materials/Plastic_B.mdl b/assets/objects/vomp/container_e05/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_e05/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_e06/materials/Plastic_B.mdl b/assets/objects/vomp/container_e06/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_e06/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f03/materials/Chrome_A.mdl b/assets/objects/vomp/container_f03/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_f03/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_f03/materials/Metal_Rough_A.mdl b/assets/objects/vomp/container_f03/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/container_f03/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f03/materials/Plastic_B.mdl b/assets/objects/vomp/container_f03/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_f03/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f03/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_f03/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_f03/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f05/materials/Chrome_A.mdl b/assets/objects/vomp/container_f05/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_f05/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_f05/materials/Metal_Rough_A.mdl b/assets/objects/vomp/container_f05/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/container_f05/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f05/materials/Plastic_B.mdl b/assets/objects/vomp/container_f05/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_f05/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f05/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_f05/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_f05/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f09/materials/Chrome_A.mdl b/assets/objects/vomp/container_f09/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_f09/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_f09/materials/Metal_Rough_A.mdl b/assets/objects/vomp/container_f09/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/container_f09/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f09/materials/Plastic_B.mdl b/assets/objects/vomp/container_f09/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_f09/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f09/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_f09/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_f09/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f10/materials/Chrome_A.mdl b/assets/objects/vomp/container_f10/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_f10/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_f10/materials/Metal_Rough_A.mdl b/assets/objects/vomp/container_f10/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/container_f10/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f10/materials/Plastic_B.mdl b/assets/objects/vomp/container_f10/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_f10/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f10/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_f10/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_f10/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f13/materials/Chrome_A.mdl b/assets/objects/vomp/container_f13/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_f13/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_f13/materials/Metal_Rough_A.mdl b/assets/objects/vomp/container_f13/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/container_f13/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f13/materials/Plastic_B.mdl b/assets/objects/vomp/container_f13/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_f13/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f13/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_f13/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_f13/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f15/materials/Chrome_A.mdl b/assets/objects/vomp/container_f15/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_f15/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_f15/materials/Metal_Rough_A.mdl b/assets/objects/vomp/container_f15/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/container_f15/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f15/materials/Plastic_B.mdl b/assets/objects/vomp/container_f15/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_f15/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f15/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_f15/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_f15/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f17/materials/Chrome_A.mdl b/assets/objects/vomp/container_f17/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_f17/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_f17/materials/Metal_Rough_A.mdl b/assets/objects/vomp/container_f17/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/container_f17/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f17/materials/Plastic_B.mdl b/assets/objects/vomp/container_f17/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_f17/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f17/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_f17/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_f17/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f18/materials/Chrome_A.mdl b/assets/objects/vomp/container_f18/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_f18/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_f18/materials/Metal_Rough_A.mdl b/assets/objects/vomp/container_f18/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/container_f18/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f18/materials/Plastic_B.mdl b/assets/objects/vomp/container_f18/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_f18/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f18/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_f18/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_f18/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f20/materials/Chrome_A.mdl b/assets/objects/vomp/container_f20/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_f20/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_f20/materials/Metal_Rough_A.mdl b/assets/objects/vomp/container_f20/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/container_f20/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f20/materials/Plastic_B.mdl b/assets/objects/vomp/container_f20/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_f20/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f20/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_f20/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_f20/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f24/materials/Chrome_A.mdl b/assets/objects/vomp/container_f24/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_f24/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_f24/materials/Metal_Rough_A.mdl b/assets/objects/vomp/container_f24/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/container_f24/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f24/materials/Plastic_B.mdl b/assets/objects/vomp/container_f24/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_f24/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f24/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_f24/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_f24/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f26/materials/Chrome_A.mdl b/assets/objects/vomp/container_f26/materials/Chrome_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..84bebfcb7665c30e8f037c3b64d8a4a633553807 --- /dev/null +++ b/assets/objects/vomp/container_f26/materials/Chrome_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Chrome_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Chrome_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Chrome_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Chrome_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/container_f26/materials/Metal_Rough_A.mdl b/assets/objects/vomp/container_f26/materials/Metal_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cc0937458e7320decdf4c7f13d031b04aaf3d133 --- /dev/null +++ b/assets/objects/vomp/container_f26/materials/Metal_Rough_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f26/materials/Plastic_B.mdl b/assets/objects/vomp/container_f26/materials/Plastic_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a1f859e76e33a8c4b59f200324a30653eb5f116 --- /dev/null +++ b/assets/objects/vomp/container_f26/materials/Plastic_B.mdl @@ -0,0 +1,52 @@ +mdl 1.7; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_B(*) + = OmniPBR( + diffuse_color_constant: color(), + diffuse_texture: texture_2d(), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_ORM_1k.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Normal_1k.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/container_f26/materials/Plastic_Black_A.mdl b/assets/objects/vomp/container_f26/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/container_f26/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/crabbypenholder/materials/SimPBR.mdl b/assets/objects/vomp/crabbypenholder/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/crabbypenholder/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/crabbypenholder/materials/SimPBR_Model.mdl b/assets/objects/vomp/crabbypenholder/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/crabbypenholder/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/crabbypenholder/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/crabbypenholder/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/crabbypenholder/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/crabbypenholder/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/crabbypenholder/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/crabbypenholder/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/cutting_board_a/materials/SimPBR.mdl b/assets/objects/vomp/cutting_board_a/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/cutting_board_a/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/cutting_board_a/materials/SimPBR_Model.mdl b/assets/objects/vomp/cutting_board_a/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/cutting_board_a/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/cutting_board_a/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/cutting_board_a/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/cutting_board_a/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/cutting_board_a/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/cutting_board_a/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/cutting_board_a/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/cutting_board_a/textures/Cutting_Board_Metallic.png b/assets/objects/vomp/cutting_board_a/textures/Cutting_Board_Metallic.png new file mode 100644 index 0000000000000000000000000000000000000000..93c29b57993f6fc1b6f235b8607174a513e91eea Binary files /dev/null and b/assets/objects/vomp/cutting_board_a/textures/Cutting_Board_Metallic.png differ diff --git a/assets/objects/vomp/fork_big/materials/SimPBR.mdl b/assets/objects/vomp/fork_big/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/fork_big/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/fork_big/materials/SimPBR_Model.mdl b/assets/objects/vomp/fork_big/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/fork_big/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/fork_big/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/fork_big/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/fork_big/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/fork_big/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/fork_big/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/fork_big/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/fork_big/textures/Fork_Big_BaseColor.png b/assets/objects/vomp/fork_big/textures/Fork_Big_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..0a0b3e581106ecd40d20e3b9ab1ff1dc034341ae Binary files /dev/null and b/assets/objects/vomp/fork_big/textures/Fork_Big_BaseColor.png differ diff --git a/assets/objects/vomp/fork_big/textures/Fork_Big_Metallic.png b/assets/objects/vomp/fork_big/textures/Fork_Big_Metallic.png new file mode 100644 index 0000000000000000000000000000000000000000..2c9753944df3c23d1f0814c3a509302fdcece6a1 Binary files /dev/null and b/assets/objects/vomp/fork_big/textures/Fork_Big_Metallic.png differ diff --git a/assets/objects/vomp/fork_big/textures/Fork_Big_Normal.png b/assets/objects/vomp/fork_big/textures/Fork_Big_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..76d6e68f742935f2761b6bb59a4966217d206786 Binary files /dev/null and b/assets/objects/vomp/fork_big/textures/Fork_Big_Normal.png differ diff --git a/assets/objects/vomp/gardenplanter_large/materials/SimPBR.mdl b/assets/objects/vomp/gardenplanter_large/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/gardenplanter_large/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/gardenplanter_large/materials/SimPBR_Model.mdl b/assets/objects/vomp/gardenplanter_large/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/gardenplanter_large/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/gardenplanter_large/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/gardenplanter_large/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/gardenplanter_large/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/gardenplanter_large/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/gardenplanter_large/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/gardenplanter_large/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/gardenplanter_medium/materials/SimPBR.mdl b/assets/objects/vomp/gardenplanter_medium/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/gardenplanter_medium/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/gardenplanter_medium/materials/SimPBR_Model.mdl b/assets/objects/vomp/gardenplanter_medium/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/gardenplanter_medium/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/gardenplanter_medium/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/gardenplanter_medium/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/gardenplanter_medium/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/gardenplanter_medium/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/gardenplanter_medium/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/gardenplanter_medium/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/gardenplanter_small/materials/SimPBR.mdl b/assets/objects/vomp/gardenplanter_small/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/gardenplanter_small/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/gardenplanter_small/materials/SimPBR_Model.mdl b/assets/objects/vomp/gardenplanter_small/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/gardenplanter_small/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/gardenplanter_small/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/gardenplanter_small/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/gardenplanter_small/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/gardenplanter_small/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/gardenplanter_small/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/gardenplanter_small/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/heavydutysteelshelving_a01/materials/Metal_Painted_White_Rough_A.mdl b/assets/objects/vomp/heavydutysteelshelving_a01/materials/Metal_Painted_White_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..8ff431ef39686e8aa6b082715461207b53e3e8b1 --- /dev/null +++ b/assets/objects/vomp/heavydutysteelshelving_a01/materials/Metal_Painted_White_Rough_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Painted_White_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/liquidscrewtoppail_a01/materials/Plastic_Black_A.mdl b/assets/objects/vomp/liquidscrewtoppail_a01/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/liquidscrewtoppail_a01/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/liquidscrewtoppail_a01/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/liquidscrewtoppail_a01/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/liquidscrewtoppail_a01/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/liquidscrewtoppail_a01/materials/Plastic_Red_A.mdl b/assets/objects/vomp/liquidscrewtoppail_a01/materials/Plastic_Red_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..e9e955c83284bef5ba7a3299aa5bd71ca008d252 --- /dev/null +++ b/assets/objects/vomp/liquidscrewtoppail_a01/materials/Plastic_Red_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Red_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Red_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Red_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Red_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/liquidscrewtoppail_a02/materials/Plastic_Black_A.mdl b/assets/objects/vomp/liquidscrewtoppail_a02/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/liquidscrewtoppail_a02/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/liquidscrewtoppail_a02/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/liquidscrewtoppail_a02/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/liquidscrewtoppail_a02/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/liquidscrewtoppail_a02/materials/Plastic_Red_A.mdl b/assets/objects/vomp/liquidscrewtoppail_a02/materials/Plastic_Red_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..e9e955c83284bef5ba7a3299aa5bd71ca008d252 --- /dev/null +++ b/assets/objects/vomp/liquidscrewtoppail_a02/materials/Plastic_Red_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Red_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Red_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Red_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Red_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/metalfstylecan_a01/materials/Metal_Glossy_B.mdl b/assets/objects/vomp/metalfstylecan_a01/materials/Metal_Glossy_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7ddfa894097a7c1a235b5c038c1fcdce96016e0e --- /dev/null +++ b/assets/objects/vomp/metalfstylecan_a01/materials/Metal_Glossy_B.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_B(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_B_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_B_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_B_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/milkjug_a03/materials/Natural_Plastic_E.mdl b/assets/objects/vomp/milkjug_a03/materials/Natural_Plastic_E.mdl new file mode 100644 index 0000000000000000000000000000000000000000..720c324b820731f7873a9d1abe45dc74bfa4b6cd --- /dev/null +++ b/assets/objects/vomp/milkjug_a03/materials/Natural_Plastic_E.mdl @@ -0,0 +1,171 @@ +mdl 1.7; + +using m_mdl = "mdl"; + +import ::state::normal; +import ::OmniSurface::OmniImage::alpha_mode; +import ::OmniSurface::OmniImage::projection_mode; +import ::OmniSurface::OmniImage::tangent_bitangent_mapping; +import ::OmniSurface::OmniImage::wrap_mode; +import ::OmniSurface::OmniShared::displacement_mode; +import ::OmniSurface::OmniShared::emission_mode; +import ::OmniSurface::OmniShared::ior_presets; +import ::OmniSurface::OmniShared::scattering_colors_presets; +import ::OmniSurface::OmniSurface; +import ::base::texture_coordinate_system; +import ::tex::gamma_mode; + +export material Natural_Plastic_E(*) + = ::OmniSurface::OmniSurface( + diffuse_reflection_weight: 1.f, + diffuse_reflection_weight_image: texture_2d(), + diffuse_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + diffuse_reflection_color: color(1.f, 1.f, 1.f), + diffuse_reflection_color_image: texture_2d(), + diffuse_reflection_roughness: 0.f, + diffuse_reflection_roughness_image: texture_2d(), + diffuse_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + metalness: 0.049999997f, + metalness_image: texture_2d(), + metalness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_weight: 0.f, + specular_reflection_weight_image: texture_2d(), + specular_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_color: color(1.f, 1.f, 1.f), + specular_reflection_color_image: texture_2d(), + specular_reflection_roughness: 0.299999982f, + specular_reflection_roughness_image: texture_2d(), + specular_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_ior_preset: OmniSurface::OmniShared::ior_custom, + specular_reflection_ior: 2.f, + specular_reflection_anisotropy: 0.f, + specular_reflection_anisotropy_image: texture_2d(), + specular_reflection_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_anisotropy_rotation: 0.f, + specular_reflection_anisotropy_rotation_image: texture_2d(), + specular_reflection_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_specular_transmission: true, + specular_transmission_weight: 0.799999952f, + specular_transmission_weight_image: texture_2d(), + specular_transmission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_color: color(1.f, 1.f, 1.f), + specular_transmission_color_image: texture_2d(), + specular_transmission_scattering_depth: 0.f, + specular_transmission_scattering_depth_image: texture_2d(), + specular_transmission_scattering_depth_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_scattering_color: color(0.f, 0.f, 0.f), + specular_transmission_scattering_color_image: texture_2d(), + specular_transmission_scatter_anisotropy: 0.f, + specular_transmission_scatter_anisotropy_image: texture_2d(), + specular_transmission_scatter_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_dispersion_abbe: 0.f, + enable_diffuse_transmission: true, + subsurface_weight: 1.f, + subsurface_weight_image: texture_2d(), + subsurface_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_scattering_colors_preset: OmniSurface::OmniShared::scattering_colors_custom, + subsurface_transmission_color: color(1.f, 1.f, 1.f), + subsurface_transmission_color_image: texture_2d(), + subsurface_scattering_color: color(1.f, 1.f, 1.f), + subsurface_scattering_color_image: texture_2d(), + subsurface_scale: 1.f, + subsurface_scale_image: texture_2d(), + subsurface_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_anisotropy: 0.f, + subsurface_anisotropy_image: texture_2d(), + subsurface_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_weight: 1.f, + coat_weight_image: texture_2d(), + coat_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_color: color(1.f, 1.f, 1.f), + coat_color_image: texture_2d(), + coat_roughness: 0.299999982f, + coat_roughness_image: texture_2d(), + coat_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_ior_preset: OmniSurface::OmniShared::ior_custom, + coat_ior: 1.5f, + coat_anisotropy: 0.f, + coat_anisotropy_image: texture_2d(), + coat_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_anisotropy_rotation: 0.f, + coat_anisotropy_rotation_image: texture_2d(), + coat_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_color: 0.f, + coat_affect_color_image: texture_2d(), + coat_affect_color_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_roughness: 0.f, + coat_affect_roughness_image: texture_2d(), + coat_affect_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_normal_strength: 1.f, + coat_normal: state::normal(), + coat_normal_image: texture_2d(), + coat_normal_image_flip_r_channel: false, + coat_normal_image_flip_g_channel: false, + coat_normal_image_flip_b_channel: false, + specular_retro_reflection_weight: 0.699999988f, + specular_retro_reflection_weight_image: texture_2d(), + specular_retro_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_retro_reflection_color: color(1.f, 1.f, 1.f), + specular_retro_reflection_color_image: texture_2d(), + specular_retro_reflection_roughness: 0.300000012f, + specular_retro_reflection_roughness_image: texture_2d(), + specular_retro_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_weight: 0.f, + emission_weight_image: texture_2d(), + emission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_mode: OmniSurface::OmniShared::emission_lx, + emission_intensity: 1.f, + emission_intensity_image: texture_2d(), + emission_intensity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_color: color(1.f, 1.f, 1.f), + emission_color_image: texture_2d(), + emission_use_temperature: false, + emission_temperature: 6500.f, + emission_temperature_image: texture_2d(), + emission_temperature_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_thin_film: false, + thin_film_thickness: 400.f, + thin_film_thickness_image: texture_2d(), + thin_film_thickness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + thin_film_ior_preset: OmniSurface::OmniShared::ior_custom, + thin_film_ior: 1.5f, + thin_walled: false, + enable_opacity: false, + geometry_opacity: 1.f, + geometry_opacity_image: texture_2d(), + geometry_opacity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_opacity_threshold: 0.f, + geometry_normal_strength: 1.f, + geometry_normal: state::normal(), + geometry_normal_image: texture_2d(), + geometry_normal_image_flip_r_channel: false, + geometry_normal_image_flip_g_channel: false, + geometry_normal_image_flip_b_channel: false, + geometry_tangent_bitangent_mapping: OmniSurface::OmniImage::red_green, + geometry_displacement: float3(0.f), + geometry_displacement_mode: OmniSurface::OmniShared::displacement_height, + geometry_displacement_image: texture_2d(), + geometry_displacement_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scale: 1.f, + geometry_displacement_scale_image: texture_2d(), + geometry_displacement_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scalar_zero_value: 0.f, + uvw_texture_coordinate_system: base::texture_coordinate_uvw, + uvw_uv_set: 0, + uvw_ignore_missing_textures: false, + uvw_missing_texture_color: color(0.f, 0.f, 0.f), + uvw_use_uv_coords: false, + uvw_uv_coords: float2(0.f), + uvw_s_offset: 0.f, + uvw_t_offset: 0.f, + uvw_s_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_t_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_s_scale: 1.f, + uvw_t_scale: 1.f, + uvw_s_flip: false, + uvw_t_flip: false, + uvw_swap_st: false, + uvw_projection_mode: OmniSurface::OmniImage::projection_cubic, + uvw_projection_translate: float3(0.f), + uvw_projection_rotate: float3(0.f), + uvw_projection_scale: float3(1.f)); \ No newline at end of file diff --git a/assets/objects/vomp/milkjug_a03/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/milkjug_a03/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/milkjug_a03/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/moppingbucket_b01/materials/Plastic_Black_A.mdl b/assets/objects/vomp/moppingbucket_b01/materials/Plastic_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1764e75479a520a2344e841fbde8c49541177a86 --- /dev/null +++ b/assets/objects/vomp/moppingbucket_b01/materials/Plastic_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Black_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Black_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Black_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/moppingbucket_b01/materials/Plastic_Blue_A.mdl b/assets/objects/vomp/moppingbucket_b01/materials/Plastic_Blue_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..79f9b4dcd68659d7de3a9c87ffe82b2a222f44f7 --- /dev/null +++ b/assets/objects/vomp/moppingbucket_b01/materials/Plastic_Blue_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Blue_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Blue_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Blue_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Blue_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/moppingbucket_b01/materials/SimPBR.mdl b/assets/objects/vomp/moppingbucket_b01/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/moppingbucket_b01/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/moppingbucket_b01/materials/SimPBR_Model.mdl b/assets/objects/vomp/moppingbucket_b01/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/moppingbucket_b01/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/moppingbucket_b01/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/moppingbucket_b01/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/moppingbucket_b01/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/moppingbucket_b01/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/moppingbucket_b01/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/moppingbucket_b01/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/naturalbostonroundbottle_a01/materials/Natural_Plastic_E.mdl b/assets/objects/vomp/naturalbostonroundbottle_a01/materials/Natural_Plastic_E.mdl new file mode 100644 index 0000000000000000000000000000000000000000..720c324b820731f7873a9d1abe45dc74bfa4b6cd --- /dev/null +++ b/assets/objects/vomp/naturalbostonroundbottle_a01/materials/Natural_Plastic_E.mdl @@ -0,0 +1,171 @@ +mdl 1.7; + +using m_mdl = "mdl"; + +import ::state::normal; +import ::OmniSurface::OmniImage::alpha_mode; +import ::OmniSurface::OmniImage::projection_mode; +import ::OmniSurface::OmniImage::tangent_bitangent_mapping; +import ::OmniSurface::OmniImage::wrap_mode; +import ::OmniSurface::OmniShared::displacement_mode; +import ::OmniSurface::OmniShared::emission_mode; +import ::OmniSurface::OmniShared::ior_presets; +import ::OmniSurface::OmniShared::scattering_colors_presets; +import ::OmniSurface::OmniSurface; +import ::base::texture_coordinate_system; +import ::tex::gamma_mode; + +export material Natural_Plastic_E(*) + = ::OmniSurface::OmniSurface( + diffuse_reflection_weight: 1.f, + diffuse_reflection_weight_image: texture_2d(), + diffuse_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + diffuse_reflection_color: color(1.f, 1.f, 1.f), + diffuse_reflection_color_image: texture_2d(), + diffuse_reflection_roughness: 0.f, + diffuse_reflection_roughness_image: texture_2d(), + diffuse_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + metalness: 0.049999997f, + metalness_image: texture_2d(), + metalness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_weight: 0.f, + specular_reflection_weight_image: texture_2d(), + specular_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_color: color(1.f, 1.f, 1.f), + specular_reflection_color_image: texture_2d(), + specular_reflection_roughness: 0.299999982f, + specular_reflection_roughness_image: texture_2d(), + specular_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_ior_preset: OmniSurface::OmniShared::ior_custom, + specular_reflection_ior: 2.f, + specular_reflection_anisotropy: 0.f, + specular_reflection_anisotropy_image: texture_2d(), + specular_reflection_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_anisotropy_rotation: 0.f, + specular_reflection_anisotropy_rotation_image: texture_2d(), + specular_reflection_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_specular_transmission: true, + specular_transmission_weight: 0.799999952f, + specular_transmission_weight_image: texture_2d(), + specular_transmission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_color: color(1.f, 1.f, 1.f), + specular_transmission_color_image: texture_2d(), + specular_transmission_scattering_depth: 0.f, + specular_transmission_scattering_depth_image: texture_2d(), + specular_transmission_scattering_depth_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_scattering_color: color(0.f, 0.f, 0.f), + specular_transmission_scattering_color_image: texture_2d(), + specular_transmission_scatter_anisotropy: 0.f, + specular_transmission_scatter_anisotropy_image: texture_2d(), + specular_transmission_scatter_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_dispersion_abbe: 0.f, + enable_diffuse_transmission: true, + subsurface_weight: 1.f, + subsurface_weight_image: texture_2d(), + subsurface_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_scattering_colors_preset: OmniSurface::OmniShared::scattering_colors_custom, + subsurface_transmission_color: color(1.f, 1.f, 1.f), + subsurface_transmission_color_image: texture_2d(), + subsurface_scattering_color: color(1.f, 1.f, 1.f), + subsurface_scattering_color_image: texture_2d(), + subsurface_scale: 1.f, + subsurface_scale_image: texture_2d(), + subsurface_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_anisotropy: 0.f, + subsurface_anisotropy_image: texture_2d(), + subsurface_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_weight: 1.f, + coat_weight_image: texture_2d(), + coat_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_color: color(1.f, 1.f, 1.f), + coat_color_image: texture_2d(), + coat_roughness: 0.299999982f, + coat_roughness_image: texture_2d(), + coat_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_ior_preset: OmniSurface::OmniShared::ior_custom, + coat_ior: 1.5f, + coat_anisotropy: 0.f, + coat_anisotropy_image: texture_2d(), + coat_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_anisotropy_rotation: 0.f, + coat_anisotropy_rotation_image: texture_2d(), + coat_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_color: 0.f, + coat_affect_color_image: texture_2d(), + coat_affect_color_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_roughness: 0.f, + coat_affect_roughness_image: texture_2d(), + coat_affect_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_normal_strength: 1.f, + coat_normal: state::normal(), + coat_normal_image: texture_2d(), + coat_normal_image_flip_r_channel: false, + coat_normal_image_flip_g_channel: false, + coat_normal_image_flip_b_channel: false, + specular_retro_reflection_weight: 0.699999988f, + specular_retro_reflection_weight_image: texture_2d(), + specular_retro_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_retro_reflection_color: color(1.f, 1.f, 1.f), + specular_retro_reflection_color_image: texture_2d(), + specular_retro_reflection_roughness: 0.300000012f, + specular_retro_reflection_roughness_image: texture_2d(), + specular_retro_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_weight: 0.f, + emission_weight_image: texture_2d(), + emission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_mode: OmniSurface::OmniShared::emission_lx, + emission_intensity: 1.f, + emission_intensity_image: texture_2d(), + emission_intensity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_color: color(1.f, 1.f, 1.f), + emission_color_image: texture_2d(), + emission_use_temperature: false, + emission_temperature: 6500.f, + emission_temperature_image: texture_2d(), + emission_temperature_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_thin_film: false, + thin_film_thickness: 400.f, + thin_film_thickness_image: texture_2d(), + thin_film_thickness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + thin_film_ior_preset: OmniSurface::OmniShared::ior_custom, + thin_film_ior: 1.5f, + thin_walled: false, + enable_opacity: false, + geometry_opacity: 1.f, + geometry_opacity_image: texture_2d(), + geometry_opacity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_opacity_threshold: 0.f, + geometry_normal_strength: 1.f, + geometry_normal: state::normal(), + geometry_normal_image: texture_2d(), + geometry_normal_image_flip_r_channel: false, + geometry_normal_image_flip_g_channel: false, + geometry_normal_image_flip_b_channel: false, + geometry_tangent_bitangent_mapping: OmniSurface::OmniImage::red_green, + geometry_displacement: float3(0.f), + geometry_displacement_mode: OmniSurface::OmniShared::displacement_height, + geometry_displacement_image: texture_2d(), + geometry_displacement_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scale: 1.f, + geometry_displacement_scale_image: texture_2d(), + geometry_displacement_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scalar_zero_value: 0.f, + uvw_texture_coordinate_system: base::texture_coordinate_uvw, + uvw_uv_set: 0, + uvw_ignore_missing_textures: false, + uvw_missing_texture_color: color(0.f, 0.f, 0.f), + uvw_use_uv_coords: false, + uvw_uv_coords: float2(0.f), + uvw_s_offset: 0.f, + uvw_t_offset: 0.f, + uvw_s_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_t_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_s_scale: 1.f, + uvw_t_scale: 1.f, + uvw_s_flip: false, + uvw_t_flip: false, + uvw_swap_st: false, + uvw_projection_mode: OmniSurface::OmniImage::projection_cubic, + uvw_projection_translate: float3(0.f), + uvw_projection_rotate: float3(0.f), + uvw_projection_scale: float3(1.f)); \ No newline at end of file diff --git a/assets/objects/vomp/naturalbostonroundbottle_a01/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/naturalbostonroundbottle_a01/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/naturalbostonroundbottle_a01/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/naturalbostonroundbottle_a03/materials/Natural_Plastic_E.mdl b/assets/objects/vomp/naturalbostonroundbottle_a03/materials/Natural_Plastic_E.mdl new file mode 100644 index 0000000000000000000000000000000000000000..720c324b820731f7873a9d1abe45dc74bfa4b6cd --- /dev/null +++ b/assets/objects/vomp/naturalbostonroundbottle_a03/materials/Natural_Plastic_E.mdl @@ -0,0 +1,171 @@ +mdl 1.7; + +using m_mdl = "mdl"; + +import ::state::normal; +import ::OmniSurface::OmniImage::alpha_mode; +import ::OmniSurface::OmniImage::projection_mode; +import ::OmniSurface::OmniImage::tangent_bitangent_mapping; +import ::OmniSurface::OmniImage::wrap_mode; +import ::OmniSurface::OmniShared::displacement_mode; +import ::OmniSurface::OmniShared::emission_mode; +import ::OmniSurface::OmniShared::ior_presets; +import ::OmniSurface::OmniShared::scattering_colors_presets; +import ::OmniSurface::OmniSurface; +import ::base::texture_coordinate_system; +import ::tex::gamma_mode; + +export material Natural_Plastic_E(*) + = ::OmniSurface::OmniSurface( + diffuse_reflection_weight: 1.f, + diffuse_reflection_weight_image: texture_2d(), + diffuse_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + diffuse_reflection_color: color(1.f, 1.f, 1.f), + diffuse_reflection_color_image: texture_2d(), + diffuse_reflection_roughness: 0.f, + diffuse_reflection_roughness_image: texture_2d(), + diffuse_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + metalness: 0.049999997f, + metalness_image: texture_2d(), + metalness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_weight: 0.f, + specular_reflection_weight_image: texture_2d(), + specular_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_color: color(1.f, 1.f, 1.f), + specular_reflection_color_image: texture_2d(), + specular_reflection_roughness: 0.299999982f, + specular_reflection_roughness_image: texture_2d(), + specular_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_ior_preset: OmniSurface::OmniShared::ior_custom, + specular_reflection_ior: 2.f, + specular_reflection_anisotropy: 0.f, + specular_reflection_anisotropy_image: texture_2d(), + specular_reflection_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_anisotropy_rotation: 0.f, + specular_reflection_anisotropy_rotation_image: texture_2d(), + specular_reflection_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_specular_transmission: true, + specular_transmission_weight: 0.799999952f, + specular_transmission_weight_image: texture_2d(), + specular_transmission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_color: color(1.f, 1.f, 1.f), + specular_transmission_color_image: texture_2d(), + specular_transmission_scattering_depth: 0.f, + specular_transmission_scattering_depth_image: texture_2d(), + specular_transmission_scattering_depth_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_scattering_color: color(0.f, 0.f, 0.f), + specular_transmission_scattering_color_image: texture_2d(), + specular_transmission_scatter_anisotropy: 0.f, + specular_transmission_scatter_anisotropy_image: texture_2d(), + specular_transmission_scatter_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_dispersion_abbe: 0.f, + enable_diffuse_transmission: true, + subsurface_weight: 1.f, + subsurface_weight_image: texture_2d(), + subsurface_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_scattering_colors_preset: OmniSurface::OmniShared::scattering_colors_custom, + subsurface_transmission_color: color(1.f, 1.f, 1.f), + subsurface_transmission_color_image: texture_2d(), + subsurface_scattering_color: color(1.f, 1.f, 1.f), + subsurface_scattering_color_image: texture_2d(), + subsurface_scale: 1.f, + subsurface_scale_image: texture_2d(), + subsurface_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_anisotropy: 0.f, + subsurface_anisotropy_image: texture_2d(), + subsurface_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_weight: 1.f, + coat_weight_image: texture_2d(), + coat_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_color: color(1.f, 1.f, 1.f), + coat_color_image: texture_2d(), + coat_roughness: 0.299999982f, + coat_roughness_image: texture_2d(), + coat_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_ior_preset: OmniSurface::OmniShared::ior_custom, + coat_ior: 1.5f, + coat_anisotropy: 0.f, + coat_anisotropy_image: texture_2d(), + coat_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_anisotropy_rotation: 0.f, + coat_anisotropy_rotation_image: texture_2d(), + coat_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_color: 0.f, + coat_affect_color_image: texture_2d(), + coat_affect_color_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_roughness: 0.f, + coat_affect_roughness_image: texture_2d(), + coat_affect_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_normal_strength: 1.f, + coat_normal: state::normal(), + coat_normal_image: texture_2d(), + coat_normal_image_flip_r_channel: false, + coat_normal_image_flip_g_channel: false, + coat_normal_image_flip_b_channel: false, + specular_retro_reflection_weight: 0.699999988f, + specular_retro_reflection_weight_image: texture_2d(), + specular_retro_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_retro_reflection_color: color(1.f, 1.f, 1.f), + specular_retro_reflection_color_image: texture_2d(), + specular_retro_reflection_roughness: 0.300000012f, + specular_retro_reflection_roughness_image: texture_2d(), + specular_retro_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_weight: 0.f, + emission_weight_image: texture_2d(), + emission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_mode: OmniSurface::OmniShared::emission_lx, + emission_intensity: 1.f, + emission_intensity_image: texture_2d(), + emission_intensity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_color: color(1.f, 1.f, 1.f), + emission_color_image: texture_2d(), + emission_use_temperature: false, + emission_temperature: 6500.f, + emission_temperature_image: texture_2d(), + emission_temperature_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_thin_film: false, + thin_film_thickness: 400.f, + thin_film_thickness_image: texture_2d(), + thin_film_thickness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + thin_film_ior_preset: OmniSurface::OmniShared::ior_custom, + thin_film_ior: 1.5f, + thin_walled: false, + enable_opacity: false, + geometry_opacity: 1.f, + geometry_opacity_image: texture_2d(), + geometry_opacity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_opacity_threshold: 0.f, + geometry_normal_strength: 1.f, + geometry_normal: state::normal(), + geometry_normal_image: texture_2d(), + geometry_normal_image_flip_r_channel: false, + geometry_normal_image_flip_g_channel: false, + geometry_normal_image_flip_b_channel: false, + geometry_tangent_bitangent_mapping: OmniSurface::OmniImage::red_green, + geometry_displacement: float3(0.f), + geometry_displacement_mode: OmniSurface::OmniShared::displacement_height, + geometry_displacement_image: texture_2d(), + geometry_displacement_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scale: 1.f, + geometry_displacement_scale_image: texture_2d(), + geometry_displacement_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scalar_zero_value: 0.f, + uvw_texture_coordinate_system: base::texture_coordinate_uvw, + uvw_uv_set: 0, + uvw_ignore_missing_textures: false, + uvw_missing_texture_color: color(0.f, 0.f, 0.f), + uvw_use_uv_coords: false, + uvw_uv_coords: float2(0.f), + uvw_s_offset: 0.f, + uvw_t_offset: 0.f, + uvw_s_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_t_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_s_scale: 1.f, + uvw_t_scale: 1.f, + uvw_s_flip: false, + uvw_t_flip: false, + uvw_swap_st: false, + uvw_projection_mode: OmniSurface::OmniImage::projection_cubic, + uvw_projection_translate: float3(0.f), + uvw_projection_rotate: float3(0.f), + uvw_projection_scale: float3(1.f)); \ No newline at end of file diff --git a/assets/objects/vomp/naturalbostonroundbottle_a03/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/naturalbostonroundbottle_a03/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/naturalbostonroundbottle_a03/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticjerrican_a03/materials/Natural_Plastic_E.mdl b/assets/objects/vomp/plasticjerrican_a03/materials/Natural_Plastic_E.mdl new file mode 100644 index 0000000000000000000000000000000000000000..720c324b820731f7873a9d1abe45dc74bfa4b6cd --- /dev/null +++ b/assets/objects/vomp/plasticjerrican_a03/materials/Natural_Plastic_E.mdl @@ -0,0 +1,171 @@ +mdl 1.7; + +using m_mdl = "mdl"; + +import ::state::normal; +import ::OmniSurface::OmniImage::alpha_mode; +import ::OmniSurface::OmniImage::projection_mode; +import ::OmniSurface::OmniImage::tangent_bitangent_mapping; +import ::OmniSurface::OmniImage::wrap_mode; +import ::OmniSurface::OmniShared::displacement_mode; +import ::OmniSurface::OmniShared::emission_mode; +import ::OmniSurface::OmniShared::ior_presets; +import ::OmniSurface::OmniShared::scattering_colors_presets; +import ::OmniSurface::OmniSurface; +import ::base::texture_coordinate_system; +import ::tex::gamma_mode; + +export material Natural_Plastic_E(*) + = ::OmniSurface::OmniSurface( + diffuse_reflection_weight: 1.f, + diffuse_reflection_weight_image: texture_2d(), + diffuse_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + diffuse_reflection_color: color(1.f, 1.f, 1.f), + diffuse_reflection_color_image: texture_2d(), + diffuse_reflection_roughness: 0.f, + diffuse_reflection_roughness_image: texture_2d(), + diffuse_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + metalness: 0.049999997f, + metalness_image: texture_2d(), + metalness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_weight: 0.f, + specular_reflection_weight_image: texture_2d(), + specular_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_color: color(1.f, 1.f, 1.f), + specular_reflection_color_image: texture_2d(), + specular_reflection_roughness: 0.299999982f, + specular_reflection_roughness_image: texture_2d(), + specular_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_ior_preset: OmniSurface::OmniShared::ior_custom, + specular_reflection_ior: 2.f, + specular_reflection_anisotropy: 0.f, + specular_reflection_anisotropy_image: texture_2d(), + specular_reflection_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_anisotropy_rotation: 0.f, + specular_reflection_anisotropy_rotation_image: texture_2d(), + specular_reflection_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_specular_transmission: true, + specular_transmission_weight: 0.799999952f, + specular_transmission_weight_image: texture_2d(), + specular_transmission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_color: color(1.f, 1.f, 1.f), + specular_transmission_color_image: texture_2d(), + specular_transmission_scattering_depth: 0.f, + specular_transmission_scattering_depth_image: texture_2d(), + specular_transmission_scattering_depth_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_scattering_color: color(0.f, 0.f, 0.f), + specular_transmission_scattering_color_image: texture_2d(), + specular_transmission_scatter_anisotropy: 0.f, + specular_transmission_scatter_anisotropy_image: texture_2d(), + specular_transmission_scatter_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_dispersion_abbe: 0.f, + enable_diffuse_transmission: true, + subsurface_weight: 1.f, + subsurface_weight_image: texture_2d(), + subsurface_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_scattering_colors_preset: OmniSurface::OmniShared::scattering_colors_custom, + subsurface_transmission_color: color(1.f, 1.f, 1.f), + subsurface_transmission_color_image: texture_2d(), + subsurface_scattering_color: color(1.f, 1.f, 1.f), + subsurface_scattering_color_image: texture_2d(), + subsurface_scale: 1.f, + subsurface_scale_image: texture_2d(), + subsurface_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_anisotropy: 0.f, + subsurface_anisotropy_image: texture_2d(), + subsurface_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_weight: 1.f, + coat_weight_image: texture_2d(), + coat_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_color: color(1.f, 1.f, 1.f), + coat_color_image: texture_2d(), + coat_roughness: 0.299999982f, + coat_roughness_image: texture_2d(), + coat_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_ior_preset: OmniSurface::OmniShared::ior_custom, + coat_ior: 1.5f, + coat_anisotropy: 0.f, + coat_anisotropy_image: texture_2d(), + coat_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_anisotropy_rotation: 0.f, + coat_anisotropy_rotation_image: texture_2d(), + coat_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_color: 0.f, + coat_affect_color_image: texture_2d(), + coat_affect_color_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_roughness: 0.f, + coat_affect_roughness_image: texture_2d(), + coat_affect_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_normal_strength: 1.f, + coat_normal: state::normal(), + coat_normal_image: texture_2d(), + coat_normal_image_flip_r_channel: false, + coat_normal_image_flip_g_channel: false, + coat_normal_image_flip_b_channel: false, + specular_retro_reflection_weight: 0.699999988f, + specular_retro_reflection_weight_image: texture_2d(), + specular_retro_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_retro_reflection_color: color(1.f, 1.f, 1.f), + specular_retro_reflection_color_image: texture_2d(), + specular_retro_reflection_roughness: 0.300000012f, + specular_retro_reflection_roughness_image: texture_2d(), + specular_retro_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_weight: 0.f, + emission_weight_image: texture_2d(), + emission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_mode: OmniSurface::OmniShared::emission_lx, + emission_intensity: 1.f, + emission_intensity_image: texture_2d(), + emission_intensity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_color: color(1.f, 1.f, 1.f), + emission_color_image: texture_2d(), + emission_use_temperature: false, + emission_temperature: 6500.f, + emission_temperature_image: texture_2d(), + emission_temperature_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_thin_film: false, + thin_film_thickness: 400.f, + thin_film_thickness_image: texture_2d(), + thin_film_thickness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + thin_film_ior_preset: OmniSurface::OmniShared::ior_custom, + thin_film_ior: 1.5f, + thin_walled: false, + enable_opacity: false, + geometry_opacity: 1.f, + geometry_opacity_image: texture_2d(), + geometry_opacity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_opacity_threshold: 0.f, + geometry_normal_strength: 1.f, + geometry_normal: state::normal(), + geometry_normal_image: texture_2d(), + geometry_normal_image_flip_r_channel: false, + geometry_normal_image_flip_g_channel: false, + geometry_normal_image_flip_b_channel: false, + geometry_tangent_bitangent_mapping: OmniSurface::OmniImage::red_green, + geometry_displacement: float3(0.f), + geometry_displacement_mode: OmniSurface::OmniShared::displacement_height, + geometry_displacement_image: texture_2d(), + geometry_displacement_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scale: 1.f, + geometry_displacement_scale_image: texture_2d(), + geometry_displacement_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scalar_zero_value: 0.f, + uvw_texture_coordinate_system: base::texture_coordinate_uvw, + uvw_uv_set: 0, + uvw_ignore_missing_textures: false, + uvw_missing_texture_color: color(0.f, 0.f, 0.f), + uvw_use_uv_coords: false, + uvw_uv_coords: float2(0.f), + uvw_s_offset: 0.f, + uvw_t_offset: 0.f, + uvw_s_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_t_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_s_scale: 1.f, + uvw_t_scale: 1.f, + uvw_s_flip: false, + uvw_t_flip: false, + uvw_swap_st: false, + uvw_projection_mode: OmniSurface::OmniImage::projection_cubic, + uvw_projection_translate: float3(0.f), + uvw_projection_rotate: float3(0.f), + uvw_projection_scale: float3(1.f)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticjerrican_a03/materials/Plastic_Blue_B.mdl b/assets/objects/vomp/plasticjerrican_a03/materials/Plastic_Blue_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..456c1f2cfdfda8f78d9b450b16c94ab599b14f8e --- /dev/null +++ b/assets/objects/vomp/plasticjerrican_a03/materials/Plastic_Blue_B.mdl @@ -0,0 +1,22 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Blue_B(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Blue_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 0.78, + diffuse_tint: color(0.57865864, 0.7281282, 0.87644786), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Blue_A_ORM.png", ::tex::gamma_linear), + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Blue_A_Normal.png", ::tex::gamma_linear)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticjerrican_a03/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/plasticjerrican_a03/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/plasticjerrican_a03/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticjerrican_a04/materials/Natural_Plastic_E.mdl b/assets/objects/vomp/plasticjerrican_a04/materials/Natural_Plastic_E.mdl new file mode 100644 index 0000000000000000000000000000000000000000..720c324b820731f7873a9d1abe45dc74bfa4b6cd --- /dev/null +++ b/assets/objects/vomp/plasticjerrican_a04/materials/Natural_Plastic_E.mdl @@ -0,0 +1,171 @@ +mdl 1.7; + +using m_mdl = "mdl"; + +import ::state::normal; +import ::OmniSurface::OmniImage::alpha_mode; +import ::OmniSurface::OmniImage::projection_mode; +import ::OmniSurface::OmniImage::tangent_bitangent_mapping; +import ::OmniSurface::OmniImage::wrap_mode; +import ::OmniSurface::OmniShared::displacement_mode; +import ::OmniSurface::OmniShared::emission_mode; +import ::OmniSurface::OmniShared::ior_presets; +import ::OmniSurface::OmniShared::scattering_colors_presets; +import ::OmniSurface::OmniSurface; +import ::base::texture_coordinate_system; +import ::tex::gamma_mode; + +export material Natural_Plastic_E(*) + = ::OmniSurface::OmniSurface( + diffuse_reflection_weight: 1.f, + diffuse_reflection_weight_image: texture_2d(), + diffuse_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + diffuse_reflection_color: color(1.f, 1.f, 1.f), + diffuse_reflection_color_image: texture_2d(), + diffuse_reflection_roughness: 0.f, + diffuse_reflection_roughness_image: texture_2d(), + diffuse_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + metalness: 0.049999997f, + metalness_image: texture_2d(), + metalness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_weight: 0.f, + specular_reflection_weight_image: texture_2d(), + specular_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_color: color(1.f, 1.f, 1.f), + specular_reflection_color_image: texture_2d(), + specular_reflection_roughness: 0.299999982f, + specular_reflection_roughness_image: texture_2d(), + specular_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_ior_preset: OmniSurface::OmniShared::ior_custom, + specular_reflection_ior: 2.f, + specular_reflection_anisotropy: 0.f, + specular_reflection_anisotropy_image: texture_2d(), + specular_reflection_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_anisotropy_rotation: 0.f, + specular_reflection_anisotropy_rotation_image: texture_2d(), + specular_reflection_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_specular_transmission: true, + specular_transmission_weight: 0.799999952f, + specular_transmission_weight_image: texture_2d(), + specular_transmission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_color: color(1.f, 1.f, 1.f), + specular_transmission_color_image: texture_2d(), + specular_transmission_scattering_depth: 0.f, + specular_transmission_scattering_depth_image: texture_2d(), + specular_transmission_scattering_depth_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_scattering_color: color(0.f, 0.f, 0.f), + specular_transmission_scattering_color_image: texture_2d(), + specular_transmission_scatter_anisotropy: 0.f, + specular_transmission_scatter_anisotropy_image: texture_2d(), + specular_transmission_scatter_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_dispersion_abbe: 0.f, + enable_diffuse_transmission: true, + subsurface_weight: 1.f, + subsurface_weight_image: texture_2d(), + subsurface_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_scattering_colors_preset: OmniSurface::OmniShared::scattering_colors_custom, + subsurface_transmission_color: color(1.f, 1.f, 1.f), + subsurface_transmission_color_image: texture_2d(), + subsurface_scattering_color: color(1.f, 1.f, 1.f), + subsurface_scattering_color_image: texture_2d(), + subsurface_scale: 1.f, + subsurface_scale_image: texture_2d(), + subsurface_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_anisotropy: 0.f, + subsurface_anisotropy_image: texture_2d(), + subsurface_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_weight: 1.f, + coat_weight_image: texture_2d(), + coat_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_color: color(1.f, 1.f, 1.f), + coat_color_image: texture_2d(), + coat_roughness: 0.299999982f, + coat_roughness_image: texture_2d(), + coat_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_ior_preset: OmniSurface::OmniShared::ior_custom, + coat_ior: 1.5f, + coat_anisotropy: 0.f, + coat_anisotropy_image: texture_2d(), + coat_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_anisotropy_rotation: 0.f, + coat_anisotropy_rotation_image: texture_2d(), + coat_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_color: 0.f, + coat_affect_color_image: texture_2d(), + coat_affect_color_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_roughness: 0.f, + coat_affect_roughness_image: texture_2d(), + coat_affect_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_normal_strength: 1.f, + coat_normal: state::normal(), + coat_normal_image: texture_2d(), + coat_normal_image_flip_r_channel: false, + coat_normal_image_flip_g_channel: false, + coat_normal_image_flip_b_channel: false, + specular_retro_reflection_weight: 0.699999988f, + specular_retro_reflection_weight_image: texture_2d(), + specular_retro_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_retro_reflection_color: color(1.f, 1.f, 1.f), + specular_retro_reflection_color_image: texture_2d(), + specular_retro_reflection_roughness: 0.300000012f, + specular_retro_reflection_roughness_image: texture_2d(), + specular_retro_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_weight: 0.f, + emission_weight_image: texture_2d(), + emission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_mode: OmniSurface::OmniShared::emission_lx, + emission_intensity: 1.f, + emission_intensity_image: texture_2d(), + emission_intensity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_color: color(1.f, 1.f, 1.f), + emission_color_image: texture_2d(), + emission_use_temperature: false, + emission_temperature: 6500.f, + emission_temperature_image: texture_2d(), + emission_temperature_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_thin_film: false, + thin_film_thickness: 400.f, + thin_film_thickness_image: texture_2d(), + thin_film_thickness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + thin_film_ior_preset: OmniSurface::OmniShared::ior_custom, + thin_film_ior: 1.5f, + thin_walled: false, + enable_opacity: false, + geometry_opacity: 1.f, + geometry_opacity_image: texture_2d(), + geometry_opacity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_opacity_threshold: 0.f, + geometry_normal_strength: 1.f, + geometry_normal: state::normal(), + geometry_normal_image: texture_2d(), + geometry_normal_image_flip_r_channel: false, + geometry_normal_image_flip_g_channel: false, + geometry_normal_image_flip_b_channel: false, + geometry_tangent_bitangent_mapping: OmniSurface::OmniImage::red_green, + geometry_displacement: float3(0.f), + geometry_displacement_mode: OmniSurface::OmniShared::displacement_height, + geometry_displacement_image: texture_2d(), + geometry_displacement_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scale: 1.f, + geometry_displacement_scale_image: texture_2d(), + geometry_displacement_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scalar_zero_value: 0.f, + uvw_texture_coordinate_system: base::texture_coordinate_uvw, + uvw_uv_set: 0, + uvw_ignore_missing_textures: false, + uvw_missing_texture_color: color(0.f, 0.f, 0.f), + uvw_use_uv_coords: false, + uvw_uv_coords: float2(0.f), + uvw_s_offset: 0.f, + uvw_t_offset: 0.f, + uvw_s_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_t_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_s_scale: 1.f, + uvw_t_scale: 1.f, + uvw_s_flip: false, + uvw_t_flip: false, + uvw_swap_st: false, + uvw_projection_mode: OmniSurface::OmniImage::projection_cubic, + uvw_projection_translate: float3(0.f), + uvw_projection_rotate: float3(0.f), + uvw_projection_scale: float3(1.f)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticjerrican_a04/materials/Plastic_Blue_B.mdl b/assets/objects/vomp/plasticjerrican_a04/materials/Plastic_Blue_B.mdl new file mode 100644 index 0000000000000000000000000000000000000000..456c1f2cfdfda8f78d9b450b16c94ab599b14f8e --- /dev/null +++ b/assets/objects/vomp/plasticjerrican_a04/materials/Plastic_Blue_B.mdl @@ -0,0 +1,22 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Blue_B(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Blue_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 0.78, + diffuse_tint: color(0.57865864, 0.7281282, 0.87644786), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Blue_A_ORM.png", ::tex::gamma_linear), + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Blue_A_Normal.png", ::tex::gamma_linear)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticjerrican_a04/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/plasticjerrican_a04/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/plasticjerrican_a04/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a01/materials/PlasticPails_Black_A.mdl b/assets/objects/vomp/plasticpail_a01/materials/PlasticPails_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..b61acf73d4a56b571de7109612b9490302d5624a --- /dev/null +++ b/assets/objects/vomp/plasticpail_a01/materials/PlasticPails_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(0.042470627, 0.042470794, 0.04247105), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a01/materials/PlasticPails_White_A.mdl b/assets/objects/vomp/plasticpail_a01/materials/PlasticPails_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..3dc458de7448a20e645c6df7e28b76ad9b203eab --- /dev/null +++ b/assets/objects/vomp/plasticpail_a01/materials/PlasticPails_White_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(0.94593644, 0.94593996, 0.9459459), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a02/materials/Natural_Plastic_E.mdl b/assets/objects/vomp/plasticpail_a02/materials/Natural_Plastic_E.mdl new file mode 100644 index 0000000000000000000000000000000000000000..720c324b820731f7873a9d1abe45dc74bfa4b6cd --- /dev/null +++ b/assets/objects/vomp/plasticpail_a02/materials/Natural_Plastic_E.mdl @@ -0,0 +1,171 @@ +mdl 1.7; + +using m_mdl = "mdl"; + +import ::state::normal; +import ::OmniSurface::OmniImage::alpha_mode; +import ::OmniSurface::OmniImage::projection_mode; +import ::OmniSurface::OmniImage::tangent_bitangent_mapping; +import ::OmniSurface::OmniImage::wrap_mode; +import ::OmniSurface::OmniShared::displacement_mode; +import ::OmniSurface::OmniShared::emission_mode; +import ::OmniSurface::OmniShared::ior_presets; +import ::OmniSurface::OmniShared::scattering_colors_presets; +import ::OmniSurface::OmniSurface; +import ::base::texture_coordinate_system; +import ::tex::gamma_mode; + +export material Natural_Plastic_E(*) + = ::OmniSurface::OmniSurface( + diffuse_reflection_weight: 1.f, + diffuse_reflection_weight_image: texture_2d(), + diffuse_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + diffuse_reflection_color: color(1.f, 1.f, 1.f), + diffuse_reflection_color_image: texture_2d(), + diffuse_reflection_roughness: 0.f, + diffuse_reflection_roughness_image: texture_2d(), + diffuse_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + metalness: 0.049999997f, + metalness_image: texture_2d(), + metalness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_weight: 0.f, + specular_reflection_weight_image: texture_2d(), + specular_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_color: color(1.f, 1.f, 1.f), + specular_reflection_color_image: texture_2d(), + specular_reflection_roughness: 0.299999982f, + specular_reflection_roughness_image: texture_2d(), + specular_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_ior_preset: OmniSurface::OmniShared::ior_custom, + specular_reflection_ior: 2.f, + specular_reflection_anisotropy: 0.f, + specular_reflection_anisotropy_image: texture_2d(), + specular_reflection_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_anisotropy_rotation: 0.f, + specular_reflection_anisotropy_rotation_image: texture_2d(), + specular_reflection_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_specular_transmission: true, + specular_transmission_weight: 0.799999952f, + specular_transmission_weight_image: texture_2d(), + specular_transmission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_color: color(1.f, 1.f, 1.f), + specular_transmission_color_image: texture_2d(), + specular_transmission_scattering_depth: 0.f, + specular_transmission_scattering_depth_image: texture_2d(), + specular_transmission_scattering_depth_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_scattering_color: color(0.f, 0.f, 0.f), + specular_transmission_scattering_color_image: texture_2d(), + specular_transmission_scatter_anisotropy: 0.f, + specular_transmission_scatter_anisotropy_image: texture_2d(), + specular_transmission_scatter_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_dispersion_abbe: 0.f, + enable_diffuse_transmission: true, + subsurface_weight: 1.f, + subsurface_weight_image: texture_2d(), + subsurface_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_scattering_colors_preset: OmniSurface::OmniShared::scattering_colors_custom, + subsurface_transmission_color: color(1.f, 1.f, 1.f), + subsurface_transmission_color_image: texture_2d(), + subsurface_scattering_color: color(1.f, 1.f, 1.f), + subsurface_scattering_color_image: texture_2d(), + subsurface_scale: 1.f, + subsurface_scale_image: texture_2d(), + subsurface_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_anisotropy: 0.f, + subsurface_anisotropy_image: texture_2d(), + subsurface_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_weight: 1.f, + coat_weight_image: texture_2d(), + coat_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_color: color(1.f, 1.f, 1.f), + coat_color_image: texture_2d(), + coat_roughness: 0.299999982f, + coat_roughness_image: texture_2d(), + coat_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_ior_preset: OmniSurface::OmniShared::ior_custom, + coat_ior: 1.5f, + coat_anisotropy: 0.f, + coat_anisotropy_image: texture_2d(), + coat_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_anisotropy_rotation: 0.f, + coat_anisotropy_rotation_image: texture_2d(), + coat_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_color: 0.f, + coat_affect_color_image: texture_2d(), + coat_affect_color_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_roughness: 0.f, + coat_affect_roughness_image: texture_2d(), + coat_affect_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_normal_strength: 1.f, + coat_normal: state::normal(), + coat_normal_image: texture_2d(), + coat_normal_image_flip_r_channel: false, + coat_normal_image_flip_g_channel: false, + coat_normal_image_flip_b_channel: false, + specular_retro_reflection_weight: 0.699999988f, + specular_retro_reflection_weight_image: texture_2d(), + specular_retro_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_retro_reflection_color: color(1.f, 1.f, 1.f), + specular_retro_reflection_color_image: texture_2d(), + specular_retro_reflection_roughness: 0.300000012f, + specular_retro_reflection_roughness_image: texture_2d(), + specular_retro_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_weight: 0.f, + emission_weight_image: texture_2d(), + emission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_mode: OmniSurface::OmniShared::emission_lx, + emission_intensity: 1.f, + emission_intensity_image: texture_2d(), + emission_intensity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_color: color(1.f, 1.f, 1.f), + emission_color_image: texture_2d(), + emission_use_temperature: false, + emission_temperature: 6500.f, + emission_temperature_image: texture_2d(), + emission_temperature_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_thin_film: false, + thin_film_thickness: 400.f, + thin_film_thickness_image: texture_2d(), + thin_film_thickness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + thin_film_ior_preset: OmniSurface::OmniShared::ior_custom, + thin_film_ior: 1.5f, + thin_walled: false, + enable_opacity: false, + geometry_opacity: 1.f, + geometry_opacity_image: texture_2d(), + geometry_opacity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_opacity_threshold: 0.f, + geometry_normal_strength: 1.f, + geometry_normal: state::normal(), + geometry_normal_image: texture_2d(), + geometry_normal_image_flip_r_channel: false, + geometry_normal_image_flip_g_channel: false, + geometry_normal_image_flip_b_channel: false, + geometry_tangent_bitangent_mapping: OmniSurface::OmniImage::red_green, + geometry_displacement: float3(0.f), + geometry_displacement_mode: OmniSurface::OmniShared::displacement_height, + geometry_displacement_image: texture_2d(), + geometry_displacement_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scale: 1.f, + geometry_displacement_scale_image: texture_2d(), + geometry_displacement_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scalar_zero_value: 0.f, + uvw_texture_coordinate_system: base::texture_coordinate_uvw, + uvw_uv_set: 0, + uvw_ignore_missing_textures: false, + uvw_missing_texture_color: color(0.f, 0.f, 0.f), + uvw_use_uv_coords: false, + uvw_uv_coords: float2(0.f), + uvw_s_offset: 0.f, + uvw_t_offset: 0.f, + uvw_s_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_t_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_s_scale: 1.f, + uvw_t_scale: 1.f, + uvw_s_flip: false, + uvw_t_flip: false, + uvw_swap_st: false, + uvw_projection_mode: OmniSurface::OmniImage::projection_cubic, + uvw_projection_translate: float3(0.f), + uvw_projection_rotate: float3(0.f), + uvw_projection_scale: float3(1.f)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Black_A.mdl b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..b61acf73d4a56b571de7109612b9490302d5624a --- /dev/null +++ b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(0.042470627, 0.042470794, 0.04247105), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Blue_A.mdl b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Blue_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..8016934cb94a675d85da7939dd7c805c00c745fa --- /dev/null +++ b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Blue_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Blue_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.47999998927116394, + albedo_brightness: 0.05999999865889549, + diffuse_tint: color(0.03109675, 0.20356119, 0.5752896), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Green_A.mdl b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Green_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..bd1a00cc3bdb9cf056ebdb75a5b1a52b41fce9c6 --- /dev/null +++ b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Green_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Green_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.17999999225139618, + albedo_brightness: 1.0, + diffuse_tint: color(0.04668982, 0.22393823, 0.0740641), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Orange_A.mdl b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Orange_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2ba94972f3b8122cc2c8abd2295d4401b80f7e5d --- /dev/null +++ b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Orange_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Orange_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(0.9977, 0.49019, 0.3578), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Orange_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Orange_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Red_A.mdl b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Red_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..b5dfac31f1d986aae7c48c900b36b48987aa6c7a --- /dev/null +++ b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Red_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Red_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: -0.019999999552965164, + albedo_brightness: 1.0, + diffuse_tint: color(0.71724, 0.0, 0.0), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Violet_A.mdl b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Violet_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7d699f82da09b5e20ac6d0b03ba3ee5028b25224 --- /dev/null +++ b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Violet_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Violet_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.2199999988079071, + albedo_brightness: 1.0, + diffuse_tint: color(0.057592425, 0.042307068, 0.1660232), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_White_A.mdl b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..3dc458de7448a20e645c6df7e28b76ad9b203eab --- /dev/null +++ b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_White_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(0.94593644, 0.94593996, 0.9459459), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Yellow_A.mdl b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Yellow_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..fc4e2bff900c6e9940116d8b25fa13afd56cf975 --- /dev/null +++ b/assets/objects/vomp/plasticpail_a02/materials/PlasticPails_Yellow_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Yellow_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1.0, 0.85517, 0), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a02/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/plasticpail_a02/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/plasticpail_a02/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a02/materials/Plastic_Gray_A.mdl b/assets/objects/vomp/plasticpail_a02/materials/Plastic_Gray_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5b2fef2870b5ae447d1e98b4bb1fd657c5708c20 --- /dev/null +++ b/assets/objects/vomp/plasticpail_a02/materials/Plastic_Gray_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Gray_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Gray_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.05, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Gray_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Gray_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/plasticpail_a03/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/Natural_Plastic_E.mdl b/assets/objects/vomp/plasticpail_a03/materials/Natural_Plastic_E.mdl new file mode 100644 index 0000000000000000000000000000000000000000..720c324b820731f7873a9d1abe45dc74bfa4b6cd --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/Natural_Plastic_E.mdl @@ -0,0 +1,171 @@ +mdl 1.7; + +using m_mdl = "mdl"; + +import ::state::normal; +import ::OmniSurface::OmniImage::alpha_mode; +import ::OmniSurface::OmniImage::projection_mode; +import ::OmniSurface::OmniImage::tangent_bitangent_mapping; +import ::OmniSurface::OmniImage::wrap_mode; +import ::OmniSurface::OmniShared::displacement_mode; +import ::OmniSurface::OmniShared::emission_mode; +import ::OmniSurface::OmniShared::ior_presets; +import ::OmniSurface::OmniShared::scattering_colors_presets; +import ::OmniSurface::OmniSurface; +import ::base::texture_coordinate_system; +import ::tex::gamma_mode; + +export material Natural_Plastic_E(*) + = ::OmniSurface::OmniSurface( + diffuse_reflection_weight: 1.f, + diffuse_reflection_weight_image: texture_2d(), + diffuse_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + diffuse_reflection_color: color(1.f, 1.f, 1.f), + diffuse_reflection_color_image: texture_2d(), + diffuse_reflection_roughness: 0.f, + diffuse_reflection_roughness_image: texture_2d(), + diffuse_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + metalness: 0.049999997f, + metalness_image: texture_2d(), + metalness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_weight: 0.f, + specular_reflection_weight_image: texture_2d(), + specular_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_color: color(1.f, 1.f, 1.f), + specular_reflection_color_image: texture_2d(), + specular_reflection_roughness: 0.299999982f, + specular_reflection_roughness_image: texture_2d(), + specular_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_ior_preset: OmniSurface::OmniShared::ior_custom, + specular_reflection_ior: 2.f, + specular_reflection_anisotropy: 0.f, + specular_reflection_anisotropy_image: texture_2d(), + specular_reflection_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_anisotropy_rotation: 0.f, + specular_reflection_anisotropy_rotation_image: texture_2d(), + specular_reflection_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_specular_transmission: true, + specular_transmission_weight: 0.799999952f, + specular_transmission_weight_image: texture_2d(), + specular_transmission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_color: color(1.f, 1.f, 1.f), + specular_transmission_color_image: texture_2d(), + specular_transmission_scattering_depth: 0.f, + specular_transmission_scattering_depth_image: texture_2d(), + specular_transmission_scattering_depth_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_scattering_color: color(0.f, 0.f, 0.f), + specular_transmission_scattering_color_image: texture_2d(), + specular_transmission_scatter_anisotropy: 0.f, + specular_transmission_scatter_anisotropy_image: texture_2d(), + specular_transmission_scatter_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_dispersion_abbe: 0.f, + enable_diffuse_transmission: true, + subsurface_weight: 1.f, + subsurface_weight_image: texture_2d(), + subsurface_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_scattering_colors_preset: OmniSurface::OmniShared::scattering_colors_custom, + subsurface_transmission_color: color(1.f, 1.f, 1.f), + subsurface_transmission_color_image: texture_2d(), + subsurface_scattering_color: color(1.f, 1.f, 1.f), + subsurface_scattering_color_image: texture_2d(), + subsurface_scale: 1.f, + subsurface_scale_image: texture_2d(), + subsurface_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_anisotropy: 0.f, + subsurface_anisotropy_image: texture_2d(), + subsurface_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_weight: 1.f, + coat_weight_image: texture_2d(), + coat_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_color: color(1.f, 1.f, 1.f), + coat_color_image: texture_2d(), + coat_roughness: 0.299999982f, + coat_roughness_image: texture_2d(), + coat_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_ior_preset: OmniSurface::OmniShared::ior_custom, + coat_ior: 1.5f, + coat_anisotropy: 0.f, + coat_anisotropy_image: texture_2d(), + coat_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_anisotropy_rotation: 0.f, + coat_anisotropy_rotation_image: texture_2d(), + coat_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_color: 0.f, + coat_affect_color_image: texture_2d(), + coat_affect_color_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_roughness: 0.f, + coat_affect_roughness_image: texture_2d(), + coat_affect_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_normal_strength: 1.f, + coat_normal: state::normal(), + coat_normal_image: texture_2d(), + coat_normal_image_flip_r_channel: false, + coat_normal_image_flip_g_channel: false, + coat_normal_image_flip_b_channel: false, + specular_retro_reflection_weight: 0.699999988f, + specular_retro_reflection_weight_image: texture_2d(), + specular_retro_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_retro_reflection_color: color(1.f, 1.f, 1.f), + specular_retro_reflection_color_image: texture_2d(), + specular_retro_reflection_roughness: 0.300000012f, + specular_retro_reflection_roughness_image: texture_2d(), + specular_retro_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_weight: 0.f, + emission_weight_image: texture_2d(), + emission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_mode: OmniSurface::OmniShared::emission_lx, + emission_intensity: 1.f, + emission_intensity_image: texture_2d(), + emission_intensity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_color: color(1.f, 1.f, 1.f), + emission_color_image: texture_2d(), + emission_use_temperature: false, + emission_temperature: 6500.f, + emission_temperature_image: texture_2d(), + emission_temperature_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_thin_film: false, + thin_film_thickness: 400.f, + thin_film_thickness_image: texture_2d(), + thin_film_thickness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + thin_film_ior_preset: OmniSurface::OmniShared::ior_custom, + thin_film_ior: 1.5f, + thin_walled: false, + enable_opacity: false, + geometry_opacity: 1.f, + geometry_opacity_image: texture_2d(), + geometry_opacity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_opacity_threshold: 0.f, + geometry_normal_strength: 1.f, + geometry_normal: state::normal(), + geometry_normal_image: texture_2d(), + geometry_normal_image_flip_r_channel: false, + geometry_normal_image_flip_g_channel: false, + geometry_normal_image_flip_b_channel: false, + geometry_tangent_bitangent_mapping: OmniSurface::OmniImage::red_green, + geometry_displacement: float3(0.f), + geometry_displacement_mode: OmniSurface::OmniShared::displacement_height, + geometry_displacement_image: texture_2d(), + geometry_displacement_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scale: 1.f, + geometry_displacement_scale_image: texture_2d(), + geometry_displacement_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scalar_zero_value: 0.f, + uvw_texture_coordinate_system: base::texture_coordinate_uvw, + uvw_uv_set: 0, + uvw_ignore_missing_textures: false, + uvw_missing_texture_color: color(0.f, 0.f, 0.f), + uvw_use_uv_coords: false, + uvw_uv_coords: float2(0.f), + uvw_s_offset: 0.f, + uvw_t_offset: 0.f, + uvw_s_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_t_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_s_scale: 1.f, + uvw_t_scale: 1.f, + uvw_s_flip: false, + uvw_t_flip: false, + uvw_swap_st: false, + uvw_projection_mode: OmniSurface::OmniImage::projection_cubic, + uvw_projection_translate: float3(0.f), + uvw_projection_rotate: float3(0.f), + uvw_projection_scale: float3(1.f)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Black_A.mdl b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Black_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..b61acf73d4a56b571de7109612b9490302d5624a --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Black_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Black_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(0.042470627, 0.042470794, 0.04247105), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Blue_A.mdl b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Blue_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..8016934cb94a675d85da7939dd7c805c00c745fa --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Blue_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Blue_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.47999998927116394, + albedo_brightness: 0.05999999865889549, + diffuse_tint: color(0.03109675, 0.20356119, 0.5752896), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Green_A.mdl b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Green_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..bd1a00cc3bdb9cf056ebdb75a5b1a52b41fce9c6 --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Green_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Green_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.17999999225139618, + albedo_brightness: 1.0, + diffuse_tint: color(0.04668982, 0.22393823, 0.0740641), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Orange_A.mdl b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Orange_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2ba94972f3b8122cc2c8abd2295d4401b80f7e5d --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Orange_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Orange_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(0.9977, 0.49019, 0.3578), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Orange_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Orange_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Red_A.mdl b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Red_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..b5dfac31f1d986aae7c48c900b36b48987aa6c7a --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Red_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Red_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: -0.019999999552965164, + albedo_brightness: 1.0, + diffuse_tint: color(0.71724, 0.0, 0.0), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Violet_A.mdl b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Violet_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..7d699f82da09b5e20ac6d0b03ba3ee5028b25224 --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Violet_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Violet_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.2199999988079071, + albedo_brightness: 1.0, + diffuse_tint: color(0.057592425, 0.042307068, 0.1660232), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_White_A.mdl b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..3dc458de7448a20e645c6df7e28b76ad9b203eab --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_White_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(0.94593644, 0.94593996, 0.9459459), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Yellow_A.mdl b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Yellow_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..fc4e2bff900c6e9940116d8b25fa13afd56cf975 --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/PlasticPails_Yellow_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Yellow_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("./textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1.0, 0.85517, 0), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/plasticpail_a03/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plasticpail_a03/materials/Plastic_Gray_A.mdl b/assets/objects/vomp/plasticpail_a03/materials/Plastic_Gray_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5b2fef2870b5ae447d1e98b4bb1fd657c5708c20 --- /dev/null +++ b/assets/objects/vomp/plasticpail_a03/materials/Plastic_Gray_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Gray_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Gray_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.05, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Gray_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Gray_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/plate_large/materials/SimPBR.mdl b/assets/objects/vomp/plate_large/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/plate_large/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/plate_large/materials/SimPBR_Model.mdl b/assets/objects/vomp/plate_large/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/plate_large/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/plate_large/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/plate_large/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/plate_large/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/plate_large/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/plate_large/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/plate_large/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/plate_large/textures/Plates_Large_Metallic.png b/assets/objects/vomp/plate_large/textures/Plates_Large_Metallic.png new file mode 100644 index 0000000000000000000000000000000000000000..93c29b57993f6fc1b6f235b8607174a513e91eea Binary files /dev/null and b/assets/objects/vomp/plate_large/textures/Plates_Large_Metallic.png differ diff --git a/assets/objects/vomp/plate_small/materials/SimPBR.mdl b/assets/objects/vomp/plate_small/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/plate_small/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/plate_small/materials/SimPBR_Model.mdl b/assets/objects/vomp/plate_small/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/plate_small/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/plate_small/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/plate_small/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/plate_small/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/plate_small/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/plate_small/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/plate_small/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/plate_small/textures/Plates_Small_Metallic.png b/assets/objects/vomp/plate_small/textures/Plates_Small_Metallic.png new file mode 100644 index 0000000000000000000000000000000000000000..93c29b57993f6fc1b6f235b8607174a513e91eea Binary files /dev/null and b/assets/objects/vomp/plate_small/textures/Plates_Small_Metallic.png differ diff --git a/assets/objects/vomp/rack_l04/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/rack_l04/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..4c2cb532e7fd231f4bd106adadf4c035dfe14562 --- /dev/null +++ b/assets/objects/vomp/rack_l04/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/Metal_Glossy_A/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/Metal_Glossy_A/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/Metal_Glossy_A/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/rack_l04/materials/Metal_Painted_Green_A.mdl b/assets/objects/vomp/rack_l04/materials/Metal_Painted_Green_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..6651590e818164de38e08f2e2cb50e13b34abbe3 --- /dev/null +++ b/assets/objects/vomp/rack_l04/materials/Metal_Painted_Green_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Painted_Green_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/Metal_Painted_Green_A/T_Metal_Painted_Green_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/Metal_Painted_Green_A/T_Metal_Painted_Green_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/Metal_Painted_Green_A/T_Metal_Painted_Green_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(2, 2), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/rack_l04/materials/Metal_Painted_White_Rough_A.mdl b/assets/objects/vomp/rack_l04/materials/Metal_Painted_White_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..8ff431ef39686e8aa6b082715461207b53e3e8b1 --- /dev/null +++ b/assets/objects/vomp/rack_l04/materials/Metal_Painted_White_Rough_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Painted_White_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a01/materials/PlasticPails_Blue_A.mdl b/assets/objects/vomp/screwtoppail_a01/materials/PlasticPails_Blue_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..423e62d936f39e90bd71c719ff7e1ba919a15d67 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a01/materials/PlasticPails_Blue_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Blue_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.47999998927116394, + albedo_brightness: 0.05999999865889549, + diffuse_tint: color(0.03109675, 0.20356119, 0.5752896), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a01/materials/PlasticPails_Red_A.mdl b/assets/objects/vomp/screwtoppail_a01/materials/PlasticPails_Red_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..28493e669c44f30ed30cc649cb792902424b8778 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a01/materials/PlasticPails_Red_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Red_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: -0.019999999552965164, + albedo_brightness: 1.0, + diffuse_tint: color(0.71724, 0.0, 0.0), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a01/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/screwtoppail_a01/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a01/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a01/materials/Plastic_White_A.mdl b/assets/objects/vomp/screwtoppail_a01/materials/Plastic_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..9a5311ce69392acdff1353bbb153622c7c0ebae7 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a01/materials/Plastic_White_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_White_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a03/materials/PlasticPails_Blue_A.mdl b/assets/objects/vomp/screwtoppail_a03/materials/PlasticPails_Blue_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..423e62d936f39e90bd71c719ff7e1ba919a15d67 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a03/materials/PlasticPails_Blue_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Blue_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.47999998927116394, + albedo_brightness: 0.05999999865889549, + diffuse_tint: color(0.03109675, 0.20356119, 0.5752896), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a03/materials/PlasticPails_Red_A.mdl b/assets/objects/vomp/screwtoppail_a03/materials/PlasticPails_Red_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..28493e669c44f30ed30cc649cb792902424b8778 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a03/materials/PlasticPails_Red_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Red_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: -0.019999999552965164, + albedo_brightness: 1.0, + diffuse_tint: color(0.71724, 0.0, 0.0), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a03/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/screwtoppail_a03/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a03/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a03/materials/Plastic_White_A.mdl b/assets/objects/vomp/screwtoppail_a03/materials/Plastic_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..9a5311ce69392acdff1353bbb153622c7c0ebae7 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a03/materials/Plastic_White_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_White_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a04/materials/PlasticPails_Blue_A.mdl b/assets/objects/vomp/screwtoppail_a04/materials/PlasticPails_Blue_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..423e62d936f39e90bd71c719ff7e1ba919a15d67 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a04/materials/PlasticPails_Blue_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Blue_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.47999998927116394, + albedo_brightness: 0.05999999865889549, + diffuse_tint: color(0.03109675, 0.20356119, 0.5752896), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a04/materials/PlasticPails_Red_A.mdl b/assets/objects/vomp/screwtoppail_a04/materials/PlasticPails_Red_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..28493e669c44f30ed30cc649cb792902424b8778 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a04/materials/PlasticPails_Red_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material PlasticPails_Red_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T__WhiteTint_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: -0.019999999552965164, + albedo_brightness: 1.0, + diffuse_tint: color(0.71724, 0.0, 0.0), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 0.8499999642372131, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 0.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: false, + ORM_texture: texture_2d(), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d(), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a04/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/screwtoppail_a04/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a04/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/screwtoppail_a04/materials/Plastic_White_A.mdl b/assets/objects/vomp/screwtoppail_a04/materials/Plastic_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..9a5311ce69392acdff1353bbb153622c7c0ebae7 --- /dev/null +++ b/assets/objects/vomp/screwtoppail_a04/materials/Plastic_White_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_White_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/seahorn_vase/materials/SimPBR.mdl b/assets/objects/vomp/seahorn_vase/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/seahorn_vase/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/seahorn_vase/materials/SimPBR_Model.mdl b/assets/objects/vomp/seahorn_vase/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/seahorn_vase/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/seahorn_vase/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/seahorn_vase/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/seahorn_vase/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/seahorn_vase/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/seahorn_vase/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/seahorn_vase/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/serving_bowl/materials/SimPBR.mdl b/assets/objects/vomp/serving_bowl/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/serving_bowl/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/serving_bowl/materials/SimPBR_Model.mdl b/assets/objects/vomp/serving_bowl/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/serving_bowl/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/serving_bowl/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/serving_bowl/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/serving_bowl/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/serving_bowl/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/serving_bowl/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/serving_bowl/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/serving_bowl/textures/ServingBowl_metal.png b/assets/objects/vomp/serving_bowl/textures/ServingBowl_metal.png new file mode 100644 index 0000000000000000000000000000000000000000..93c29b57993f6fc1b6f235b8607174a513e91eea Binary files /dev/null and b/assets/objects/vomp/serving_bowl/textures/ServingBowl_metal.png differ diff --git a/assets/objects/vomp/sm_rack_m01/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/sm_rack_m01/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..4c2cb532e7fd231f4bd106adadf4c035dfe14562 --- /dev/null +++ b/assets/objects/vomp/sm_rack_m01/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/Metal_Glossy_A/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/Metal_Glossy_A/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/Metal_Glossy_A/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/sm_rack_m01/materials/Metal_Painted_Green_A.mdl b/assets/objects/vomp/sm_rack_m01/materials/Metal_Painted_Green_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..6651590e818164de38e08f2e2cb50e13b34abbe3 --- /dev/null +++ b/assets/objects/vomp/sm_rack_m01/materials/Metal_Painted_Green_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Painted_Green_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/Metal_Painted_Green_A/T_Metal_Painted_Green_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/Metal_Painted_Green_A/T_Metal_Painted_Green_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/Metal_Painted_Green_A/T_Metal_Painted_Green_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(2, 2), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/sm_rack_m01/materials/Metal_Painted_White_Rough_A.mdl b/assets/objects/vomp/sm_rack_m01/materials/Metal_Painted_White_Rough_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..8ff431ef39686e8aa6b082715461207b53e3e8b1 --- /dev/null +++ b/assets/objects/vomp/sm_rack_m01/materials/Metal_Painted_White_Rough_A.mdl @@ -0,0 +1,15 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Painted_White_Rough_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/Metal_Painted_White_Rough_A/T_Metal_Painted_White_Rough_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0); \ No newline at end of file diff --git a/assets/objects/vomp/sm_rack_m01/materials/Wood_Pressed_A.mdl b/assets/objects/vomp/sm_rack_m01/materials/Wood_Pressed_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..2c15e2e8514b7ba0dcda075c382333e24b493f28 --- /dev/null +++ b/assets/objects/vomp/sm_rack_m01/materials/Wood_Pressed_A.mdl @@ -0,0 +1,17 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Wood_Pressed_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/Wood_Pressed_A/T_Wood_Pressed_A1_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/Wood_Pressed_A/T_Wood_Pressed_A1_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/Wood_Pressed_A/T_Wood_Pressed_A1_ORM.png", ::tex::gamma_linear), + project_uvw: true, + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(0.045, 0.045)); \ No newline at end of file diff --git a/assets/objects/vomp/spatula_01/materials/SimPBR.mdl b/assets/objects/vomp/spatula_01/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/spatula_01/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/spatula_01/materials/SimPBR_Model.mdl b/assets/objects/vomp/spatula_01/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/spatula_01/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_01/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/spatula_01/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/spatula_01/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_01/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spatula_01/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spatula_01/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spatula_02/materials/SimPBR.mdl b/assets/objects/vomp/spatula_02/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/spatula_02/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/spatula_02/materials/SimPBR_Model.mdl b/assets/objects/vomp/spatula_02/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/spatula_02/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_02/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/spatula_02/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/spatula_02/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_02/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spatula_02/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spatula_02/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spatula_03/materials/SimPBR.mdl b/assets/objects/vomp/spatula_03/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/spatula_03/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/spatula_03/materials/SimPBR_Model.mdl b/assets/objects/vomp/spatula_03/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/spatula_03/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_03/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/spatula_03/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/spatula_03/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_03/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spatula_03/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spatula_03/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spatula_04/materials/SimPBR.mdl b/assets/objects/vomp/spatula_04/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/spatula_04/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/spatula_04/materials/SimPBR_Model.mdl b/assets/objects/vomp/spatula_04/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/spatula_04/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_04/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/spatula_04/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/spatula_04/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_04/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spatula_04/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spatula_04/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spatula_05/materials/SimPBR.mdl b/assets/objects/vomp/spatula_05/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/spatula_05/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/spatula_05/materials/SimPBR_Model.mdl b/assets/objects/vomp/spatula_05/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/spatula_05/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_05/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/spatula_05/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/spatula_05/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_05/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spatula_05/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spatula_05/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spatula_06/materials/SimPBR.mdl b/assets/objects/vomp/spatula_06/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/spatula_06/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/spatula_06/materials/SimPBR_Model.mdl b/assets/objects/vomp/spatula_06/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/spatula_06/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_06/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/spatula_06/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/spatula_06/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_06/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spatula_06/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spatula_06/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spatula_07/materials/SimPBR.mdl b/assets/objects/vomp/spatula_07/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/spatula_07/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/spatula_07/materials/SimPBR_Model.mdl b/assets/objects/vomp/spatula_07/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/spatula_07/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_07/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/spatula_07/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/spatula_07/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_07/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spatula_07/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spatula_07/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spatula_09/materials/SimPBR.mdl b/assets/objects/vomp/spatula_09/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/spatula_09/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/spatula_09/materials/SimPBR_Model.mdl b/assets/objects/vomp/spatula_09/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/spatula_09/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_09/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/spatula_09/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/spatula_09/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_09/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spatula_09/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spatula_09/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spatula_09/textures/Spatulas_Set02_Opacity.png b/assets/objects/vomp/spatula_09/textures/Spatulas_Set02_Opacity.png new file mode 100644 index 0000000000000000000000000000000000000000..776aabedf22973ce066a9728e1d4a2e65365db5d Binary files /dev/null and b/assets/objects/vomp/spatula_09/textures/Spatulas_Set02_Opacity.png differ diff --git a/assets/objects/vomp/spatula_10/materials/SimPBR.mdl b/assets/objects/vomp/spatula_10/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/spatula_10/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/spatula_10/materials/SimPBR_Model.mdl b/assets/objects/vomp/spatula_10/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/spatula_10/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_10/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/spatula_10/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/spatula_10/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_10/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spatula_10/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spatula_10/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spatula_10/textures/Spatulas_Set02_Opacity.png b/assets/objects/vomp/spatula_10/textures/Spatulas_Set02_Opacity.png new file mode 100644 index 0000000000000000000000000000000000000000..776aabedf22973ce066a9728e1d4a2e65365db5d Binary files /dev/null and b/assets/objects/vomp/spatula_10/textures/Spatulas_Set02_Opacity.png differ diff --git a/assets/objects/vomp/spatula_11/materials/SimPBR.mdl b/assets/objects/vomp/spatula_11/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/spatula_11/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/spatula_11/materials/SimPBR_Model.mdl b/assets/objects/vomp/spatula_11/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/spatula_11/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_11/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/spatula_11/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/spatula_11/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/spatula_11/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spatula_11/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spatula_11/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spatula_11/textures/Spatulas_Set02_Opacity.png b/assets/objects/vomp/spatula_11/textures/Spatulas_Set02_Opacity.png new file mode 100644 index 0000000000000000000000000000000000000000..776aabedf22973ce066a9728e1d4a2e65365db5d Binary files /dev/null and b/assets/objects/vomp/spatula_11/textures/Spatulas_Set02_Opacity.png differ diff --git a/assets/objects/vomp/spatula_16/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spatula_16/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spatula_16/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spatula_16/textures/Spatulas_Set02_Opacity.png b/assets/objects/vomp/spatula_16/textures/Spatulas_Set02_Opacity.png new file mode 100644 index 0000000000000000000000000000000000000000..776aabedf22973ce066a9728e1d4a2e65365db5d Binary files /dev/null and b/assets/objects/vomp/spatula_16/textures/Spatulas_Set02_Opacity.png differ diff --git a/assets/objects/vomp/spoon_big/materials/SimPBR.mdl b/assets/objects/vomp/spoon_big/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/spoon_big/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/spoon_big/materials/SimPBR_Model.mdl b/assets/objects/vomp/spoon_big/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/spoon_big/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/spoon_big/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/spoon_big/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/spoon_big/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/spoon_big/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/spoon_big/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/spoon_big/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/spoon_big/textures/Spoon_Big_BaseColor.png b/assets/objects/vomp/spoon_big/textures/Spoon_Big_BaseColor.png new file mode 100644 index 0000000000000000000000000000000000000000..0a0b3e581106ecd40d20e3b9ab1ff1dc034341ae Binary files /dev/null and b/assets/objects/vomp/spoon_big/textures/Spoon_Big_BaseColor.png differ diff --git a/assets/objects/vomp/spoon_big/textures/Spoon_Big_Metallic.png b/assets/objects/vomp/spoon_big/textures/Spoon_Big_Metallic.png new file mode 100644 index 0000000000000000000000000000000000000000..2c9753944df3c23d1f0814c3a509302fdcece6a1 Binary files /dev/null and b/assets/objects/vomp/spoon_big/textures/Spoon_Big_Metallic.png differ diff --git a/assets/objects/vomp/spoon_big/textures/Spoon_Big_Normal.png b/assets/objects/vomp/spoon_big/textures/Spoon_Big_Normal.png new file mode 100644 index 0000000000000000000000000000000000000000..76d6e68f742935f2761b6bb59a4966217d206786 Binary files /dev/null and b/assets/objects/vomp/spoon_big/textures/Spoon_Big_Normal.png differ diff --git a/assets/objects/vomp/squarepail_a01/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/squarepail_a01/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/squarepail_a01/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/squarepail_a01/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/squarepail_a01/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/squarepail_a01/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/utilitybucket_a01/materials/Metal_Glossy_A.mdl b/assets/objects/vomp/utilitybucket_a01/materials/Metal_Glossy_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..a0055fbb8cda5c91a10c30f92a6f80c495ac79ef --- /dev/null +++ b/assets/objects/vomp/utilitybucket_a01/materials/Metal_Glossy_A.mdl @@ -0,0 +1,16 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Metal_Glossy_A(*) + = OmniPBR( + diffuse_texture: texture_2d("../textures/T_Metal_Glossy_A_Albedo.png", ::tex::gamma_srgb), + enable_ORM_texture: true, + metallic_texture_influence: 1.0, + normalmap_texture: texture_2d("../textures/T_Metal_Glossy_A_Normal.png", ::tex::gamma_linear), + ORM_texture: texture_2d("../textures/T_Metal_Glossy_A_ORM.png", ::tex::gamma_linear), + reflection_roughness_texture_influence: 1.0, + texture_scale: float2(2, 2)); \ No newline at end of file diff --git a/assets/objects/vomp/utilitybucket_a01/materials/Plastic_Gray_A.mdl b/assets/objects/vomp/utilitybucket_a01/materials/Plastic_Gray_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5b2fef2870b5ae447d1e98b4bb1fd657c5708c20 --- /dev/null +++ b/assets/objects/vomp/utilitybucket_a01/materials/Plastic_Gray_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Gray_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Gray_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.05, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Gray_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Gray_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/utilitybucket_a01/materials/Plastic_Red_A.mdl b/assets/objects/vomp/utilitybucket_a01/materials/Plastic_Red_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..e9e955c83284bef5ba7a3299aa5bd71ca008d252 --- /dev/null +++ b/assets/objects/vomp/utilitybucket_a01/materials/Plastic_Red_A.mdl @@ -0,0 +1,52 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Red_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Red_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_constant: 0.5, + reflection_roughness_texture_influence: 1.0, + reflectionroughness_texture: texture_2d(), + metallic_constant: 0.0, + metallic_texture_influence: 1.0, + metallic_texture: texture_2d(), + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Red_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + emissive_color: color(1, 0.1, 0.1), + emissive_color_texture: texture_2d(), + emissive_mask_texture: texture_2d(), + emissive_intensity: 40.0, + enable_opacity: false, + enable_opacity_texture: false, + opacity_constant: 1.0, + opacity_texture: texture_2d(), + opacity_mode: ::base::mono_average, + opacity_threshold: 0.0, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Red_A_Normal.png", ::tex::gamma_linear), + detail_bump_factor: 0.30000001192092896, + detail_normalmap_texture: texture_2d(), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(3, 3), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/utilitybucket_a01/materials/SimPBR.mdl b/assets/objects/vomp/utilitybucket_a01/materials/SimPBR.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5883146f569e93208db72c08a810b7d71eaeece7 --- /dev/null +++ b/assets/objects/vomp/utilitybucket_a01/materials/SimPBR.mdl @@ -0,0 +1,562 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + + +using .::SimPBR_Model import *; +using .::baking_annotations import *; + +export material SimPBR( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + uniform bool enable_transmission = false + [[ + anno::display_name("Enable Diffuse Transmission"), + anno::description("Enables the diffuse transmission of light through thin diffuse scattering layer"), + anno::in_group("Diffuse") + ]], + uniform float opacity_ratio = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Opacity Ratio"), + anno::description("Amount of opacity"), + anno::in_group("Diffuse") + ]], + uniform color opacity_tint = color(1.0f) + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission tint"), + anno::description("Base diffuse transmission color"), + anno::in_group("Diffuse") + ]], + uniform float opacity_multiplier = 1.f + [[ + anno::enable_if("enable_transmission == true"), + anno::display_name("Diffuse transmission multiplier"), + anno::description("Base diffuse transmission multiplier"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + float specular_constant = 1.f + [[ + anno::display_name("Specular amount"), + anno::hard_range(0.0, 1.0), + anno::description("Scale of the specular component"), + anno::in_group("Specular") + ]], + uniform texture_2d specular_texture = texture_2d() + [[ + anno::display_name("Specular Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + + float3 clearcoat_normal_input = float3(0.0, 0.0, 0.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") + ]], + + uniform bool clearcoat_flip_tangent_u = false + [[ + anno::display_name("Clearcoat Normal Map Flip U Tangent"), + anno::in_group("Clearcoat") + ]], + uniform bool clearcoat_flip_tangent_v = true + [[ + anno::display_name("Clearcoat Normal Map Flip V Tangent"), + anno::in_group("Clearcoat") + ]], + + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_tint = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection tint"), + anno::description("The tint of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + float ao_input = 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + + color emissive_mask_input = color(1.0), + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_opacity = false + [[ + anno::display_name("Enable Opacity"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + float alpha_constant = 1.0 + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Fallback Constant"), + anno::hard_range(0.0, 1.0), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_opacity_cutout = false + [[ + anno::enable_if("enable_opacity == true"), + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_opacity == true"), + anno::enable_if("enable_opacity_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + + float3 normal_input = state::normal(), + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_u = false + [[ + anno::display_name("Normal Map Flip U Tangent"), + anno::description("Flips the U Tangent vector."), + anno::in_group("Normal") + ]], + uniform bool flip_tangent_v = true + [[ + anno::display_name("Normal Map Flip V Tangent"), + anno::description("Flips the V Tangent vector. By Default, SimPBR materials setup for DirectX normal maps. Set Normal Map Flip V = false for OpenGL."), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + 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") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? tex::lookup_float4(tex: diffuse_texture, coord: uv) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? tex::lookup_float4(tex: opacity_texture, coord: uv).w : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : normal_input; + + float3 clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? + base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw, + flip_tangent_u: clearcoat_flip_tangent_u, + flip_tangent_v: clearcoat_flip_tangent_v + ) : clearcoat_normal_input; + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? tex::lookup_float4(tex: ao_texture, coord: uv).x : ao_input; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (tex::lookup_float4(tex: anisotropy_texture, coord: uv).x * 2.0f - 1.0f) : anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + tex::lookup_float4(tex: metallic_texture, coord: uv).x : metallic_constant; + float specular_lookup = tex::texture_isvalid(specular_texture) ? + tex::lookup_float4(tex: specular_texture, coord: uv).x : specular_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + float ao = enable_ORM_texture ? ORM_lookup.x : ao_lookup; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : emissive_mask_input; + +} in SimPBR_Model( + diffuse_color: diffuse_color, + diffuse_tint: diffuse_tint, + roughness: reflection_roughness, + anisotropy: anisotropy, + metallic: metallic, + specular: specular_lookup, + normal: normal_lookup, + enable_clearcoat: enable_clearcoat, + clearcoat_tint: clearcoat_tint, + clearcoat_transparency: clearcoat_transparency, + clearcoat_reflection_roughness: clearcoat_reflection_roughness, + clearcoat_weight: clearcoat_weight, + clearcoat_ior: clearcoat_ior, + clearcoat_normal: final_clearcoat_normal, + enable_retroreflection: enable_retroreflection, + retroreflection_tint: retroreflection_tint, + normal_reflectivity: normal_reflectivity, + grazing_reflectivity: grazing_reflectivity, + ao_to_diffuse: ao_to_diffuse, + ao: ao, + enable_emission: enable_emission, + emissive_color: emissive_color, + emissive_mask: emissive_mask, + emissive_intensity: emissive_intensity, + enable_opacity: enable_opacity, + alpha: opacityValue, + enable_opacity_cutout: enable_opacity_cutout, + alpha_cutout_cutoff: alpha_cutout_cutoff, + opacity_ratio: enable_transmission ? opacity_ratio : 1.0, + opacity_tint : opacity_tint, + opacity_multiplier : opacity_multiplier +); diff --git a/assets/objects/vomp/utilitybucket_a01/materials/SimPBR_Model.mdl b/assets/objects/vomp/utilitybucket_a01/materials/SimPBR_Model.mdl new file mode 100644 index 0000000000000000000000000000000000000000..dccd3808942cb243a4e03f77f684935081b31ec5 --- /dev/null +++ b/assets/objects/vomp/utilitybucket_a01/materials/SimPBR_Model.mdl @@ -0,0 +1,212 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +using .::baking_annotations import *; + +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 + ); +} + +export material SimPBR_Model( + color diffuse_color = color(0.2f) [[ target_baked_argument("diffuse_texture", "diffuse_color_constant", "RGBA8_UNORM") ]], + uniform color diffuse_tint = color(1.0f), + float roughness = 0.5f [[ target_baked_argument("reflectionroughness_texture", "reflection_roughness_constant", "R8_UNORM") ]], + float anisotropy = 0.0f [[ target_baked_argument("anisotropy_texture", "anisotropy_constant", "R8_SNORM") ]], + float metallic = 0.f [[ target_baked_argument("metallic_texture", "metallic_constant", "R8_UNORM") ]], + float specular = 1.f [[ target_baked_argument("specular_texture", "specular_constant", "R8_UNORM") ]], + float3 normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("normalmap_texture", "normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_clearcoat = false, + color clearcoat_tint = color(1.0f), + float clearcoat_transparency = 1.0f, + float clearcoat_reflection_roughness = 0.0f, + float clearcoat_weight = 1.0f, + float clearcoat_ior = 1.56f, + float3 clearcoat_normal = float3(0.0, 0.0, 0.0) [[ target_baked_argument("clearcoat_normalmap_texture", "clearcoat_normal_input", "RGBA8_SNORM", baking_annotations::TRANSFORM_UNORM_VECTOR) ]], + uniform bool enable_retroreflection = false, + color retroreflection_tint = color(.182,.800,.000), + uniform float normal_reflectivity = 0.5, + uniform float grazing_reflectivity = 1.0, + float ao_to_diffuse = 0.0, + float ao = 1.0f [[ target_baked_argument("ao_texture", "ao_input", "R8_UNORM") ]], + uniform bool enable_emission = false, + uniform color emissive_color = color(1.0, 0.1, 0.1), + color emissive_mask = color(1.0, 0.1, 0.1) [[ target_baked_argument("emissive_mask_texture", "emissive_mask_input", "R8_UNORM") ]], + uniform float emissive_intensity = 40.f, + uniform bool enable_opacity = false, + float alpha = 1.0, + uniform bool enable_opacity_cutout = false, + uniform float alpha_cutout_cutoff = 1.f, + uniform float opacity_ratio = 1.f, + uniform color opacity_tint = color(1.0f), + uniform float opacity_multiplier = 1.f +) +[[ + target_material_model(), + target_material_rendering("..::SimPBR::SimPBR") +]] + = let { + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + color ao_weighted_base_color = multiply_colors(base_color, color(ao), ao_to_diffuse).tint; + + float squared_roughness = roughness * roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + color diffuse_transmission_color = base_color * opacity_tint * opacity_multiplier; + + bsdf diffuse_bsdf = df::weighted_layer( + weight: opacity_ratio, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.0f + ), + base: df::diffuse_transmission_bsdf(tint: diffuse_transmission_color), + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: specular, + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + color final_retroreflection_color = multiply_colors(retroreflection_tint, base_color, 1.0).tint; + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: final_retroreflection_color, + roughness_u: squared_roughness + ); + + /*bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + );*/ + + // if normal_reflectivity and grazing_reflectivity are 1 and weight is 1, just the layer is used + bsdf opt_retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: enable_retroreflection ? 1.-normal_reflectivity : 1, + grazing_reflectivity: enable_retroreflection ? 1.-grazing_reflectivity : 1, + base: backscattering_glossy_bsdf, + layer: custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: opt_retroreflection_bsdf, //enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opt_opaque_clearcoat = df::weighted_layer( + weight: enable_clearcoat ? clearcoat_transparency : 1, + layer: ::df::tint(tint: enable_clearcoat ? clearcoat_tint : color(1), base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf(tint: clearcoat_tint) + ); + + bsdf opt_omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: enable_clearcoat ? clearcoat_weight : 0, + layer: clearcoat_bsdf, + base: opt_opaque_clearcoat, + normal: clearcoat_normal + ); + + bsdf final_bsdf = opt_omni_PBR_coated_bsdf; +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal, + cutout_opacity: enable_opacity ? (enable_opacity_cutout ? (alpha < alpha_cutout_cutoff ? 0.0 : 1.0) : alpha) : 1.0 + ) +); diff --git a/assets/objects/vomp/utilitybucket_a01/materials/SimPBR_Opacity.mdl b/assets/objects/vomp/utilitybucket_a01/materials/SimPBR_Opacity.mdl new file mode 100644 index 0000000000000000000000000000000000000000..cf0a3ba759fc0b873d174b410b31759b1d426307 --- /dev/null +++ b/assets/objects/vomp/utilitybucket_a01/materials/SimPBR_Opacity.mdl @@ -0,0 +1,651 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +float4 raw_file_texture( + uniform texture_2d texture + [[ anno::description("The input texture") ]], + base::texture_coordinate_info uvw = base::texture_coordinate_info() + [[ anno::description("Custom value for texture coordinate") ]], + 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") ]] +) +[[ + anno::description("General texturing function for 2D bitmap texture stored in a file"), + anno::noinline() +]] +{ + return tex::lookup_float4(texture, float2(uvw.position.x, uvw.position.y), wrap_u, wrap_v, crop_u, crop_v); +} + +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 + ); +} + +base::texture_return add_colors( + color color_1 = color(.5, .5, .5), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_add + )), + base: color_1 + ); +} + +base::texture_return blend_colors( + color color_1 = color(1.0, 1.0, 1.0), + color color_2 = color(.5, .5, .5), + float weight = 1.0 +) [[ + anno::hidden(), + anno::unused() +]] +{ + return base::blend_color_layers( + layers: base::color_layer[]( + base::color_layer( + layer_color: color_2, + weight: weight, + mode: base::color_layer_blend + )), + base: color_1 + ); +} + +export material SimPBR_Opacity( + // -------------------- DIFFUSE REFLECTION ---------------------- + uniform color diffuse_color_constant = color(0.2f) + [[ + anno::display_name("Albedo Base Color"), + anno::description("The base albedo color to use if no texture is specified"), + anno::in_group("Diffuse") + ]], + uniform texture_2d diffuse_texture = texture_2d() + [[ + anno::display_name("Albedo Map"), + anno::description("The texture specifying the albedo value to use"), + anno::in_group("Diffuse") + ]], + uniform color diffuse_tint = color(1.0f) + [[ + anno::display_name("Albedo Tint"), + anno::description("This tints the albedo color or texture contant"), + anno::in_group("Diffuse") + ]], + + // -------------------- SPECULAR REFLECTION ---------------------- + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + uniform float anisotropy_constant = 0.0f + [[ + anno::display_name("Anisotropy Amount"), + anno::hard_range(-1.,1.), + anno::description("0 for isotropic, extents of -1 to 1 for anisotropy"), + anno::in_group("Specular") + ]], + uniform float anisotropy_texture_influence = 0.0f + [[ + anno::display_name("Anisotropy Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the anisotropy texture"), + anno::in_group("Specular") + ]], + uniform texture_2d anisotropy_texture = texture_2d() + [[ + anno::display_name("Anisotropy Map"), + anno::in_group("Specular") + ]], + + uniform float metallic_constant = 0.f + [[ + anno::display_name("Metallic Amount"), + anno::hard_range(0.0,1.), + anno::description("Metallic Material"), + anno::in_group("Specular") + ]], + uniform float metallic_texture_influence = 0.0f + [[ + anno::display_name("Metallic Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the metallic texture"), + anno::in_group("Specular") + ]], + uniform texture_2d metallic_texture = texture_2d() + [[ + anno::display_name("Metallic Map"), + anno::in_group("Specular") + ]], + + // -------------------- ORM ---------------------- + uniform bool enable_ORM_texture = true + [[ + anno::display_name("Enable ORM Texture"), + anno::description("When True the ORM texture will be used to extract the Occlusion, Roughness and Metallic Map"), + anno::in_group("Reflectivity") + ]], + uniform texture_2d ORM_texture = texture_2d() + [[ + anno::display_name("ORM Map"), + anno::description("Texture that hae Occlusion, Roughness and Metallic map stored in the respective r, g and b channels"), + anno::in_group("Reflectivity") + ]], + + // -------------------- 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") + ]], + color clearcoat_tint = color(1.0f) + [[ + anno::display_name("Clearcoat Tint"), + anno::description("Clearcoat is tinted and affects the underlying material"), + anno::in_group("Clearcoat") + ]], + float clearcoat_transparency = 1.0f + [[ + 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") + ]], + float clearcoat_reflection_roughness = 0.0f + [[ + anno::display_name("Clearcoat Roughness"), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_weight = 1.0f + [[ + anno::display_name("Clearcoat Weight"), + anno::description("Sets the weight for clearcoat layer"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_flatten = 1.0f + [[ + anno::display_name("Clearcoat Flatten"), + anno::description("Flattens the clearcoat to even out the underlying bump maps"), + anno::hard_range(0.0f, 1.0f), + anno::in_group("Clearcoat") + ]], + float clearcoat_ior = 1.56f + [[ + anno::display_name("Clearcoat IOR"), + anno::description("Sets the Index of refraction for the clearcoat layer"), + anno::soft_range(1.0f, 4.0f), + anno::in_group("Clearcoat") + ]], + uniform float clearcoat_bump_factor = 1.f + [[ + anno::display_name("Clearcoat Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Clearcoat") + ]], + 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") + ]], + + // -------------------- REFLECTIVITY ---------------------- + uniform bool enable_retroreflection = false + [[ + anno::display_name("Enable Retroreflection"), + anno::in_group("Reflectivity") + ]], + color retroreflection_color = color(.182,.800,.000) + [[ + anno::display_name("Retro-reflection color"), + anno::description("The color of the retroreflection"), + anno::in_group("Reflectivity") + ]], + uniform float normal_reflectivity = 0.5 + [[ + anno::display_name("Retro-reflection weight facing"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for geometry facing the viewer"), + anno::in_group("Reflectivity") + ]], + uniform float grazing_reflectivity = 1.0 + [[ + anno::display_name("Retro-reflection weight edge"), + anno::hard_range(0.0,1.), + anno::description("Reflectivity control for the reflectivity at geometry edges"), + anno::in_group("Reflectivity") + ]], + + // -------------------- AMBIENT OCCLUSION ---------------------- + float ao_to_diffuse = 0.0 + [[ + anno::display_name("AO to Diffuse"), + anno::description("Controls the amount of ambient occlusion multiplied into the diffuse color channel"), + anno::in_group("AO") + ]], + 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") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_emission = false + [[ + anno::display_name("Enable Emission"), + anno::description("Enables the emission of light from the material"), + anno::in_group("Emissive") + ]], + uniform color emissive_color = color(1.0, 0.1, 0.1) + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- ALPHA ---------------------- + uniform bool enable_alpha = true + [[ + anno::display_name("Enable Alpha"), + anno::description("Enables or disables alpha functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_constant = 1.0 + [[ + anno::display_name("Alpha Fallback Constant"), + anno::description("The base alpha constant to use if no texture is specified"), + anno::in_group("Alpha") + ]], + uniform texture_2d opacity_texture = texture_2d() + [[ + anno::display_name("Opacity Map"), + anno::description("The texture specifying the opacity value to use"), + anno::in_group("Alpha") + ]], + uniform bool enable_alpha_cutout = false + [[ + anno::display_name("Enable Alpha Cutout"), + anno::description("Enables or disables alpha cutout functionality"), + anno::in_group("Alpha") + ]], + uniform float alpha_cutout_cutoff = 1.f + [[ + anno::enable_if("enable_alpha_cutout == true"), + anno::hard_range(0.0, 1.0), + anno::display_name("Alpha Cutout Cutoff"), + anno::description("The cutoff value to to render as transparent up to and opaque past"), + anno::in_group("Alpha") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + anno::in_group("Normal") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Scale"), + anno::description("Larger number increases size of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Opaque Alpha Cutout"), + anno::description("Supports the opaque alpha cutout material model of the Sim Renderer"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "opaque", "alpha", "cutout", "omniverse", "generic")) +]] + = let { + + 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: 0, + projection_type: base::projection_cubic ) : + base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw ); + + // Diffuse Color Lookup and AO + float4 base_lookup = tex::texture_isvalid(diffuse_texture) ? raw_file_texture(texture: diffuse_texture, uvw: transformed_uvw) : float4(1, 1, 1, 1); + + float opacityValue = tex::texture_isvalid(opacity_texture) ? raw_file_texture(texture: opacity_texture, uvw: transformed_uvw).x : alpha_constant; + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw + ) : state::normal(); + + float3 clearcoat_normal = base::tangent_space_normal_texture( + texture: clearcoat_normalmap_texture, + factor: clearcoat_bump_factor, + uvw: uvw + ); + + float3 flattened_clearcoat_normal = ::math::lerp(normal_lookup, ::state::normal(), clearcoat_flatten); + float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? clearcoat_normal : flattened_clearcoat_normal; + + float ao_lookup = tex::texture_isvalid(ao_texture) ? + raw_file_texture(texture: ao_texture, uvw: transformed_uvw).x : + 1.0f + [[anno::unused("Currently unused in material, may be utilized in the future")]]; + + color diffuse_color = tex::texture_isvalid(diffuse_texture) ? color(base_lookup.x, base_lookup.y, base_lookup.z) : diffuse_color_constant; + color base_color = multiply_colors(diffuse_color, diffuse_tint, 1.0).tint; + + float3 ORM_lookup = tex::lookup_float3( + tex: ORM_texture, + coord: float2(transformed_uvw.position.x, transformed_uvw.position.y) + ); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + raw_file_texture(texture: reflectionroughness_texture, uvw: transformed_uvw).x : + reflection_roughness_constant; + float anisotropy_lookup = tex::texture_isvalid(anisotropy_texture) ? + (raw_file_texture(texture: anisotropy_texture, uvw: transformed_uvw).x * 2.0f - 1.0f) : + anisotropy_constant; + float metallic_lookup = tex::texture_isvalid(metallic_texture) ? + raw_file_texture(texture: metallic_texture, uvw: transformed_uvw).x : + metallic_constant; + + float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup; + float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup; + color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : color(ao_lookup); + + color ao_weighted_base_color = multiply_colors(base_color, ao_color, ao_to_diffuse).tint; + + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence); + float anisotropy = math::lerp(anisotropy_constant, anisotropy_lookup, anisotropy_texture_influence); + float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence); + + float squared_roughness = reflection_roughness * reflection_roughness; + float roughness_u = squared_roughness * (1 + anisotropy); + float roughness_v = squared_roughness * (1 - anisotropy); + + bsdf diffuse_bsdf = df::weighted_layer( + weight: 1.0, + layer: df::diffuse_reflection_bsdf( + tint: ao_weighted_base_color, + roughness: 0.f ), + base: bsdf(), + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: roughness_u, + roughness_v: roughness_v, + tint: color(1.0, 1.0, 1.0), + mode: df::scatter_reflect + ); + + bsdf custom_curve_layer_bsdf = df::custom_curve_layer( + normal_reflectivity: 0.03, + grazing_reflectivity: 1.0, + exponent: 5.0, + weight: float(1.0), + layer: ggx_smith_bsdf, + base: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // Begin RETROREFLECTION SUPPORT + // + bsdf backscattering_glossy_bsdf = df::backscattering_glossy_reflection_bsdf( + tint: retroreflection_color, + roughness_u: reflection_roughness * reflection_roughness + ); + + bsdf retroreflection_bsdf = df::custom_curve_layer( + normal_reflectivity: 1.-normal_reflectivity, + grazing_reflectivity: 1.-grazing_reflectivity, + base: backscattering_glossy_bsdf, + layer: diffuse_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + // + // End RETROREFLECTION SUPPORT + // + + bsdf directional_factor_bsdf = df::directional_factor( + normal_tint: ao_weighted_base_color, + grazing_tint: color(1.0, 1.0, 1.0), + exponent: 5.0f, + base: ggx_smith_bsdf + ); + + // CLEARCOAT + + bsdf omni_PBR_bsdf = df::weighted_layer( + weight: metallic, + layer: directional_factor_bsdf, + base: enable_retroreflection ? retroreflection_bsdf : custom_curve_layer_bsdf, + normal: enable_clearcoat ? normal_lookup : state::normal() + ); + + bsdf clearcoat_bsdf = df::microfacet_ggx_smith_bsdf( + roughness_u: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + roughness_v: clearcoat_reflection_roughness * clearcoat_reflection_roughness, + tint: color(1.0f), + mode: df::scatter_reflect + ); + + // bsdf omni_PBR_coated_bsdf = df::custom_curve_layer( + // normal_reflectivity: clearcoat_reflectivity * 0.08, + // grazing_reflectivity: 1.0, + // weight: clearcoat_weight, + // layer: clearcoat_bsdf, + // base: omni_PBR_bsdf, + // normal: final_clearcoat_normal + // ); + + bsdf opaque_clearcoat = df::weighted_layer( + weight: clearcoat_transparency, + layer: ::df::tint( + tint: clearcoat_tint, + base: omni_PBR_bsdf), + base: ::df::diffuse_reflection_bsdf( + tint: clearcoat_tint) + ); + + bsdf omni_PBR_coated_bsdf = df::fresnel_layer( + ior: clearcoat_ior, + weight: clearcoat_weight, + layer: clearcoat_bsdf, + base: opaque_clearcoat, + normal: final_clearcoat_normal + ); + + + bsdf final_bsdf = enable_clearcoat ? omni_PBR_coated_bsdf : omni_PBR_bsdf; + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook + ? ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) + : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) + ? tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) + : color(1.0); + +} in material( + thin_walled: false, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + geometry: material_geometry( + normal: enable_clearcoat ? state::normal() : normal_lookup, + cutout_opacity: enable_alpha ? (enable_alpha_cutout ? (opacityValue < alpha_cutout_cutoff ? 0.0 : 1.0) : opacityValue) : 1.0 + ) +); diff --git a/assets/objects/vomp/utilitybucket_a01/materials/SimPBR_Translucent.mdl b/assets/objects/vomp/utilitybucket_a01/materials/SimPBR_Translucent.mdl new file mode 100644 index 0000000000000000000000000000000000000000..5a60a90d1b946f94c266dabd515d5a15b6c3c9bd --- /dev/null +++ b/assets/objects/vomp/utilitybucket_a01/materials/SimPBR_Translucent.mdl @@ -0,0 +1,290 @@ +/***************************************************************************** +* Copyright 1986-2020 NVIDIA Corporation. All rights reserved. +****************************************************************************** + + MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT, + WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR, + THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA + CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING + ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + THE USE OR INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN + THE MDL MATERIALS. +*/ + +mdl 1.4; + +import ::df::*; +import ::state::*; +import ::math::*; +import ::base::*; +import ::tex::*; +import ::anno::*; + +import ::nvidia::core_definitions::file_texture; +import ::nvidia::core_definitions::normalmap_texture; + +export material SimPBR_Translucent( + // -------------------- SPECULAR REFLECTION/TRANSMISSION ---------------------- + uniform float ior_constant = 1.1f + [[ + anno::display_name("Index of Refraction"), + anno::hard_range(0.0,5.), + anno::description("Index of Refraction of the material"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_constant = 0.5f + [[ + anno::display_name("Roughness Amount"), + anno::hard_range(0.0,1.), + anno::description("Higher roughness values lead to more blurry reflections"), + anno::in_group("Specular") + ]], + uniform float reflection_roughness_texture_influence = 0.0f + [[ + anno::display_name("Roughness Map Influence"), + anno::hard_range(0.0, 1.), + anno::description("Blends between the constant value and the lookup of the roughness texture"), + anno::in_group("Specular") + ]], + uniform texture_2d reflectionroughness_texture = texture_2d() + [[ + anno::display_name("Roughness Map"), + anno::in_group("Specular") + ]], + + // -------------------- VOLUME ---------------------- + color transmittance_color = color(1.0, 1.0f, 1.0f) + [[ + anno::display_name("Transmittance Color"), + anno::description("Expected transmittance after the specified transmittance distance through the volume."), + anno::in_group("Volume") + ]], + float transmittance_measurement_distance = 1.0f + [[ + anno::display_name("Transmittance Measurement Distance"), + anno::description("Distance to match the transmittance through the volume at."), + anno::in_group("Volume") + ]], + + // -------------------- EMISSIVE ---------------------- + uniform bool enable_thin_walled = false + [[ + anno::display_name("Enable Thin Walled"), + anno::description("Enables thin walled logic"), + anno::in_group("Geometry") + ]], + + // -------------------- EMISSIVE ---------------------- + 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::enable_if("enable_emission == true"), + anno::display_name("Emissive Color"), + anno::description("The emission color"), + anno::in_group("Emissive") + ]], + uniform texture_2d emissive_mask_texture = texture_2d() + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Mask Map"), + anno::description("The texture masking the emissive color"), + anno::in_group("Emissive") + ]], + uniform float emissive_intensity = 40.f + [[ + anno::enable_if("enable_emission == true"), + anno::display_name("Emissive Intensity"), + anno::description("Intensity of the emission"), + anno::in_group("Emissive") + ]], + uniform bool enable_emissive_flipbook = false + [[ + anno::display_name("Enable Flipbook for emission"), + anno::description("Allows the use of animated emissive textures (e.g. video screens)"), + anno::in_group("Emissive") + ]], + uniform int2 flipbook_dim = int2(1,1) + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Rows/Columns"), + anno::description("How many rows and columns are in the flipbook?"), + anno::in_group("Emissive") + ]], + uniform int target_fps = 1 + [[ + anno::enable_if("enable_emissive_flipbook == true"), + anno::display_name("Flipbook Target FPS"), + anno::description("Playback speed in frames per second"), + anno::in_group("Emissive") + ]], + + // -------------------- NORMAL ---------------------- + uniform float bump_factor = 1.f + [[ + anno::display_name("Normal Map Strength"), + anno::description("Strength of normal map."), + anno::in_group("Normal") + ]], + uniform texture_2d normalmap_texture = texture_2d() + [[ + anno::display_name("Normal Map"), + 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") + ]], + + // -------------------- UV ADJUSTMENTS ---------------------- + 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::enable_if("project_uvw == true"), + 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") + ]], + uniform float2 texture_translate = float2(0.0f) + [[ + anno::display_name("Texture Translate"), + anno::description("Controls position of texture."), + anno::in_group("UV") + ]], + uniform float2 texture_scale = float2(1.0f) + [[ + anno::display_name("Texture Tiling"), + anno::description("Controls the repetition of the texture."), + anno::in_group("UV") + ]], + uniform float2 texture_speed = float2(0.0f) + [[ + anno::display_name("Texture Speed"), + anno::description("Scrolling texture animation speed in UVs per sec."), + anno::in_group("UV") + ]] +) +[[ + anno::display_name("Sim PBR Translucent"), + anno::description("Supports the translucent material model of the Sim Renderer"), + anno::in_group("SimReady"), + anno::version( 1, 0, 0), + anno::author("NVIDIA CORPORATION"), + anno::key_words(string[]("Sim", "PBR", "translucent", "omniverse", "generic")) +]] + = let { + 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: 0, + projection_type: base::projection_cubic + ) : base::coordinate_source( + coordinate_system: base::texture_coordinate_uvw, + texture_space: 0 + ); + + // Need to use a small value so the compiler doesnt optimize out this var... + float t = 0.00000001;//state::animation_time(); + base::texture_coordinate_info transformed_uvw = base::transform_coordinate( + transform: base::rotation_translation_scale( + scaling: float3(texture_scale.x, texture_scale.y, 1.0), + rotation: float3(0.0, 0.0, 0.0 ), + translation: float3(texture_translate.x + t * texture_speed.x, texture_translate.y + t * texture_speed.y, 0.0)), + coordinate: uvw + ); + float2 uv = float2(transformed_uvw.position.x, transformed_uvw.position.y); + + color volume_absorption_coefficient = -math::log(transmittance_color) / (transmittance_measurement_distance*0.01); + + float roughness_lookup = tex::texture_isvalid(reflectionroughness_texture) ? + tex::lookup_float4(tex: reflectionroughness_texture, coord: uv).x : reflection_roughness_constant; + float reflection_roughness = math::lerp(reflection_roughness_constant, roughness_lookup, reflection_roughness_texture_influence); + + float roughness_squared = reflection_roughness * reflection_roughness; + + bsdf final_bsdf(enable_thin_walled ? + ::df::fresnel_layer( + ior_constant, + 1.f, + ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect, + "" + ), + ::df::specular_bsdf( + transmittance_color, + ::df::scatter_transmit, + "" + ), ::state::normal()) + : ::df::microfacet_ggx_smith_bsdf( + roughness_squared, + roughness_squared, + color(1.f, 1.f, 1.f), + ::state::texture_tangent_u(0), + ::df::scatter_reflect_transmit, + "" + )); + + int rows = flipbook_dim.x; + int columns = flipbook_dim.y; + int numFrames = rows * columns; + varying int frameIdx = int(state::animation_time() * target_fps) % numFrames; + varying float2 baseUV = float2(transformed_uvw.position.x, transformed_uvw.position.y); + varying float2 emissiveUV = enable_emissive_flipbook ? + ((baseUV + float2(frameIdx % rows, frameIdx / rows)) / float2(rows, columns)) : baseUV; + + color emissive_mask = tex::texture_isvalid(emissive_mask_texture) ? + tex::lookup_color(emissive_mask_texture, emissiveUV, tex::wrap_repeat, tex::wrap_repeat) : color(1.0); + + // Normal calculations + float3 normal_lookup = tex::texture_isvalid(normalmap_texture) ? + base::tangent_space_normal_texture( + texture: normalmap_texture, + factor: bump_factor, + uvw: transformed_uvw, + flip_tangent_u: flip_tangent_u, + flip_tangent_v: flip_tangent_v + ) : state::normal(); +} in material( + thin_walled: enable_thin_walled, + surface: material_surface( + scattering: final_bsdf, + emission: material_emission ( + df::diffuse_edf(), + intensity: enable_emission ? emissive_color * emissive_mask * color(emissive_intensity) : color(0) + ) + ), + ior: color(ior_constant), + volume: material_volume( + scattering: df::anisotropic_vdf(), + absorption_coefficient: volume_absorption_coefficient, + scattering_coefficient: color(0.0f, 0.0f, 0.0f) + ), + geometry: material_geometry( + normal: normal_lookup + ) +); diff --git a/assets/objects/vomp/utilityjug_a01/materials/Natural_Plastic_E.mdl b/assets/objects/vomp/utilityjug_a01/materials/Natural_Plastic_E.mdl new file mode 100644 index 0000000000000000000000000000000000000000..720c324b820731f7873a9d1abe45dc74bfa4b6cd --- /dev/null +++ b/assets/objects/vomp/utilityjug_a01/materials/Natural_Plastic_E.mdl @@ -0,0 +1,171 @@ +mdl 1.7; + +using m_mdl = "mdl"; + +import ::state::normal; +import ::OmniSurface::OmniImage::alpha_mode; +import ::OmniSurface::OmniImage::projection_mode; +import ::OmniSurface::OmniImage::tangent_bitangent_mapping; +import ::OmniSurface::OmniImage::wrap_mode; +import ::OmniSurface::OmniShared::displacement_mode; +import ::OmniSurface::OmniShared::emission_mode; +import ::OmniSurface::OmniShared::ior_presets; +import ::OmniSurface::OmniShared::scattering_colors_presets; +import ::OmniSurface::OmniSurface; +import ::base::texture_coordinate_system; +import ::tex::gamma_mode; + +export material Natural_Plastic_E(*) + = ::OmniSurface::OmniSurface( + diffuse_reflection_weight: 1.f, + diffuse_reflection_weight_image: texture_2d(), + diffuse_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + diffuse_reflection_color: color(1.f, 1.f, 1.f), + diffuse_reflection_color_image: texture_2d(), + diffuse_reflection_roughness: 0.f, + diffuse_reflection_roughness_image: texture_2d(), + diffuse_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + metalness: 0.049999997f, + metalness_image: texture_2d(), + metalness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_weight: 0.f, + specular_reflection_weight_image: texture_2d(), + specular_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_color: color(1.f, 1.f, 1.f), + specular_reflection_color_image: texture_2d(), + specular_reflection_roughness: 0.299999982f, + specular_reflection_roughness_image: texture_2d(), + specular_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_ior_preset: OmniSurface::OmniShared::ior_custom, + specular_reflection_ior: 2.f, + specular_reflection_anisotropy: 0.f, + specular_reflection_anisotropy_image: texture_2d(), + specular_reflection_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_anisotropy_rotation: 0.f, + specular_reflection_anisotropy_rotation_image: texture_2d(), + specular_reflection_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_specular_transmission: true, + specular_transmission_weight: 0.799999952f, + specular_transmission_weight_image: texture_2d(), + specular_transmission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_color: color(1.f, 1.f, 1.f), + specular_transmission_color_image: texture_2d(), + specular_transmission_scattering_depth: 0.f, + specular_transmission_scattering_depth_image: texture_2d(), + specular_transmission_scattering_depth_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_scattering_color: color(0.f, 0.f, 0.f), + specular_transmission_scattering_color_image: texture_2d(), + specular_transmission_scatter_anisotropy: 0.f, + specular_transmission_scatter_anisotropy_image: texture_2d(), + specular_transmission_scatter_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_dispersion_abbe: 0.f, + enable_diffuse_transmission: true, + subsurface_weight: 1.f, + subsurface_weight_image: texture_2d(), + subsurface_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_scattering_colors_preset: OmniSurface::OmniShared::scattering_colors_custom, + subsurface_transmission_color: color(1.f, 1.f, 1.f), + subsurface_transmission_color_image: texture_2d(), + subsurface_scattering_color: color(1.f, 1.f, 1.f), + subsurface_scattering_color_image: texture_2d(), + subsurface_scale: 1.f, + subsurface_scale_image: texture_2d(), + subsurface_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_anisotropy: 0.f, + subsurface_anisotropy_image: texture_2d(), + subsurface_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_weight: 1.f, + coat_weight_image: texture_2d(), + coat_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_color: color(1.f, 1.f, 1.f), + coat_color_image: texture_2d(), + coat_roughness: 0.299999982f, + coat_roughness_image: texture_2d(), + coat_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_ior_preset: OmniSurface::OmniShared::ior_custom, + coat_ior: 1.5f, + coat_anisotropy: 0.f, + coat_anisotropy_image: texture_2d(), + coat_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_anisotropy_rotation: 0.f, + coat_anisotropy_rotation_image: texture_2d(), + coat_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_color: 0.f, + coat_affect_color_image: texture_2d(), + coat_affect_color_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_roughness: 0.f, + coat_affect_roughness_image: texture_2d(), + coat_affect_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_normal_strength: 1.f, + coat_normal: state::normal(), + coat_normal_image: texture_2d(), + coat_normal_image_flip_r_channel: false, + coat_normal_image_flip_g_channel: false, + coat_normal_image_flip_b_channel: false, + specular_retro_reflection_weight: 0.699999988f, + specular_retro_reflection_weight_image: texture_2d(), + specular_retro_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_retro_reflection_color: color(1.f, 1.f, 1.f), + specular_retro_reflection_color_image: texture_2d(), + specular_retro_reflection_roughness: 0.300000012f, + specular_retro_reflection_roughness_image: texture_2d(), + specular_retro_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_weight: 0.f, + emission_weight_image: texture_2d(), + emission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_mode: OmniSurface::OmniShared::emission_lx, + emission_intensity: 1.f, + emission_intensity_image: texture_2d(), + emission_intensity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_color: color(1.f, 1.f, 1.f), + emission_color_image: texture_2d(), + emission_use_temperature: false, + emission_temperature: 6500.f, + emission_temperature_image: texture_2d(), + emission_temperature_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_thin_film: false, + thin_film_thickness: 400.f, + thin_film_thickness_image: texture_2d(), + thin_film_thickness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + thin_film_ior_preset: OmniSurface::OmniShared::ior_custom, + thin_film_ior: 1.5f, + thin_walled: false, + enable_opacity: false, + geometry_opacity: 1.f, + geometry_opacity_image: texture_2d(), + geometry_opacity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_opacity_threshold: 0.f, + geometry_normal_strength: 1.f, + geometry_normal: state::normal(), + geometry_normal_image: texture_2d(), + geometry_normal_image_flip_r_channel: false, + geometry_normal_image_flip_g_channel: false, + geometry_normal_image_flip_b_channel: false, + geometry_tangent_bitangent_mapping: OmniSurface::OmniImage::red_green, + geometry_displacement: float3(0.f), + geometry_displacement_mode: OmniSurface::OmniShared::displacement_height, + geometry_displacement_image: texture_2d(), + geometry_displacement_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scale: 1.f, + geometry_displacement_scale_image: texture_2d(), + geometry_displacement_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scalar_zero_value: 0.f, + uvw_texture_coordinate_system: base::texture_coordinate_uvw, + uvw_uv_set: 0, + uvw_ignore_missing_textures: false, + uvw_missing_texture_color: color(0.f, 0.f, 0.f), + uvw_use_uv_coords: false, + uvw_uv_coords: float2(0.f), + uvw_s_offset: 0.f, + uvw_t_offset: 0.f, + uvw_s_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_t_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_s_scale: 1.f, + uvw_t_scale: 1.f, + uvw_s_flip: false, + uvw_t_flip: false, + uvw_swap_st: false, + uvw_projection_mode: OmniSurface::OmniImage::projection_cubic, + uvw_projection_translate: float3(0.f), + uvw_projection_rotate: float3(0.f), + uvw_projection_scale: float3(1.f)); \ No newline at end of file diff --git a/assets/objects/vomp/utilityjug_a01/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/utilityjug_a01/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/utilityjug_a01/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/utilityjug_a02/materials/Natural_Plastic_E.mdl b/assets/objects/vomp/utilityjug_a02/materials/Natural_Plastic_E.mdl new file mode 100644 index 0000000000000000000000000000000000000000..720c324b820731f7873a9d1abe45dc74bfa4b6cd --- /dev/null +++ b/assets/objects/vomp/utilityjug_a02/materials/Natural_Plastic_E.mdl @@ -0,0 +1,171 @@ +mdl 1.7; + +using m_mdl = "mdl"; + +import ::state::normal; +import ::OmniSurface::OmniImage::alpha_mode; +import ::OmniSurface::OmniImage::projection_mode; +import ::OmniSurface::OmniImage::tangent_bitangent_mapping; +import ::OmniSurface::OmniImage::wrap_mode; +import ::OmniSurface::OmniShared::displacement_mode; +import ::OmniSurface::OmniShared::emission_mode; +import ::OmniSurface::OmniShared::ior_presets; +import ::OmniSurface::OmniShared::scattering_colors_presets; +import ::OmniSurface::OmniSurface; +import ::base::texture_coordinate_system; +import ::tex::gamma_mode; + +export material Natural_Plastic_E(*) + = ::OmniSurface::OmniSurface( + diffuse_reflection_weight: 1.f, + diffuse_reflection_weight_image: texture_2d(), + diffuse_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + diffuse_reflection_color: color(1.f, 1.f, 1.f), + diffuse_reflection_color_image: texture_2d(), + diffuse_reflection_roughness: 0.f, + diffuse_reflection_roughness_image: texture_2d(), + diffuse_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + metalness: 0.049999997f, + metalness_image: texture_2d(), + metalness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_weight: 0.f, + specular_reflection_weight_image: texture_2d(), + specular_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_color: color(1.f, 1.f, 1.f), + specular_reflection_color_image: texture_2d(), + specular_reflection_roughness: 0.299999982f, + specular_reflection_roughness_image: texture_2d(), + specular_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_ior_preset: OmniSurface::OmniShared::ior_custom, + specular_reflection_ior: 2.f, + specular_reflection_anisotropy: 0.f, + specular_reflection_anisotropy_image: texture_2d(), + specular_reflection_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_anisotropy_rotation: 0.f, + specular_reflection_anisotropy_rotation_image: texture_2d(), + specular_reflection_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_specular_transmission: true, + specular_transmission_weight: 0.799999952f, + specular_transmission_weight_image: texture_2d(), + specular_transmission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_color: color(1.f, 1.f, 1.f), + specular_transmission_color_image: texture_2d(), + specular_transmission_scattering_depth: 0.f, + specular_transmission_scattering_depth_image: texture_2d(), + specular_transmission_scattering_depth_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_scattering_color: color(0.f, 0.f, 0.f), + specular_transmission_scattering_color_image: texture_2d(), + specular_transmission_scatter_anisotropy: 0.f, + specular_transmission_scatter_anisotropy_image: texture_2d(), + specular_transmission_scatter_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_dispersion_abbe: 0.f, + enable_diffuse_transmission: true, + subsurface_weight: 1.f, + subsurface_weight_image: texture_2d(), + subsurface_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_scattering_colors_preset: OmniSurface::OmniShared::scattering_colors_custom, + subsurface_transmission_color: color(1.f, 1.f, 1.f), + subsurface_transmission_color_image: texture_2d(), + subsurface_scattering_color: color(1.f, 1.f, 1.f), + subsurface_scattering_color_image: texture_2d(), + subsurface_scale: 1.f, + subsurface_scale_image: texture_2d(), + subsurface_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_anisotropy: 0.f, + subsurface_anisotropy_image: texture_2d(), + subsurface_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_weight: 1.f, + coat_weight_image: texture_2d(), + coat_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_color: color(1.f, 1.f, 1.f), + coat_color_image: texture_2d(), + coat_roughness: 0.299999982f, + coat_roughness_image: texture_2d(), + coat_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_ior_preset: OmniSurface::OmniShared::ior_custom, + coat_ior: 1.5f, + coat_anisotropy: 0.f, + coat_anisotropy_image: texture_2d(), + coat_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_anisotropy_rotation: 0.f, + coat_anisotropy_rotation_image: texture_2d(), + coat_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_color: 0.f, + coat_affect_color_image: texture_2d(), + coat_affect_color_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_roughness: 0.f, + coat_affect_roughness_image: texture_2d(), + coat_affect_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_normal_strength: 1.f, + coat_normal: state::normal(), + coat_normal_image: texture_2d(), + coat_normal_image_flip_r_channel: false, + coat_normal_image_flip_g_channel: false, + coat_normal_image_flip_b_channel: false, + specular_retro_reflection_weight: 0.699999988f, + specular_retro_reflection_weight_image: texture_2d(), + specular_retro_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_retro_reflection_color: color(1.f, 1.f, 1.f), + specular_retro_reflection_color_image: texture_2d(), + specular_retro_reflection_roughness: 0.300000012f, + specular_retro_reflection_roughness_image: texture_2d(), + specular_retro_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_weight: 0.f, + emission_weight_image: texture_2d(), + emission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_mode: OmniSurface::OmniShared::emission_lx, + emission_intensity: 1.f, + emission_intensity_image: texture_2d(), + emission_intensity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_color: color(1.f, 1.f, 1.f), + emission_color_image: texture_2d(), + emission_use_temperature: false, + emission_temperature: 6500.f, + emission_temperature_image: texture_2d(), + emission_temperature_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_thin_film: false, + thin_film_thickness: 400.f, + thin_film_thickness_image: texture_2d(), + thin_film_thickness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + thin_film_ior_preset: OmniSurface::OmniShared::ior_custom, + thin_film_ior: 1.5f, + thin_walled: false, + enable_opacity: false, + geometry_opacity: 1.f, + geometry_opacity_image: texture_2d(), + geometry_opacity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_opacity_threshold: 0.f, + geometry_normal_strength: 1.f, + geometry_normal: state::normal(), + geometry_normal_image: texture_2d(), + geometry_normal_image_flip_r_channel: false, + geometry_normal_image_flip_g_channel: false, + geometry_normal_image_flip_b_channel: false, + geometry_tangent_bitangent_mapping: OmniSurface::OmniImage::red_green, + geometry_displacement: float3(0.f), + geometry_displacement_mode: OmniSurface::OmniShared::displacement_height, + geometry_displacement_image: texture_2d(), + geometry_displacement_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scale: 1.f, + geometry_displacement_scale_image: texture_2d(), + geometry_displacement_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scalar_zero_value: 0.f, + uvw_texture_coordinate_system: base::texture_coordinate_uvw, + uvw_uv_set: 0, + uvw_ignore_missing_textures: false, + uvw_missing_texture_color: color(0.f, 0.f, 0.f), + uvw_use_uv_coords: false, + uvw_uv_coords: float2(0.f), + uvw_s_offset: 0.f, + uvw_t_offset: 0.f, + uvw_s_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_t_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_s_scale: 1.f, + uvw_t_scale: 1.f, + uvw_s_flip: false, + uvw_t_flip: false, + uvw_swap_st: false, + uvw_projection_mode: OmniSurface::OmniImage::projection_cubic, + uvw_projection_translate: float3(0.f), + uvw_projection_rotate: float3(0.f), + uvw_projection_scale: float3(1.f)); \ No newline at end of file diff --git a/assets/objects/vomp/utilityjug_a02/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/utilityjug_a02/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/utilityjug_a02/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/utilityjug_a03/materials/Natural_Plastic_E.mdl b/assets/objects/vomp/utilityjug_a03/materials/Natural_Plastic_E.mdl new file mode 100644 index 0000000000000000000000000000000000000000..720c324b820731f7873a9d1abe45dc74bfa4b6cd --- /dev/null +++ b/assets/objects/vomp/utilityjug_a03/materials/Natural_Plastic_E.mdl @@ -0,0 +1,171 @@ +mdl 1.7; + +using m_mdl = "mdl"; + +import ::state::normal; +import ::OmniSurface::OmniImage::alpha_mode; +import ::OmniSurface::OmniImage::projection_mode; +import ::OmniSurface::OmniImage::tangent_bitangent_mapping; +import ::OmniSurface::OmniImage::wrap_mode; +import ::OmniSurface::OmniShared::displacement_mode; +import ::OmniSurface::OmniShared::emission_mode; +import ::OmniSurface::OmniShared::ior_presets; +import ::OmniSurface::OmniShared::scattering_colors_presets; +import ::OmniSurface::OmniSurface; +import ::base::texture_coordinate_system; +import ::tex::gamma_mode; + +export material Natural_Plastic_E(*) + = ::OmniSurface::OmniSurface( + diffuse_reflection_weight: 1.f, + diffuse_reflection_weight_image: texture_2d(), + diffuse_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + diffuse_reflection_color: color(1.f, 1.f, 1.f), + diffuse_reflection_color_image: texture_2d(), + diffuse_reflection_roughness: 0.f, + diffuse_reflection_roughness_image: texture_2d(), + diffuse_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + metalness: 0.049999997f, + metalness_image: texture_2d(), + metalness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_weight: 0.f, + specular_reflection_weight_image: texture_2d(), + specular_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_color: color(1.f, 1.f, 1.f), + specular_reflection_color_image: texture_2d(), + specular_reflection_roughness: 0.299999982f, + specular_reflection_roughness_image: texture_2d(), + specular_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_ior_preset: OmniSurface::OmniShared::ior_custom, + specular_reflection_ior: 2.f, + specular_reflection_anisotropy: 0.f, + specular_reflection_anisotropy_image: texture_2d(), + specular_reflection_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_reflection_anisotropy_rotation: 0.f, + specular_reflection_anisotropy_rotation_image: texture_2d(), + specular_reflection_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_specular_transmission: true, + specular_transmission_weight: 0.799999952f, + specular_transmission_weight_image: texture_2d(), + specular_transmission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_color: color(1.f, 1.f, 1.f), + specular_transmission_color_image: texture_2d(), + specular_transmission_scattering_depth: 0.f, + specular_transmission_scattering_depth_image: texture_2d(), + specular_transmission_scattering_depth_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_scattering_color: color(0.f, 0.f, 0.f), + specular_transmission_scattering_color_image: texture_2d(), + specular_transmission_scatter_anisotropy: 0.f, + specular_transmission_scatter_anisotropy_image: texture_2d(), + specular_transmission_scatter_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_transmission_dispersion_abbe: 0.f, + enable_diffuse_transmission: true, + subsurface_weight: 1.f, + subsurface_weight_image: texture_2d(), + subsurface_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_scattering_colors_preset: OmniSurface::OmniShared::scattering_colors_custom, + subsurface_transmission_color: color(1.f, 1.f, 1.f), + subsurface_transmission_color_image: texture_2d(), + subsurface_scattering_color: color(1.f, 1.f, 1.f), + subsurface_scattering_color_image: texture_2d(), + subsurface_scale: 1.f, + subsurface_scale_image: texture_2d(), + subsurface_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + subsurface_anisotropy: 0.f, + subsurface_anisotropy_image: texture_2d(), + subsurface_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_weight: 1.f, + coat_weight_image: texture_2d(), + coat_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_color: color(1.f, 1.f, 1.f), + coat_color_image: texture_2d(), + coat_roughness: 0.299999982f, + coat_roughness_image: texture_2d(), + coat_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_ior_preset: OmniSurface::OmniShared::ior_custom, + coat_ior: 1.5f, + coat_anisotropy: 0.f, + coat_anisotropy_image: texture_2d(), + coat_anisotropy_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_anisotropy_rotation: 0.f, + coat_anisotropy_rotation_image: texture_2d(), + coat_anisotropy_rotation_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_color: 0.f, + coat_affect_color_image: texture_2d(), + coat_affect_color_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_affect_roughness: 0.f, + coat_affect_roughness_image: texture_2d(), + coat_affect_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + coat_normal_strength: 1.f, + coat_normal: state::normal(), + coat_normal_image: texture_2d(), + coat_normal_image_flip_r_channel: false, + coat_normal_image_flip_g_channel: false, + coat_normal_image_flip_b_channel: false, + specular_retro_reflection_weight: 0.699999988f, + specular_retro_reflection_weight_image: texture_2d(), + specular_retro_reflection_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + specular_retro_reflection_color: color(1.f, 1.f, 1.f), + specular_retro_reflection_color_image: texture_2d(), + specular_retro_reflection_roughness: 0.300000012f, + specular_retro_reflection_roughness_image: texture_2d(), + specular_retro_reflection_roughness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_weight: 0.f, + emission_weight_image: texture_2d(), + emission_weight_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_mode: OmniSurface::OmniShared::emission_lx, + emission_intensity: 1.f, + emission_intensity_image: texture_2d(), + emission_intensity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + emission_color: color(1.f, 1.f, 1.f), + emission_color_image: texture_2d(), + emission_use_temperature: false, + emission_temperature: 6500.f, + emission_temperature_image: texture_2d(), + emission_temperature_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + enable_thin_film: false, + thin_film_thickness: 400.f, + thin_film_thickness_image: texture_2d(), + thin_film_thickness_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + thin_film_ior_preset: OmniSurface::OmniShared::ior_custom, + thin_film_ior: 1.5f, + thin_walled: false, + enable_opacity: false, + geometry_opacity: 1.f, + geometry_opacity_image: texture_2d(), + geometry_opacity_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_opacity_threshold: 0.f, + geometry_normal_strength: 1.f, + geometry_normal: state::normal(), + geometry_normal_image: texture_2d(), + geometry_normal_image_flip_r_channel: false, + geometry_normal_image_flip_g_channel: false, + geometry_normal_image_flip_b_channel: false, + geometry_tangent_bitangent_mapping: OmniSurface::OmniImage::red_green, + geometry_displacement: float3(0.f), + geometry_displacement_mode: OmniSurface::OmniShared::displacement_height, + geometry_displacement_image: texture_2d(), + geometry_displacement_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scale: 1.f, + geometry_displacement_scale_image: texture_2d(), + geometry_displacement_scale_image_alpha_mode: OmniSurface::OmniImage::alpha_default, + geometry_displacement_scalar_zero_value: 0.f, + uvw_texture_coordinate_system: base::texture_coordinate_uvw, + uvw_uv_set: 0, + uvw_ignore_missing_textures: false, + uvw_missing_texture_color: color(0.f, 0.f, 0.f), + uvw_use_uv_coords: false, + uvw_uv_coords: float2(0.f), + uvw_s_offset: 0.f, + uvw_t_offset: 0.f, + uvw_s_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_t_wrap: OmniSurface::OmniImage::wrap_periodic, + uvw_s_scale: 1.f, + uvw_t_scale: 1.f, + uvw_s_flip: false, + uvw_t_flip: false, + uvw_swap_st: false, + uvw_projection_mode: OmniSurface::OmniImage::projection_cubic, + uvw_projection_translate: float3(0.f), + uvw_projection_rotate: float3(0.f), + uvw_projection_scale: float3(1.f)); \ No newline at end of file diff --git a/assets/objects/vomp/utilityjug_a03/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/utilityjug_a03/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/utilityjug_a03/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/whitepackerbottle_a01/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/whitepackerbottle_a01/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/whitepackerbottle_a01/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/whitepackerbottle_a02/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/whitepackerbottle_a02/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/whitepackerbottle_a02/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file diff --git a/assets/objects/vomp/whitepackerbottle_a03/materials/Plastic_Glossy_White_A.mdl b/assets/objects/vomp/whitepackerbottle_a03/materials/Plastic_Glossy_White_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..65d67b36eece6ffda7b8a68c7b94feb2106d6313 --- /dev/null +++ b/assets/objects/vomp/whitepackerbottle_a03/materials/Plastic_Glossy_White_A.mdl @@ -0,0 +1,36 @@ +mdl 1.4; + +using ::OmniPBR import OmniPBR; +import ::tex::gamma_mode; +import ::state::normal; +import ::base::mono_mode; + +export material Plastic_Glossy_White_A(*) + = OmniPBR( + diffuse_color_constant: color(0.2, 0.2, 0.2), + diffuse_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Albedo.png", ::tex::gamma_srgb), + albedo_desaturation: 0.0, + albedo_add: 0.0, + albedo_brightness: 1.0, + diffuse_tint: color(1, 1, 1), + reflection_roughness_texture_influence: 1.0, + specular_level: 0.5, + enable_ORM_texture: true, + ORM_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_ORM.png", ::tex::gamma_linear), + ao_to_diffuse: 0.0, + ao_texture: texture_2d(), + enable_emission: false, + enable_opacity: false, + bump_factor: 1.0, + normalmap_texture: texture_2d("../textures/T_Plastic_Glossy_White_A_Normal.png", ::tex::gamma_linear), + flip_tangent_u: false, + flip_tangent_v: true, + project_uvw: false, + world_or_object: false, + uv_space_index: 0, + texture_translate: float2(0, 0), + texture_rotate: 0.0, + texture_scale: float2(1, 1), + detail_texture_translate: float2(0, 0), + detail_texture_rotate: 0.0, + detail_texture_scale: float2(1, 1)); \ No newline at end of file