Upload XDU2300_Top 2026.09.25_01
Browse filesFiles changed (26)
- XDU2300_Top/com.nvidia.simready.packaging.json+1-1
- XDU2300_Top/simready_usd/.thumbs/256x256/XDU2300_Top_main.usd.png
- XDU2300_Top/simready_usd/XDU2300_Top_main.jsonDeleted-8
- XDU2300_Top/simready_usd/XDU2300_Top_main.usd
- XDU2300_Top/simready_usd/layers/.thumbs/256x256/XDU2300_Top_ConnectionPoints.usd.png
- XDU2300_Top/simready_usd/layers/.thumbs/256x256/XDU2300_Top_Properties.usda.png
- XDU2300_Top/simready_usd/layers/XDU2300_Top_ConnectionPoints.usd
- XDU2300_Top/simready_usd/layers/XDU2300_Top_Properties.json+16-16
- XDU2300_Top/simready_usd/layers/XDU2300_Top_Properties.usda+1172-1179
- XDU2300_Top/simready_usd/materials/Carpaint_Solid.mdlDeleted-1112
- XDU2300_Top/simready_usd/materials/Copper.mdlDeleted-54
- XDU2300_Top/simready_usd/materials/Felt_Plain.mdlDeleted-1467
- XDU2300_Top/simready_usd/materials/Rubber_Textured.mdlDeleted-42
- XDU2300_Top/simready_usd/materials/Stainless_Steel_Brushed.mdlDeleted
- XDU2300_Top/simready_usd/payloads/.thumbs/256x256/external.usd.png
- XDU2300_Top/simready_usd/payloads/.thumbs/256x256/internal.usd.png
- XDU2300_Top/simready_usd/payloads/external.usd+2-2
- XDU2300_Top/simready_usd/payloads/internal.usd+1-1
- XDU2300_Top/simready_usd/scripts/01_Occluder.pyAdded+127
- XDU2300_Top/simready_usd/scripts/02_Internal_External.pyAdded+1010
- XDU2300_Top/simready_usd/scripts/03_Material_Replacement.pyAdded+876
- XDU2300_Top/simready_usd/textures/.thumbs/256x256/vertiv_logo.usd.png
- XDU2300_Top/simready_usd/textures/materials/OmniPBR/OmniPBR.mdlAdded+419
- XDU2300_Top/simready_usd/textures/materials/OmniPBR/OmniPBRBase.mdlAdded+493
- XDU2300_Top/simready_usd/textures/materials/OmniPBR/OmniPBR_ClearCoat.mdlAdded+734
- XDU2300_Top/simready_usd/textures/vertiv_logo.usd
123456{"format_version": "1.0","package_id": "simready.hf.Vertiv.simready-assets.XDU2300_Top.2026.09.15_01","license": "cc-by-4.0","metadata": []}123456{"format_version": "1.0","package_id": "simready.hf.Vertiv.simready-assets.XDU2300_Top.2026.09.25_01","license": "cc-by-4.0","metadata": []}
12345678{
"asset_name": "XDU2300_Top",
"asset_type": "prop",
"source_file": "VERTIV/assets/XDU2300_Top/XDU2300_Top_main.usd",
"usd_date_generated": "2026-09-15",
"profile": "Prop-Robotics-Neutral",
"profile_version": "2.1.0"
}36 unmodified lines373839404142434445464748124 unmodified lines17317417517617717817917 unmodified lines19719819920020120220331 unmodified lines2352362372382392407 unmodified lines24824925025125225325441 unmodified lines296297298299300301302303172 unmodified lines47647747847948048148248387 unmodified lines5715725735745755765775 unmodified lines5835845855865875885895905915925931 unmodified line59559659759836 unmodified lines},"aif:spec:coolingSystem": {"type": "string","value": "Tandem with digital , R-410A","description": "Cooling System"},"aif:spec:productFamily": {"type": "string","value": "Liebert XDM Split Indoor Chiller","description": "Product Family"},"aif:spec:controller": {124 unmodified lines"aif:spec:filterSizeCoolingCapacity": {"type": "string","value": "50 / 25","description": "Filter size in \u03bc for Cooling Capacity"},"aif:spec:pumpRedundancyStrategyCoolingCapacity": {"type": "string",17 unmodified lines},"aif:spec:nominalFlow": {"type": "string","value": "205 GPM","description": "Nominal Flow 2x Pump Running in cubic meter/second"},"aif:spec:fluidFiltration": {31 unmodified lines"value": "","description": "Rated speed [Hz]"},"aif:spec:maximumPowerConsumption2XPumps": {"type": "string","value": "",7 unmodified lines"aif:spec:filterSizePumps": {"type": "string","value": "50 or 25","description": "Filter size [\u00ce\u00bc] for pumps"},"aif:spec:pumpRedundancyStrategyPumps": {"type": "string",41 unmodified lines"description": "Electrical Frequency in Hz"},"aif:spec:powerRating": {"type": "int","value": 2300,"description": "Electrical Power Rating in KW"},"aif:spec:powerFactor": {172 unmodified lines"description": "Maximum Flow 3x Pump Running in cubic meter/second"},"aif:spec:current": {"type": "int","value": 0,"description": "Electrical Current in A"},"aif:core:manufacturer": {87 unmodified lines},"aif:core:assetDescription": {"type": "string","value": "","description": "Human Readable Description of Asset"},"aif:core:connectsToModelDocumentation": {5 unmodified lines"type": "string","value": "2026-08-04 00:00:00","description": "Creation Date of Revision of Asset ISO 8601 format (YYYY-MM-DD)"},"aif:spec:numberOfPumps": {"type": "int","value": 2,"description": "Number of pumps"}},"metadata": {1 unmodified line"version": "1.0","created": "2025-12-02"}}36 unmodified lines373839404142434445464748124 unmodified lines17317417517617717817917 unmodified lines19719819920020120220331 unmodified lines2352362372382392402412422432442457 unmodified lines25325425525625725825941 unmodified lines301302303304305306307308172 unmodified lines48148248348448548648748887 unmodified lines5765775785795805815825 unmodified lines5885895905915925931 unmodified line59559659759836 unmodified lines},"aif:spec:coolingSystem": {"type": "string","value": "Brazed Plate Heat Exchanger","description": "Cooling System"},"aif:spec:productFamily": {"type": "string","value": "Liebert XDU Coolant Distribution Unit ","description": "Product Family"},"aif:spec:controller": {124 unmodified lines"aif:spec:filterSizeCoolingCapacity": {"type": "string","value": "50 / 25","description": "Filter size in μ for Cooling Capacity"},"aif:spec:pumpRedundancyStrategyCoolingCapacity": {"type": "string",17 unmodified lines},"aif:spec:nominalFlow": {"type": "string","value": "449 GPM (1700 LPM) single pump; 898 GPM (3400 LPM) two pumps","description": "Nominal Flow 2x Pump Running in cubic meter/second"},"aif:spec:fluidFiltration": {31 unmodified lines"value": "","description": "Rated speed [Hz]"},"aif:spec:numberofpumps": {"type": "int","value": 2,"description": "Number of pumps"},"aif:spec:maximumPowerConsumption2XPumps": {"type": "string","value": "",7 unmodified lines"aif:spec:filterSizePumps": {"type": "string","value": "50 or 25","description": "Filter size [μ] for pumps"},"aif:spec:pumpRedundancyStrategyPumps": {"type": "string",41 unmodified lines"description": "Electrical Frequency in Hz"},"aif:spec:powerRating": {"type": "string","value": "42 kW electrical (2 × 21.17 kW/pump)","description": "Electrical Power Rating in KW"},"aif:spec:powerFactor": {172 unmodified lines"description": "Maximum Flow 3x Pump Running in cubic meter/second"},"aif:spec:current": {"type": "string","value": "","description": "Electrical Current in A"},"aif:core:manufacturer": {87 unmodified lines},"aif:core:assetDescription": {"type": "string","value": "High capacity liquid to liquid CDU for efficient cooling.","description": "Human Readable Description of Asset"},"aif:core:connectsToModelDocumentation": {5 unmodified lines"type": "string","value": "2026-08-04 00:00:00","description": "Creation Date of Revision of Asset ISO 8601 format (YYYY-MM-DD)"}},"metadata": {1 unmodified line"version": "1.0","created": "2025-12-02"}}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179#usda 1.0(defaultPrim = "XDU2300_Top")over "XDU2300_Top"{custom int aif:core:accessibilityRequirement = 800 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Service clearance in mm [AIF-MANAGED]")custom string aif:core:aifthermal = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "AIF_Thermal [AIF-MANAGED]")custom string aif:core:assetClass = "CDU" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Class of AI Factory Equipment [AIF-MANAGED]")custom string aif:core:assetCreationDate = "2026-08-04" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Creation Date of Revision of Asset ISO 8601 format (YYYY-MM-DD) [AIF-MANAGED]")custom string aif:core:assetDescription = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Human Readable Description of Asset [AIF-MANAGED]")custom string aif:core:assetValidatorVersion = "1.18.0" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Asset Validator version [AIF-MANAGED]")custom float aif:core:assetVersion = 0.1 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Design Revision of Digital Twin Asset [AIF-MANAGED]")custom string aif:core:connectsToModelDocumentation = "https://www.vertiv.com/4aca75/globalassets/shared/vertiv-coolchip-cdu-2300kw-data-sheet-sl-80005.pdf" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Url to online documentation [AIF-MANAGED]")custom int aif:core:depth = 1200 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment depth in mm [AIF-MANAGED]")custom string aif:core:geometrympv = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Geometry_MPV [AIF-MANAGED]")custom int aif:core:height = 2400 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment height in mm [AIF-MANAGED]")custom int aif:core:installationClearance = 2000 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Installation Clearance in mm [AIF-MANAGED]")custom string aif:core:manufacturer = "Vertiv" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment manufacturer name [AIF-MANAGED]")custom string aif:core:modelNumber = "XDU2300" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment model number [AIF-MANAGED]")custom vector3f aif:core:overallGeometryDimensions = (1200, 1200, 2400) (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Overall Geometry (WxDxH) (metric) [AIF-MANAGED]")custom string aif:core:sceneOptimizerVersion = "110.1.0" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Scene Optimizer version [AIF-MANAGED]")custom float aif:core:simreadyVersion = 0.1 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "SimReady version [AIF-MANAGED]")custom int aif:core:weight = 1569 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment weight in kilograms [AIF-MANAGED]")custom int aif:core:width = 1200 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment width in mm [AIF-MANAGED]")custom string aif:coreaifelectrical = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "AIF_Electrical [AIF-MANAGED]")custom string aif:spec:airDischarge = "Top" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Air Discharge [AIF-MANAGED]")custom string aif:spec:airFlowfFanType = "EC-Fan" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Air Flow Fan Type [AIF-MANAGED]")custom int aif:spec:approachTemperatureDifference = 4 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Approach Temperature Difference in degree kelvin [AIF-MANAGED]")custom string aif:spec:auxiliaryPowerSourceAndConnections = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Auxiliary Power Source & Connections [AIF-MANAGED]")custom string aif:spec:breaker = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Breaker [AIF-MANAGED]")custom string aif:spec:communication1 = "RS485 RTU Modbus" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Communication1 [AIF-MANAGED]")custom string aif:spec:communication2 = "TCPIP" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Communication2 [AIF-MANAGED]")custom string aif:spec:condenserModel = "Liebert MCV430" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Condenser Model [AIF-MANAGED]")custom string aif:spec:controlHmi = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Control HMI [AIF-MANAGED]")custom string aif:spec:controller = "Liebert iCOM controller" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Controller [AIF-MANAGED]")custom string aif:spec:controlWiresForExternalComm = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Control Wires for external comm [AIF-MANAGED]")custom string aif:spec:coolingCapacityCurve = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Cooling Capacity Curve Flow rate vs Cooling Capacity (5 points on curve required) [AIF-MANAGED]")custom string aif:spec:coolingSystem = "Tandem with digital , R-410A" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Cooling System [AIF-MANAGED]")custom string aif:spec:coolingType = "Chilled Water System" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary Cooling type: Water/Glycol [AIF-MANAGED]")custom int aif:spec:current = 0 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Current in A [AIF-MANAGED]")custom string aif:spec:customerPipingLocation = "Top connection" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Customer Piping Location [AIF-MANAGED]")custom string aif:spec:disconnect = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Disconnect [AIF-MANAGED]")custom string aif:spec:display = "Liebert iCOM high definition" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Display [AIF-MANAGED]")custom int aif:spec:efficiency = 82 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Efficiency [AIF-MANAGED]")custom string aif:spec:efficiencyRotatingEquipment = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Efficiency of Rotating Equipment [AIF-MANAGED]")custom string aif:spec:enclosure = "Color standard" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Enclosure [AIF-MANAGED]")custom string aif:spec:extremeLowAmbient = "None" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Extreme Low Ambient [AIF-MANAGED]")custom string aif:spec:filterSizeCoolingCapacity = "50 / 25" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Filter size in μ for Cooling Capacity [AIF-MANAGED]")custom string aif:spec:filterSizePumps = "50 or 25" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Filter size [μ] for pumps [AIF-MANAGED]")custom int aif:spec:fluidFiltration = 50 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Fluid Filtration [AIF-MANAGED]")custom int aif:spec:frequency = 60 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Frequency in Hz [AIF-MANAGED]")custom string aif:spec:fuse = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Fuse [AIF-MANAGED]")custom int aif:spec:fwsReturnPipingConnection = 150 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "FWS Return piping connection in mm hygienic flanges top or bottom with Unique Id [AIF-MANAGED]")custom int aif:spec:fwsSupplyPipingConnection = 150 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "FWS Supply piping connection in mm hygienic flanges top or bottom with Unique Id [AIF-MANAGED]")custom float aif:spec:highvoltageelectricalconnectionstop = 63.5 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "High Voltage Electrical Connections Top in mm [AIF-MANAGED]")custom string aif:spec:highVoltageOptions = "Locking disconnect" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "High Voltage Options [AIF-MANAGED]")custom int aif:spec:incomingPowerFeeds = 2300 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Incoming power feeds [AIF-MANAGED]")custom string aif:spec:loadDevice = "Chip Cooling" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Load Device [AIF-MANAGED]")custom int aif:spec:lowvoltageelectricalconnectionstop = 35 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Low Voltage Electrical Connections Top in mm [AIF-MANAGED]")custom float aif:spec:maximumCoolingCapacity = 2.3 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Cooling Capacity [AIF-MANAGED]")custom int aif:spec:maximumDewPoint = 17 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Dew Point in Kelvin [AIF-MANAGED]")custom float aif:spec:maximumFlow = 0.06 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Flow 3x Pump Running in cubic meter/second [AIF-MANAGED]")custom float aif:spec:maximumFluidFlow = 0.06 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Fluid Flow Running in cubic meter/second [AIF-MANAGED]")custom string aif:spec:maximumPowerConsumption2XPumps = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Power Consumption (2x Pumps) at maximum flow and external pressure drop [AIF-MANAGED]")custom string aif:spec:maximumPowerConsumption3XPumps = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Power Consumption (3x Pumps) at maximum flow and external pressure drop [AIF-MANAGED]")custom string aif:spec:maxSpeed = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Max speed of EC fans [Hz] [AIF-MANAGED]")custom string aif:spec:monitoring = "Base comms and connectivity" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Monitoring [AIF-MANAGED]")custom string aif:spec:motorPowerInfo = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Motor/Pump Power Info [AIF-MANAGED]")custom int aif:spec:motorSelection = 15 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Motor Selection in HP [AIF-MANAGED]")custom string aif:spec:motorSize = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Motor/Pump Size [AIF-MANAGED]")custom string aif:spec:mountStyle = "In Row" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Mount Style: In Row, In Rack [AIF-MANAGED]")custom int aif:spec:nominalCoolingCapacity = 2300 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Nominal Cooling Capacity in KW [AIF-MANAGED]")custom string aif:spec:nominalFlow = "205 GPM" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Nominal Flow 2x Pump Running in cubic meter/second [AIF-MANAGED]")custom int aif:spec:nominalVoltage = 460 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Nominal Voltage in Volt [AIF-MANAGED]")custom int aif:spec:numberOfPumps = 2 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Number of pumps [AIF-MANAGED]")custom string aif:spec:optionPackages = "Low voltage terminal package" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Option Packages [AIF-MANAGED]")custom string aif:spec:packaging = "Domestic" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Packaging [AIF-MANAGED]")custom string aif:spec:pipingConnection = "Top" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Piping Connection [AIF-MANAGED]")custom string aif:spec:powerFactor = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Power Factor [AIF-MANAGED]")custom string aif:spec:powerFactorRotatingEquipment = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Power Factor Rotating Equipment [AIF-MANAGED]")custom string aif:spec:powerMeter = "None" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Power Meter [AIF-MANAGED]")custom int aif:spec:powerRating = 2300 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Power Rating in KW [AIF-MANAGED]")custom string aif:spec:powerTransferDesign = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Power Transfer Design [AIF-MANAGED]")custom string aif:spec:powerTransferDevice = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Power Transfer Device [AIF-MANAGED]")custom string aif:spec:primaryCircuitVolume = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary Circuit Volume in Liters [AIF-MANAGED]")custom string aif:spec:primaryControl = "2 Way" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary Control of Modulating Control [AIF-MANAGED]")custom int aif:spec:primaryFiltration = 50 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary Filtration External with bypass to enable cleaning [AIF-MANAGED]")custom int aif:spec:primaryInletTemperature = 32 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary Inlet Temperature in degree kelvin [AIF-MANAGED]")custom string aif:spec:primaryToSecondaryFluidType = "Refrigerant AC to liquid" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary to secondary fluid type [AIF-MANAGED]")custom string aif:spec:productFamily = "Liebert XDM Split Indoor Chiller" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Product Family [AIF-MANAGED]")custom string aif:spec:productType = "Liquid-to-Refrigerant Coolant Distribution Unit" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Product Type [AIF-MANAGED]")custom string aif:spec:pumpFlowCurve = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Pump flow curve: (CMS vs KPa) (5 points on curve required) [AIF-MANAGED]")custom string aif:spec:pumpRedundancyStrategyCoolingCapacity = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Pump redundancy strategy for Cooling Capacity [AIF-MANAGED]")custom string aif:spec:pumpRedundancyStrategyPumps = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Pump redundancy strategy for pumps [AIF-MANAGED]")custom string aif:spec:ratedCableSize = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated Cable Size [AIF-MANAGED]")custom int aif:spec:ratedHp = 46 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated HP [AIF-MANAGED]")custom float aif:spec:ratedMaxPower = 47.8 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated Max Power [AIF-MANAGED]")custom string aif:spec:ratedSpeed = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated speed [Hz] [AIF-MANAGED]")custom string aif:spec:ratedVoltageIncomingPower = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated Voltage Incoming Power [AIF-MANAGED]")custom string aif:spec:ratedVoltageRotatingEquipment = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated Voltage Rotating Equipment [AIF-MANAGED]")custom string aif:spec:redundancyScheme = "Independent module operation" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Redundancy Scheme [AIF-MANAGED]")custom string aif:spec:referenceFacilityCoolantTemperature = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Reference facility coolant temperature in Kelvin [AIF-MANAGED]")custom int aif:spec:referenceSecondaryCoolantTemperature = 25 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Reference Secondary Coolant Temperature in Kelvin range [AIF-MANAGED]")custom float aif:spec:referenceTechnologyCoolantFlowRate = 5.68 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Reference technology coolant flow rate in LPM [AIF-MANAGED]")custom string aif:spec:refrigerant = "R-410A" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Refrigerant [AIF-MANAGED]")custom string aif:spec:remoteSensor = "30' Remote temp and humidity sensor" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Remote Sensor [AIF-MANAGED]")custom int aif:spec:returnAirTemperature = 10 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Return Air Temperature in Kelvin [AIF-MANAGED]")custom string aif:spec:secondaryCircuitFiltration = "None" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Secondary Circuit Filtration [AIF-MANAGED]")custom int aif:spec:secondaryCircuitVolume = 220 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Secondary Circuit Volume in Liters [AIF-MANAGED]")custom int aif:spec:secondaryDeltaT = 36 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Secondary Delta T in degree kelvin [AIF-MANAGED]")custom string aif:spec:secondaryFiltration = "50 or 25" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Secondary Filtration External with bypass to enable cleaning [AIF-MANAGED]")custom int aif:spec:secondaryOutletTemperature = 36 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Secondary Outlet Temperature in degree kelvin [AIF-MANAGED]")custom int aif:spec:shortCircuitCurrent = 65000 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Short Circuit Current in Ampere [AIF-MANAGED]")custom string aif:spec:systemType = "Modular Distribution Unit" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "System Type [AIF-MANAGED]")custom int aif:spec:tcsReturnPipingConnection = 150 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "TCS Return piping connection in mm hygienic flanges top or bottom with Unique Id [AIF-MANAGED]")custom int aif:spec:tcsSupplyPipingConnection = 150 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "TCS Supply piping connection in mm hygienic flanges top or bottom with Unique Id [AIF-MANAGED]")custom int aif:spec:totalHeatDissipated = 60 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Total heat dissipated [kW] [AIF-MANAGED]")custom string aif:spec:wettedMaterialFws = "Copper" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Wetted Material List for FWS [AIF-MANAGED]")custom string aif:spec:wettedMaterialTcs = "Stainless Steel" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Wetted Material List for TCS [AIF-MANAGED]")custom string aif:spec:wiringMethod = "Secondary closed loop circuit" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Wiring Method [AIF-MANAGED]")custom string aif:spec:workingFluidCoolingCapacity = "PG -25 with inhibitors" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Working fluid for Cooling Capacity in KW [AIF-MANAGED]")custom string aif:spec:workingFluidPumps = "Water or PG-25 with inhibitors" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Working fluid for pumps [AIF-MANAGED]")}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172#usda 1.0(defaultPrim = "XDU2300_Top")over "XDU2300_Top"{custom int aif:core:accessibilityRequirement = 800 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Service clearance in mm [AIF-MANAGED]")custom string aif:core:aifthermal = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "AIF_Thermal [AIF-MANAGED]")custom string aif:core:assetClass = "CDU" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Class of AI Factory Equipment [AIF-MANAGED]")custom string aif:core:assetCreationDate = "2026-08-04 00:00:00" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Creation Date of Revision of Asset ISO 8601 format (YYYY-MM-DD) [AIF-MANAGED]")custom string aif:core:assetDescription = "High capacity liquid to liquid CDU for efficient cooling." (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Human Readable Description of Asset [AIF-MANAGED]")custom string aif:core:assetValidatorVersion = "get_asset_validator_id()" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Asset Validator version [AIF-MANAGED]")custom float aif:core:assetVersion = 0.1 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Design Revision of Digital Twin Asset [AIF-MANAGED]")custom string aif:core:connectsToModelDocumentation = "https://www.vertiv.com/4aca75/globalassets/shared/vertiv-coolchip-cdu-2300kw-data-sheet-sl-80005.pdf" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Url to online documentation [AIF-MANAGED]")custom int aif:core:depth = 1200 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment depth in mm [AIF-MANAGED]")custom string aif:core:geometrympv = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Geometry_MPV [AIF-MANAGED]")custom int aif:core:height = 2400 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment height in mm [AIF-MANAGED]")custom int aif:core:installationClearance = 2000 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Installation Clearance in mm [AIF-MANAGED]")custom string aif:core:manufacturer = "Vertiv" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment manufacturer name [AIF-MANAGED]")custom string aif:core:modelNumber = "XDU2300" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment model number [AIF-MANAGED]")custom vector3f aif:core:overallGeometryDimensions = (1200, 1200, 2400) (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Overall Geometry (WxDxH) (metric) [AIF-MANAGED]")custom string aif:core:sceneOptimizerVersion = "get_scene_optimizer_id()" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Scene Optimizer version [AIF-MANAGED]")custom float aif:core:simreadyVersion = 0.1 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "SimReady version [AIF-MANAGED]")custom int aif:core:weight = 1569 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment weight in kilograms [AIF-MANAGED]")custom int aif:core:width = 1200 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Equipment width in mm [AIF-MANAGED]")custom string aif:coreaifelectrical = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "AIF_Electrical [AIF-MANAGED]")custom string aif:spec:airDischarge = "Top" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Air Discharge [AIF-MANAGED]")custom string aif:spec:airFlowfFanType = "EC-Fan" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Air Flow Fan Type [AIF-MANAGED]")custom int aif:spec:approachTemperatureDifference = 4 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Approach Temperature Difference in degree kelvin [AIF-MANAGED]")custom string aif:spec:auxiliaryPowerSourceAndConnections = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Auxiliary Power Source & Connections [AIF-MANAGED]")custom string aif:spec:breaker = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Breaker [AIF-MANAGED]")custom string aif:spec:communication1 = "RS485 RTU Modbus" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Communication1 [AIF-MANAGED]")custom string aif:spec:communication2 = "TCPIP" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Communication2 [AIF-MANAGED]")custom string aif:spec:condenserModel = "Liebert MCV430" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Condenser Model [AIF-MANAGED]")custom string aif:spec:controlHmi = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Control HMI [AIF-MANAGED]")custom string aif:spec:controller = "Liebert iCOM controller" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Controller [AIF-MANAGED]")custom string aif:spec:controlWiresForExternalComm = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Control Wires for external comm [AIF-MANAGED]")custom string aif:spec:coolingCapacityCurve = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Cooling Capacity Curve Flow rate vs Cooling Capacity (5 points on curve required) [AIF-MANAGED]")custom string aif:spec:coolingSystem = "Brazed Plate Heat Exchanger" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Cooling System [AIF-MANAGED]")custom string aif:spec:coolingType = "Chilled Water System" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary Cooling type: Water/Glycol [AIF-MANAGED]")custom string aif:spec:current = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Current in A [AIF-MANAGED]")custom string aif:spec:customerPipingLocation = "Top connection" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Customer Piping Location [AIF-MANAGED]")custom string aif:spec:disconnect = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Disconnect [AIF-MANAGED]")custom string aif:spec:display = "Liebert iCOM high definition" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Display [AIF-MANAGED]")custom int aif:spec:efficiency = 82 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Efficiency [AIF-MANAGED]")custom string aif:spec:efficiencyRotatingEquipment = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Efficiency of Rotating Equipment [AIF-MANAGED]")custom string aif:spec:enclosure = "Color standard" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Enclosure [AIF-MANAGED]")custom string aif:spec:extremeLowAmbient = "None" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Extreme Low Ambient [AIF-MANAGED]")custom string aif:spec:filterSizeCoolingCapacity = "50 / 25" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Filter size in μ for Cooling Capacity [AIF-MANAGED]")custom string aif:spec:filterSizePumps = "50 or 25" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Filter size [μ] for pumps [AIF-MANAGED]")custom int aif:spec:fluidFiltration = 50 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Fluid Filtration [AIF-MANAGED]")custom int aif:spec:frequency = 60 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Frequency in Hz [AIF-MANAGED]")custom string aif:spec:fuse = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Fuse [AIF-MANAGED]")custom int aif:spec:fwsReturnPipingConnection = 150 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "FWS Return piping connection in mm hygienic flanges top or bottom with Unique Id [AIF-MANAGED]")custom int aif:spec:fwsSupplyPipingConnection = 150 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "FWS Supply piping connection in mm hygienic flanges top or bottom with Unique Id [AIF-MANAGED]")custom float aif:spec:highvoltageelectricalconnectionstop = 63.5 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "High Voltage Electrical Connections Top in mm [AIF-MANAGED]")custom string aif:spec:highVoltageOptions = "Locking disconnect" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "High Voltage Options [AIF-MANAGED]")custom int aif:spec:incomingPowerFeeds = 2300 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Incoming power feeds [AIF-MANAGED]")custom string aif:spec:loadDevice = "Chip Cooling" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Load Device [AIF-MANAGED]")custom int aif:spec:lowvoltageelectricalconnectionstop = 35 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Low Voltage Electrical Connections Top in mm [AIF-MANAGED]")custom float aif:spec:maximumCoolingCapacity = 2.3 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Cooling Capacity [AIF-MANAGED]")custom int aif:spec:maximumDewPoint = 17 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Dew Point in Kelvin [AIF-MANAGED]")custom float aif:spec:maximumFlow = 0.06 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Flow 3x Pump Running in cubic meter/second [AIF-MANAGED]")custom float aif:spec:maximumFluidFlow = 0.06 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Fluid Flow Running in cubic meter/second [AIF-MANAGED]")custom string aif:spec:maximumPowerConsumption2XPumps = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Power Consumption (2x Pumps) at maximum flow and external pressure drop [AIF-MANAGED]")custom string aif:spec:maximumPowerConsumption3XPumps = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Maximum Power Consumption (3x Pumps) at maximum flow and external pressure drop [AIF-MANAGED]")custom string aif:spec:maxSpeed = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Max speed of EC fans [Hz] [AIF-MANAGED]")custom string aif:spec:monitoring = "Base comms and connectivity" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Monitoring [AIF-MANAGED]")custom string aif:spec:motorPowerInfo = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Motor/Pump Power Info [AIF-MANAGED]")custom int aif:spec:motorSelection = 15 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Motor Selection in HP [AIF-MANAGED]")custom string aif:spec:motorSize = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Motor/Pump Size [AIF-MANAGED]")custom string aif:spec:mountStyle = "In Row" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Mount Style: In Row, In Rack [AIF-MANAGED]")custom int aif:spec:nominalCoolingCapacity = 2300 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Nominal Cooling Capacity in KW [AIF-MANAGED]")custom string aif:spec:nominalFlow = "449 GPM (1700 LPM) single pump; 898 GPM (3400 LPM) two pumps" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Nominal Flow 2x Pump Running in cubic meter/second [AIF-MANAGED]")custom int aif:spec:nominalVoltage = 460 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Nominal Voltage in Volt [AIF-MANAGED]")custom int aif:spec:numberOfPumps = 2 (doc = "Number of pumps [AIF-MANAGED]")custom string aif:spec:optionPackages = "Low voltage terminal package" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Option Packages [AIF-MANAGED]")custom string aif:spec:packaging = "Domestic" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Packaging [AIF-MANAGED]")custom string aif:spec:pipingConnection = "Top" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Piping Connection [AIF-MANAGED]")custom string aif:spec:powerFactor = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Power Factor [AIF-MANAGED]")custom string aif:spec:powerFactorRotatingEquipment = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Power Factor Rotating Equipment [AIF-MANAGED]")custom string aif:spec:powerMeter = "None" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Power Meter [AIF-MANAGED]")custom string aif:spec:powerRating = "42 kW electrical (2 × 21.17 kW/pump)" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Electrical Power Rating in KW [AIF-MANAGED]")custom string aif:spec:powerTransferDesign = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Power Transfer Design [AIF-MANAGED]")custom string aif:spec:powerTransferDevice = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Power Transfer Device [AIF-MANAGED]")custom string aif:spec:primaryCircuitVolume = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary Circuit Volume in Liters [AIF-MANAGED]")custom string aif:spec:primaryControl = "2 Way" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary Control of Modulating Control [AIF-MANAGED]")custom int aif:spec:primaryFiltration = 50 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary Filtration External with bypass to enable cleaning [AIF-MANAGED]")custom int aif:spec:primaryInletTemperature = 32 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary Inlet Temperature in degree kelvin [AIF-MANAGED]")custom string aif:spec:primaryToSecondaryFluidType = "Refrigerant AC to liquid" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Primary to secondary fluid type [AIF-MANAGED]")custom string aif:spec:productFamily = "Liebert XDU Coolant Distribution Unit " (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Product Family [AIF-MANAGED]")custom string aif:spec:productType = "Liquid-to-Refrigerant Coolant Distribution Unit" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Product Type [AIF-MANAGED]")custom string aif:spec:pumpFlowCurve = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Pump flow curve: (CMS vs KPa) (5 points on curve required) [AIF-MANAGED]")custom string aif:spec:pumpRedundancyStrategyCoolingCapacity = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Pump redundancy strategy for Cooling Capacity [AIF-MANAGED]")custom string aif:spec:pumpRedundancyStrategyPumps = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Pump redundancy strategy for pumps [AIF-MANAGED]")custom string aif:spec:ratedCableSize = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated Cable Size [AIF-MANAGED]")custom int aif:spec:ratedHp = 46 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated HP [AIF-MANAGED]")custom float aif:spec:ratedMaxPower = 47.8 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated Max Power [AIF-MANAGED]")custom string aif:spec:ratedSpeed = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated speed [Hz] [AIF-MANAGED]")custom string aif:spec:ratedVoltageIncomingPower = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated Voltage Incoming Power [AIF-MANAGED]")custom string aif:spec:ratedVoltageRotatingEquipment = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Rated Voltage Rotating Equipment [AIF-MANAGED]")custom string aif:spec:redundancyScheme = "Independent module operation" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Redundancy Scheme [AIF-MANAGED]")custom string aif:spec:referenceFacilityCoolantTemperature = "" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Reference facility coolant temperature in Kelvin [AIF-MANAGED]")custom int aif:spec:referenceSecondaryCoolantTemperature = 25 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Reference Secondary Coolant Temperature in Kelvin range [AIF-MANAGED]")custom float aif:spec:referenceTechnologyCoolantFlowRate = 5.68 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Reference technology coolant flow rate in LPM [AIF-MANAGED]")custom string aif:spec:refrigerant = "R-410A" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Refrigerant [AIF-MANAGED]")custom string aif:spec:remoteSensor = "30' Remote temp and humidity sensor" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Remote Sensor [AIF-MANAGED]")custom int aif:spec:returnAirTemperature = 10 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Return Air Temperature in Kelvin [AIF-MANAGED]")custom string aif:spec:secondaryCircuitFiltration = "None" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Secondary Circuit Filtration [AIF-MANAGED]")custom int aif:spec:secondaryCircuitVolume = 220 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Secondary Circuit Volume in Liters [AIF-MANAGED]")custom int aif:spec:secondaryDeltaT = 36 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Secondary Delta T in degree kelvin [AIF-MANAGED]")custom string aif:spec:secondaryFiltration = "50 or 25" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Secondary Filtration External with bypass to enable cleaning [AIF-MANAGED]")custom int aif:spec:secondaryOutletTemperature = 36 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Secondary Outlet Temperature in degree kelvin [AIF-MANAGED]")custom int aif:spec:shortCircuitCurrent = 65000 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Short Circuit Current in Ampere [AIF-MANAGED]")custom string aif:spec:systemType = "Modular Distribution Unit" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "System Type [AIF-MANAGED]")custom int aif:spec:tcsReturnPipingConnection = 150 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "TCS Return piping connection in mm hygienic flanges top or bottom with Unique Id [AIF-MANAGED]")custom int aif:spec:tcsSupplyPipingConnection = 150 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "TCS Supply piping connection in mm hygienic flanges top or bottom with Unique Id [AIF-MANAGED]")custom int aif:spec:totalHeatDissipated = 60 (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Total heat dissipated [kW] [AIF-MANAGED]")custom string aif:spec:wettedMaterialFws = "Copper" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Wetted Material List for FWS [AIF-MANAGED]")custom string aif:spec:wettedMaterialTcs = "Stainless Steel" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Wetted Material List for TCS [AIF-MANAGED]")custom string aif:spec:wiringMethod = "Secondary closed loop circuit" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Wiring Method [AIF-MANAGED]")custom string aif:spec:workingFluidCoolingCapacity = "PG -25 with inhibitors" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Working fluid for Cooling Capacity in KW [AIF-MANAGED]")custom string aif:spec:workingFluidPumps = "Water or PG-25 with inhibitors" (customData = {dictionary omni = {dictionary kit = {bool locked = 1}}}doc = "Working fluid for pumps [AIF-MANAGED]")}
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112/****************************************************************************** * Copyright 2023 NVIDIA Corporation. All rights reserved. * ****************************************************************************** Permission is hereby granted by NVIDIA Corporation ("NVIDIA"), free of charge,to any person obtaining a copy of the sample definition code that uses our Material Definition Language (the "MDL Materials"), to reproduce and distributethe MDL Materials, including without limitation the rights to use, copy, merge,publish, distribute, and sell modified and unmodified copies of the MDL Materials, and to permit persons to whom the MDL Materials is furnished to doso, in all cases solely for use with NVIDIA's Material Definition Language,subject to the following further conditions:
1. The above copyright notices, this list of conditions, and the disclaimerthat follows shall be retained in all copies of one or more of the MDLMaterials, including in any software with which the MDL Materials are bundled,redistributed, and/or sold, and included either as stand-alone text files,human-readable headers or in the appropriate machine-readable metadata fieldswithin text or binary files as long as those fields can be easily viewed by theuser, as applicable.2. The name of NVIDIA shall not be used to promote, endorse or advertise any Modified Version without specific prior written permission, except a) to comply with the notice requirements otherwise contained herein; or b) to acknowledgethe contribution(s) of NVIDIA.
THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSOR 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 USETHE MDL MATERIALS OR FROM OTHER DEALINGS IN THE MDL MATERIALS.*/
mdl 1.6;import ::df::*;import ::math::*;import ::anno::*;import ::state::*;import ::base::*;import ::tex::*;import ::nvidia::core_definitions::dimension;import ::nvidia::core_definitions::blend_colors;
const string COPYRIGHT = " Copyright 2023 NVIDIA Corporation. All rights reserved.\n"" MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT,\n"" WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR,\n" " THE MDL MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n"" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\n"" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\n" " COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA\n"" CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY\n"" GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN\n"" AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR\n"" INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN THE MDL MATERIALS.\n";
::base::texture_coordinate_info transform_coordinate_2( float4x4 transform [[ ::anno::description("A transformation to be applied to the source coordinates. rotation_translation_scale() is a suggested means to compute the transformation matrix") ]], ::base::texture_coordinate_info coordinate = ::base::texture_coordinate_info() [[ ::anno::description("Coordinate, typically sourced from coordinate_source or coordinate_projection") ]]) [[ ::anno::description("Transform a texture coordinate by a matrix") , ::anno::noinline() ]]{ // Version 2 float4 r_position = transform * float4(coordinate.position.x,coordinate.position.y,coordinate.position.z,1); //Try aproximating it for the case that the rotation is only aroud z and assuming the texture layout is nice and z is ~constant. //just pretend there is no other rotation happening //get rid of scaling and translation. Then extract fields where sin and cos would be in a simple 2d transform around z. float4 u = transform[0]; float3 ru = ::math::normalize(float3(u.x,u.y,u.z)); float cos = ru.x; float sin = -ru.y; return ::base::texture_coordinate_info( float3(r_position.x,r_position.y,r_position.z), ::math::normalize(cos * coordinate.tangent_u - sin * coordinate.tangent_v), ::math::normalize(cos * coordinate.tangent_v + sin * coordinate.tangent_u));}
// Takes the standard input that every material has. It combines a couple of// functions in one convenience function.::base::texture_coordinate_info vmat_transform( float2 translation = float2(0.0f, 0.0f), float rotation = 0.0f, // rotation in degrees float2 scaling = float2(1.0f, 1.0f), uniform ::base::texture_coordinate_system system = ::base::texture_coordinate_uvw, uniform int uv_space = 0){ float rotation_rad = (rotation * 3.1415926535897932384626433832f) / 180.f; float4x4 scale = float4x4(1.0f /scaling.x, 0.f , 0.f , 0.f, 0.f , 1.0f /scaling.y , 0.f , 0.f, 0.f , 0.f , 1.0f, 0.f, translation.x , translation.y , 0.0f, 1.f);
float s = ::math::sin(rotation_rad); float c = ::math::cos(rotation_rad); float4x4 rotate = float4x4( c , -s , 0.0f , 0.0f, s , c , 0.0f , 0.0f, 0.0f, 0.0f , 1.0f , 0.0f, 0.f , 0.0f , 0.0f , 1.f); return transform_coordinate_2(scale*rotate, ::base::coordinate_source(system, uv_space));}
float histogram_range(float input, float range = 1.0f, float position = 0.5f){ float low = ::math::clamp(1.0f - ::math::min(((1.0f - position) + range * 0.5f), (1.0f - position) * 2), 0.0f, 1.0f); float high = ::math::clamp(::math::min((position + range * 0.5f ), position * 2.0f), 0.0f, 1.0f); return ::math::lerp(low, high, input);}
//// flake noise utilities//int hash(int seed, int i){ return (i ^ seed) * 1075385539;}int rnd_init(int3 pos){ return hash(hash(hash(0, pos.x), pos.y), pos.z);}
int rnd_next(int seed) { // xorshift32 using signed int seed ^= seed << 13; seed ^= seed >>> 17; seed ^= seed << 5; return seed;}
float rnd_value(int seed){ //return ::math::abs(float(seed) * 4.6566fe-10f); return ::math::abs(float(seed) * 0.00000000046566f);}
// apply random rotation (using "Fast Random Rotation Matrices" by James Arvo)float3 rotate_pos(float3 pos, float3 xi){ float theta = ::math::PI * 2.0f * xi.x; float phi = ::math::PI * 2.0f * xi.y; float z = xi.z * 2.0f;
float r = ::math::sqrt(z); float[2] sp_cp = ::math::sincos(phi); float Vx = sp_cp[0] * r; float Vy = sp_cp[1] * r; float Vz = ::math::sqrt(2.0f - z);
float[2] st_ct = ::math::sincos(theta); float Sx = Vx * st_ct[1] - Vy * st_ct[0]; float Sy = Vx * st_ct[0] + Vy * st_ct[1];
float3x3 M( Vx * Sx - st_ct[1], Vx * Sy - st_ct[0], Vx * Vz, Vy * Sx + st_ct[0], Vy * Sy - st_ct[1], Vy * Vz, Vz * Sx, Vz * Sy, 1.0f - z);
return M * pos;}
struct flake_noise_value { // flake priority (in [0..1], 0: no flake, flakes with higher priority shadow flakes "below" them) float priority; // Stores values from the functions (once normal, another time the color) // current pseudo random number generator seed int rnd_seed; float4 carrier; };
// flake noise function with controllable regularity, flake size, and probabilityflake_noise_value flake_noise( float3 pos, float jitter_scale = 1.0f, float flake_diameter = 0.75f, float flake_probability = 1.0f){ float3 base_pos = ::math::floor(pos); int3 base_pos_i = int3(base_pos);
// limit the flake size to the allowed maximum (such that looking at all neighbors is sufficient) flake_diameter = ::math::min(flake_diameter, (1.5f - 0.5f * jitter_scale) / ::math::sqrt(3.0f)); flake_noise_value val(0.0f, 0, float4(0.0f));
for (int i = -1; i < 2; ++i) { for (int j = -1; j < 2; ++j) { for (int k = -1; k < 2; ++k) {
int seed = rnd_init(base_pos_i + int3(i, j, k));
seed = rnd_next(seed); if (rnd_value(seed) > flake_probability) continue;
seed = rnd_next(seed); float priority = rnd_value(seed); if (priority < val.priority) continue;
float3 flake_pos = base_pos + float3(i, j, k) + float3(0.5f);
if (jitter_scale > 0.0f) { seed = rnd_next(seed); flake_pos.x += (rnd_value(seed) - 0.5f) * jitter_scale; seed = rnd_next(seed); flake_pos.y += (rnd_value(seed) - 0.5f) * jitter_scale; seed = rnd_next(seed); flake_pos.z += (rnd_value(seed) - 0.5f) * jitter_scale; }
float3 p = pos - flake_pos; if (::math::dot(p, p) >= flake_diameter * flake_diameter * 4.0f) continue;
float3 xi_rot; seed = rnd_next(seed); xi_rot.x = rnd_value(seed); seed = rnd_next(seed); xi_rot.y = rnd_value(seed); seed = rnd_next(seed); xi_rot.z = rnd_value(seed); p = rotate_pos(p, xi_rot); if (::math::abs(p.x) <= flake_diameter && ::math::abs(p.y) <= flake_diameter && ::math::abs(p.z) <= flake_diameter) { val.priority = priority; val.rnd_seed = seed; } } } }
return val;}
// create a flake normal by importance sampling the Beckmann distribution with given roughnessflake_noise_value flake_normal( flake_noise_value val, float spread){ if (val.priority <= 0.0f) { val.carrier = float4(::state::normal().x, ::state::normal().y, ::state::normal().z, 1.0f); return val; } int seed = rnd_next(val.rnd_seed); float xi0 = rnd_value(seed); seed = rnd_next(seed); float xi1 = rnd_value(seed); float phi = ::math::PI * 2.0f * xi0;
float roughness = spread * spread;
float tantheta = ::math::sqrt(-roughness * roughness * ::math::log(1.0f - xi1)); float sintheta = tantheta / ::math::sqrt(1.0f + tantheta * tantheta); float costheta = ::math::sqrt(1.0f - sintheta * sintheta);
float[2] scphi = ::math::sincos(phi); val.rnd_seed = seed;
float3 normal = ::state::texture_tangent_u(0) * scphi[1] * sintheta + ::state::texture_tangent_v(0) * scphi[0] * sintheta + ::state::normal() * costheta; val.carrier = float4(normal.x, normal.y, normal.z, 1.0f); return val; }
export material Carpaint_Solid( color base_color = color(0.002125f, 0.051269f, 0.046665f) [[ ::anno::description("Sets the base color of the carpaint"), ::anno::display_name("Base "), ::anno::in_group("Appearance"), ::anno::ui_order(0) ]], float ground_coat_influence = 0.9f [[ ::anno::description("The ground coat layer is a metallic base layer over which the base color coat, the flakes and the clearcoat are applied. Use the parameter 'Ground Coat Brightness' to adjust its brightness."), ::anno::display_name("Base Coat Influence"), ::anno::in_group("Appearance"), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(1) ]], float ground_coat_brightness = 0.24f [[ ::anno::description("Adjusts the brightness of the metallic ground coat over which the base color coat, the flakes and the clearcoat are applied. Only has an effect, if the Ground Coat Influence is greater than 0.0"), ::anno::display_name("Base Coat Brightness"), ::anno::in_group("Appearance"), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(2) ]], float edge_darkening = 0.96f [[ ::anno::description("The amount how much colors fade to darker color when looking at the carpaint at grazing angles. Low values make the carpaint look more flat"), ::anno::display_name("Edge Darkening"), ::anno::in_group("Appearance"), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(3) ]], color flakes_tint = color(0.016807f, 0.171441f, 0.417885f) [[ ::anno::description("The color of the flakes"), ::anno::display_name("Flakes Tint"), ::anno::in_group("Flakes"), ::anno::ui_order(4) ]], uniform float flakes_density = 0.29f [[ ::anno::description("Adjusts the density of the flakes. Lower number means less flake particles being applied."), ::anno::display_name("Flakes Density"), ::anno::in_group("Flakes"), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(5) ]], float spread = 0.12f [[ ::anno::description("The amount how much flakes are pointing to random directions. It is strongly discouraged using a value of 0.0 as the flakes will be oriented exactly as the surface normal, which will result in an unnatural look. Higher values lead to a more scintillating look of the flakes."), ::anno::display_name("Flakes Spread"), ::anno::enable_if("flakes_density > 0.0f"), ::anno::in_group("Flakes"), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(6) ]], float flakes_roughness = 0.46f [[ ::anno::description("The roughness of the flakes itself. Higher values smoothen out the look of the flakes. Depending on the flakes being used in carpaints, use low values for a sparkling flake effect while mica flakes tend to have a higher roughness, leading to a smoother more pearlescent look on the final carpaint"), ::anno::display_name("Flakes Roughness"), ::anno::enable_if("flakes_density > 0.0f"), ::anno::in_group("Flakes"), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(7) ]], float flakes_size = 0.1f [[ ::anno::description("Size of the metal flakes in millimeters."), ::anno::display_name("Flakes Size (mm)"), ::anno::enable_if("flakes_density > 0.0f"), ::anno::soft_range(0.f, 1.f), ::anno::in_group("Flakes"), ::anno::ui_order(8) ]], float candy_flip = 0.f [[ ::anno::description("Changes the tint of the coating to fade towards the flake color to produce a candy paint effect. "), ::anno::display_name("Candy Coating"), ::anno::in_group("Flakes"), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(9) ]], float flake_layer_visibility = 0.f [[ ::anno::description("Adjusts how much the flakes contribute to the final look. Lowering the value makes the flakes appear more transparent. At value of 0.0 no flakes are not rendered at all"), ::anno::display_name("Flakes Visibility"), ::anno::enable_if("flakes_density > 0.0f"), ::anno::in_group("Flakes"), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(10) ]], uniform texture_2d roughness_texture = texture_2d("./textures/smudges_scratches_A_rough.jpg", ::tex::gamma_linear) [[ ::anno::description("Texture to use for adding variation to the roughness on the clearcoat"), ::anno::display_name("Roughness Texture"), ::anno::in_group("Clearcoat"), ::anno::ui_order(11) ]], float clearcoat_rough = 0.f [[ ::anno::description("The roughness of the clearcoat"), ::anno::display_name("Clearcoat Roughness"), ::anno::in_group("Clearcoat"), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(12) ]], float roughness_variation = 0.f [[ ::anno::description("The amount of variation to apply to the roughness. This parameter only has an effect when the clearcoat roughness is not zero or one"), ::anno::display_name("Clearcoat Roughness Variation"), ::anno::in_group("Clearcoat"), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(13) ]], float clearcoat_ior = 1.600f [[ ::anno::description("The index of refraction for the clearcoat layer"), ::anno::display_name("Clearcoat Index of Refraction"), ::anno::in_group("Clearcoat"), ::anno::soft_range(1.f, 3.f), ::anno::hard_range(1.f, 5.f), ::anno::ui_order(14) ]], float clearcoat_visibility = 1.f [[ ::anno::description("While the full value is the correct physical behavior of the clearcoat, lowering the value to reduce the amount of reflection for artistic purposes"), ::anno::display_name("Clearcoat Visibility"), ::anno::in_group("Clearcoat"), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(15) ]], uniform float orange_peel_strength = 0.f [[ ::anno::description("Strength of the bump mapping effect"), ::anno::display_name("Coat Orange Peel Strength"), ::anno::in_group("Clearcoat"), ::anno::soft_range(0.f, 1.f), ::anno::hard_range(0.f, 1.f), ::anno::ui_order(16) ]], uniform float orange_peel_size = 1.f [[ ::anno::description("Size of the biggest feature of the pattern"), ::anno::display_name("Coat Orange Peel Size"), ::anno::soft_range(0.f, 1.f), ::anno::in_group("Clearcoat"), ::anno::ui_order(17) ]], float2 texture_translate = float2(0.f) [[ ::anno::description("Controls the position of the texture."), ::anno::display_name("Texture Translate"), ::anno::in_group("Transform"), ::anno::ui_order(18) ]], float texture_rotate = 0.f [[ ::anno::description("Rotates angle of the texture in degrees."), ::anno::display_name("Texture Rotate"), ::anno::in_group("Transform"), ::anno::soft_range(0.f, 360.f), ::anno::ui_order(19) ]], float2 texture_scale = float2(1.f) [[ ::anno::description("Larger numbers increase the size."), ::anno::display_name("Texture Scale"), ::anno::in_group("Transform"), ::nvidia::core_definitions::dimension(float2(1.0, 1.0)), ::anno::ui_order(20) ]], uniform bool roundcorners_enable = false [[ ::anno::description("Enables the round corneer effect. Comes at a slight performance cost as additional raytracing calls are rquired to evaluate the round corner effect"), ::anno::display_name("Enable Round Corners"), ::anno::in_group("Round Corners"), ::anno::ui_order(22) ]], uniform float roundcorners_radius_mm = 1.5f [[ ::anno::description("Radius of the rounded corners in millimeters"), ::anno::display_name("Round Corner Radius (mm)"), ::anno::in_group("Round Corners"), ::anno::soft_range(0.f, 10.f), ::anno::ui_order(23) ]], uniform bool roundcorners_across_materials = false [[ ::anno::description("Applies the round corner effect across different materials when enabled."), ::anno::display_name("Across Materials"), ::anno::in_group("Round Corners"), ::anno::ui_order(27) ]], uniform int uv_space_index = 0 [[ ::anno::description("Use selected UV space for material."), ::anno::display_name("UV Space Index"), ::anno::in_group("Advanced"), ::anno::ui_order(28) ]] )[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "shiny", "flakes", "metallic", "glitter", "pigment", "clearcoat", "automotive", "design")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Carpaint_Solid.png"), ::anno::copyright_notice(COPYRIGHT)]] = let { bool tmp0 = false; // Tried Scaling factors for flakes to fit 1mm size both in Substance Designer and (Iray for) Rhino // Rhino scaling factor: 1492.537313432835 // Substance Designer Scaling factor: 1158.6829010512 float flakes_size_m = (1492.537313432835f/flakes_size); // Flake scaling adjustment, so that flake size is in mm float flake_layer_visibility_m = 1.0f - flake_layer_visibility; ::base::texture_coordinate_info coord_info = ::base::coordinate_source(::base::texture_coordinate_object, 0); float scale_trans = ::state::transform_scale(::state::coordinate_object, ::state::coordinate_world, 1.0f); float3 source_coord = coord_info.position * ::state::meters_per_scene_unit() * scale_trans; ::base::texture_coordinate_info transformed_coord = ::base::transform_coordinate( ::base::rotation_translation_scale(float3(0.0f), float3(0.0f), float3(scale_trans)), coord_info ); material_surface tmp1(::df::fresnel_layer(clearcoat_ior, clearcoat_visibility, ::df::simple_glossy_bsdf(histogram_range(::base::file_texture(roughness_texture, color(0.f, 0.f, 0.f), color(1.f, 1.f, 1.f), ::base::mono_average, vmat_transform(texture_translate, texture_rotate, texture_scale, ::base::texture_coordinate_uvw, uv_space_index), float2(0.f, 1.f), float2(0.f, 1.f), ::tex::wrap_repeat, ::tex::wrap_repeat, false).mono, roughness_variation, clearcoat_rough) * histogram_range(::base::file_texture(roughness_texture, color(0.f, 0.f, 0.f), color(1.f, 1.f, 1.f), ::base::mono_average, vmat_transform(texture_translate, texture_rotate, texture_scale, ::base::texture_coordinate_uvw, uv_space_index), float2(0.f, 1.f), float2(0.f, 1.f), ::tex::wrap_repeat, ::tex::wrap_repeat, false).mono, roughness_variation, clearcoat_rough), histogram_range(::base::file_texture(roughness_texture, color(0.f, 0.f, 0.f), color(1.f, 1.f, 1.f), ::base::mono_average, vmat_transform(texture_translate, texture_rotate, texture_scale, ::base::texture_coordinate_uvw, uv_space_index), float2(0.f, 1.f), float2(0.f, 1.f), ::tex::wrap_repeat, ::tex::wrap_repeat, false).mono, roughness_variation, clearcoat_rough) * histogram_range(::base::file_texture(roughness_texture, color(0.f, 0.f, 0.f), color(1.f, 1.f, 1.f), ::base::mono_average, vmat_transform(texture_translate, texture_rotate, texture_scale, ::base::texture_coordinate_uvw, uv_space_index), float2(0.f, 1.f), float2(0.f, 1.f), ::tex::wrap_repeat, ::tex::wrap_repeat, false).mono, roughness_variation, clearcoat_rough), nvidia::core_definitions::blend_colors(color(1.f, 1.f, 1.f), flakes_tint, ::base::color_layer_blend, candy_flip).tint, nvidia::core_definitions::blend_colors(color(1.f, 1.f, 1.f), flakes_tint, ::base::color_layer_blend, candy_flip).tint, ::state::texture_tangent_u(0), ::df::scatter_reflect), ::df::directional_factor(color(1.f, 1.f, 1.f), color(1.f - edge_darkening), 1.f, flakes_density > 0.f ? ::df::weighted_layer(::math::lerp(flake_noise(source_coord * flakes_size_m, 0.5f, 1.f, flakes_density * flakes_density).priority > 0.001f ? 1.0f : 0.0f , 0.f, flake_layer_visibility_m), ::df::microfacet_ggx_smith_bsdf(flakes_roughness * 0.340000004f, flakes_roughness * 0.340000004f, flakes_tint, color(0.f, 0.f, 0.f), ::state::texture_tangent_u(0), ::df::scatter_reflect), ::df::directional_factor(base_color, color(1.f - edge_darkening), 1.f, ::df::weighted_layer(ground_coat_influence * 0.5f, ::df::microfacet_ggx_vcavities_bsdf(0.40959999f, 0.40959999f, color(ground_coat_brightness * 0.949999988f + 0.0500000007f), color(ground_coat_brightness * 0.949999988f + 0.0500000007f), ::state::texture_tangent_u(0), ::df::scatter_reflect), ::df::diffuse_reflection_bsdf(base_color, 0.f), ::state::normal())), float3(flake_normal(flake_noise(source_coord * flakes_size_m, 0.5f, 1.f, flakes_density * flakes_density ), spread).carrier.x, flake_normal(flake_noise(source_coord * flakes_size_m, 0.5f, 1.f, flakes_density * flakes_density ), spread).carrier.y, flake_normal(flake_noise(source_coord * flakes_size_m, 0.5f, 1.f, flakes_density * flakes_density ), spread).carrier.z)) : ::df::directional_factor(base_color, color(1.f - edge_darkening), 1.f, ::df::weighted_layer(ground_coat_influence * 0.5f, ::df::microfacet_ggx_vcavities_bsdf(0.40959999f, 0.40959999f, color(ground_coat_brightness * 0.949999988f + 0.0500000007f), color(ground_coat_brightness * 0.949999988f + 0.0500000007f), ::state::texture_tangent_u(0), ::df::scatter_reflect), ::df::diffuse_reflection_bsdf(base_color, 0.f), ::state::normal()))), orange_peel_strength > 0.f ? ::base::perlin_noise_bump_texture(transformed_coord, orange_peel_strength, orange_peel_size, false, false, 0.f, 2, false, false, float3(0.f), 1.f, 0.f, 1.f, ::state::normal()) : ::state::normal()), material_emission(emission: edf(), intensity: color(0.f, 0.f, 0.f), mode: intensity_radiant_exitance)); material_surface tmp2 = material_surface(scattering: bsdf(), emission: material_emission(emission: edf(), intensity: color(0.f, 0.f, 0.f), mode: intensity_radiant_exitance)); color tmp3 = color(1.f, 1.f, 1.f); material_volume tmp4 = material_volume(scattering: vdf(), absorption_coefficient: color(0.f, 0.f, 0.f), scattering_coefficient: color(0.f, 0.f, 0.f)); material_geometry tmp5(float3(0.f), 1.f, roundcorners_enable ? ::state::rounded_corner_normal(roundcorners_radius_mm * 0.00100000005f, roundcorners_across_materials, 1.f) : ::state::normal()); hair_bsdf tmp6 = hair_bsdf(); } in material( thin_walled: tmp0, surface: tmp1, backface: tmp2, ior: tmp3, volume: tmp4, geometry: tmp5, hair: tmp6);
// ------------------- 2 (Plain White) -------------------export material White(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - White"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "white", "light", "neutral")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.White.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.768151f, 0.768151f, 0.768151f), ground_coat_influence: 0.0f, ground_coat_brightness: 0.24f, edge_darkening: 0.56f, flakes_tint: color(0.552011f, 0.552011f, 0.552011f), flakes_density: 0.0f, spread: 0.47f, flakes_roughness: 0.34f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 1.0f, // roughness_texture: clearcoat_rough: 0.05f, roughness_variation: 0.34f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 3 (vintage White) -------------------export material Vintage_White(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Vintage White"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "vintage", "white", "light", "neutral")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Vintage_White.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.672443f, 0.630757f, 0.502886f), ground_coat_influence: 0.0f, ground_coat_brightness: 0.24f, edge_darkening: 0.28f, flakes_tint: color(0.603827f, 0.665387f, 0.693872f), flakes_density: 0.0f, spread: 0.41f, flakes_roughness: 0.32f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.05f, roughness_variation: 0.34f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.06f, orange_peel_size: 0.01f);
// ------------------- 4 (Black) -------------------export material Black(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Black"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "black", "dark", "neutral")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Black.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.006049f, 0.006049f, 0.006049f), ground_coat_influence: 0.97f, ground_coat_brightness: 0.17f, edge_darkening: 0.57f, flakes_tint: color(0.552011f, 0.552011f, 0.552011f), flakes_density: 0.0f, spread: 0.47f, flakes_roughness: 0.34f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.05f, roughness_variation: 0.36f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 5 (Black Matte) -------------------export material Black_Matte(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Black Matte"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "black", "dark", "neutral")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Black_Matte.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.006995f, 0.006995f, 0.006995f), ground_coat_influence: 0.11f, ground_coat_brightness: 0.64f, edge_darkening: 0.0f, flakes_tint: color(0.577580f, 0.577580f, 0.577580f), flakes_density: 0.12f, spread: 0.39f, flakes_roughness: 0.5f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.48f, roughness_variation: 0.14f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 6 -------------------export material Agent_Gray(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Agent Gray"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "gray", "neutral")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Agent_Gray.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.234551f, 0.254152f, 0.234551f), ground_coat_influence: 0.11f, ground_coat_brightness: 0.64f, edge_darkening: 0.0f, flakes_tint: color(0.644480f, 0.701102f, 0.644480f), flakes_density: 0.2f, spread: 0.25f, flakes_roughness: 0.5f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.06f, roughness_variation: 0.36f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 7 (Agent Gray Matte)-------------------export material Agent_Gray_Matte(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Agent Gray Matte"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "matte", "gray", "neutral")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Agent_Gray_Matte.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.234551f, 0.254152f, 0.234551f), ground_coat_influence: 0.11f, ground_coat_brightness: 0.64f, edge_darkening: 0.0f, flakes_tint: color(0.644480f, 0.701102f, 0.644480f), flakes_density: 0.21f, spread: 0.25f, flakes_roughness: 0.5f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.4f, roughness_variation: 0.14f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 8 (Blood Red)-------------------export material Blood_Red(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Blood Red"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "red", "warm", "saturated")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Blood_Red.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.462077f, 0.022174f, 0.015209f), ground_coat_influence: 0.03f, ground_coat_brightness: 0.24f, edge_darkening: 0.56f, flakes_tint: color(0.552011f, 0.552011f, 0.552011f), flakes_density: 0.0f, spread: 0.47f, flakes_roughness: 0.34f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.05f, roughness_variation: 0.36f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 9 (Tarreri Red)-------------------export material Tarreri_Red(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Tarreri Red"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "red", "warm", "saturated")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Tarreri_Red.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.672443f, 0.038204f, 0.026241f), ground_coat_influence: 0.03f, ground_coat_brightness: 0.24f, edge_darkening: 0.56f, flakes_tint: color(0.672443f, 0.095307f, 0.078187f), flakes_density: 0.0f, spread: 0.47f, flakes_roughness: 0.34f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.05f, roughness_variation: 0.36f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 10 (Dark Decent Red)-------------------export material Dark_Decent_Red(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Dark Decent Red"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "red", "warm", "dark")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Dark_Decent_Red.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.135633f, 0.012983f, 0.027321f), ground_coat_influence: 0.19f, ground_coat_brightness: 0.24f, edge_darkening: 0.1f, flakes_tint: color(0.135633f, 0.012983f, 0.027321f), flakes_density: 0.0f, spread: 0.38f, flakes_roughness: 0.18f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.05f, roughness_variation: 0.36f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 11 (Vintage Maroon)-------------------export material Vintage_Maroon(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Vintage Maroon"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "dark", "brown", "red")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Vintage_Maroon.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.283149f, 0.054480f, 0.063010f), ground_coat_influence: 0.19f, ground_coat_brightness: 0.24f, edge_darkening: 0.1f, flakes_tint: color(0.283149f, 0.054480f, 0.063010f), flakes_density: 0.0f, spread: 0.38f, flakes_roughness: 0.3f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.05f, roughness_variation: 0.36f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 12 -------------------export material Orange(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Orange"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "orange", "warm", "saturated")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Orange.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.623960f, 0.262251f, 0.022174f), ground_coat_influence: 0.11f, ground_coat_brightness: 0.64f, edge_darkening: 0.0f, flakes_tint: color(0.017642f, 0.262251f, 0.623960f), flakes_density: 0.59f, spread: 0.25f, flakes_roughness: 0.5f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.06f, roughness_variation: 0.36f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 13 (Brown Matte) -------------------export material Brown_Matte(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Brown Matte"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "brown", "matte")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Brown_Matte.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.300544f, 0.250158f, 0.187821f), ground_coat_influence: 0.11f, ground_coat_brightness: 0.64f, edge_darkening: 0.0f, flakes_tint: color(0.300544f, 0.250158f, 0.187821f), flakes_density: 0.0f, spread: 0.39f, flakes_roughness: 0.5f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.5f, roughness_variation: 0.14f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 14 (Bumblebee) -------------------export material Bumblebee(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Bumblebee"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "yellow", "warm", "light", "saturated")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Bumblebee.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.775822f, 0.564712f, 0.030713f), ground_coat_influence: 0.09f, ground_coat_brightness: 0.64f, edge_darkening: 0.1f, flakes_tint: color(1.000000f, 0.479320f, 0.095307f), flakes_density: 0.0f, spread: 0.54f, flakes_roughness: 0.37f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.06f, roughness_variation: 0.14f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 15 (Wasp) -------------------export material Wasp(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Wasp"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "yellow", "warm", "light", "saturated")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Wasp.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.701102f, 0.603827f, 0.022174f), ground_coat_influence: 0.0f, ground_coat_brightness: 0.5f, edge_darkening: 0.12f, flakes_tint: color(1.000000f, 0.479320f, 0.076185f), flakes_density: 0.0f, spread: 0.54f, flakes_roughness: 0.37f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.06f, roughness_variation: 0.14f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 16 (Feline Dark Green)-------------------export material Feline_Dark_Green(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Feline Dark Green"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "green", "dark")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Feline_Dark_Green.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.010330f, 0.099899f, 0.043735f), ground_coat_influence: 0.19f, ground_coat_brightness: 0.24f, edge_darkening: 0.1f, flakes_tint: color(0.010330f, 0.099899f, 0.043735f), flakes_density: 0.0f, spread: 0.38f, flakes_roughness: 0.3f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.05f, roughness_variation: 0.36f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 17 (Hunting Green Matte) -------------------export material Hunting_Green_Matte(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Hunting Green Matte"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "green", "dark", "matte")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Hunting_Green_Matte.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.162029f, 0.187821f, 0.114435f), ground_coat_influence: 0.11f, ground_coat_brightness: 0.64f, edge_darkening: 0.0f, flakes_tint: color(0.318547f, 0.456411f, 0.127438f), flakes_density: 0.0f, spread: 0.3f, flakes_roughness: 0.5f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.4f, roughness_variation: 0.14f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 18 (Vintage Sky Blue) -------------------export material Vintage_Sky_Blue(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Vintage Sky Blue"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "blue", "light", "cool")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Vintage_Sky_Blue.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.318547f, 0.564712f, 0.603827f), ground_coat_influence: 0.06f, ground_coat_brightness: 0.24f, edge_darkening: 0.0f, flakes_tint: color(0.603827f, 127.338437f, 0.693872f), flakes_density: 0.0f, spread: 0.41f, flakes_roughness: 0.32f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.06f, roughness_variation: 0.34f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.06f, orange_peel_size: 0.01f);
// ------------------- 19 (Blue)-------------------export material Blue(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Blue"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "blue", "cool", "saturated")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Blue.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.012983f, 0.296138f, 0.462077f), ground_coat_influence: 0.00f, ground_coat_brightness: 0.24f, edge_darkening: 0.0f, flakes_tint: color(0.012983f, 0.234551f, 0.665387f), flakes_density: 0.5f, spread: 0.47f, flakes_roughness: 0.34f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.06f, roughness_variation: 0.36f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);
// ------------------- 20 (Dark Decent Blue) -------------------export material Dark_Decent_Blue(*)[[ ::anno::author("NVIDIA"), ::anno::display_name("Carpaint Solid - Dark Decent Blue"), ::anno::description("Multilayered carpaint material with metallic flakes"), ::anno::key_words(string[]("carpaint", "reflective", "artificial", "multilayer", "new", "flat", "clearcoat", "automotive", "design", "blue", "cool", "dark")), ::anno::thumbnail("./.thumbs/Carpaint_Solid.Dark_Decent_Blue.png"), ::anno::copyright_notice(COPYRIGHT)]] = Carpaint_Solid( base_color: color(0.013702f, 0.046665f, 0.147027f), ground_coat_influence: 0.19f, ground_coat_brightness: 0.24f, edge_darkening: 0.1f, flakes_tint: color(0.012983f, 0.234551f, 0.665387f), flakes_density: 0.5f, spread: 0.25f, flakes_roughness: 0.34f, flakes_size: 0.5f, candy_flip: 0.0f, flake_layer_visibility: 0.0f, // roughness_texture: clearcoat_rough: 0.06f, roughness_variation: 0.36f, clearcoat_ior: 1.6f, clearcoat_visibility: 1.0f, orange_peel_strength: 0.0f, orange_peel_size: 0.01f);123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354mdl 1.4;
import ::OmniPBR::OmniPBR;import ::anno::author;import ::anno::description;import ::anno::display_name;import ::anno::key_words;import ::anno::version;import ::tex::gamma_mode;import ::state::normal;
export material Copper(*)[[ ::anno::display_name("Omni PBR "), ::anno::description("Omni PBR, supports ORM textures"), ::anno::version(1, 0, 0, ""), ::anno::author("NVIDIA CORPORATION"), ::anno::key_words(string[]("omni", "PBR", "omniverse", "generic"))]] = ::OmniPBR::OmniPBR( diffuse_color_constant: color(0.200000003f, 0.200000003f, 0.200000003f), diffuse_texture: texture_2d("./Copper/Copper_BaseColor.png" /* tag 3213, version 206360754 */, ::tex::gamma_srgb), albedo_desaturation: 0.f, albedo_add: 0.f, albedo_brightness: 1.f, diffuse_tint: color(1.f, 1.f, 1.f), reflection_roughness_constant: 0.5f, reflection_roughness_texture_influence: 1.f, reflectionroughness_texture: texture_2d(), metallic_constant: 0.f, metallic_texture_influence: 1.f, metallic_texture: texture_2d(), specular_level: 0.5f, enable_ORM_texture: true, ORM_texture: texture_2d("./Copper/Copper_ORM.png" /* tag 3215, version 3196730051 */, ::tex::gamma_linear), ao_to_diffuse: 0.f, ao_texture: texture_2d(), enable_emission: false, emissive_color: color(1.f, 0.100000001f, 0.100000001f), emissive_mask_texture: texture_2d(), emissive_intensity: 40.f, bump_factor: 1.f, normalmap_texture: texture_2d("./Copper/Copper_N.png" /* tag 3217, version 364891401 */, ::tex::gamma_linear), detail_bump_factor: 0.300000012f, detail_normalmap_texture: texture_2d(), project_uvw: false, world_or_object: false, uv_space_index: 0, texture_translate: float2(0.f), texture_rotate: 0.f, texture_scale: float2(1.f), detail_texture_translate: float2(0.f), detail_texture_rotate: 0.f, detail_texture_scale: float2(1.f));123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467/****************************************************************************** * Copyright 2023 NVIDIA Corporation. All rights reserved. ****************************************************************************** Permission is hereby granted by NVIDIA Corporation ("NVIDIA"), free of charge,to any person obtaining a copy of the sample definition code that uses our Material Definition Language (the "MDL Materials"), to reproduce and distributethe MDL Materials, including without limitation the rights to use, copy, merge,publish, distribute, and sell modified and unmodified copies of the MDL Materials, and to permit persons to whom the MDL Materials is furnished to doso, in all cases solely for use with NVIDIA's Material Definition Language,subject to the following further conditions:
1. The above copyright notices, this list of conditions, and the disclaimerthat follows shall be retained in all copies of one or more of the MDLMaterials, including in any software with which the MDL Materials are bundled,redistributed, and/or sold, and included either as stand-alone text files,human-readable headers or in the appropriate machine-readable metadata fieldswithin text or binary files as long as those fields can be easily viewed by theuser, as applicable.2. The name of NVIDIA shall not be used to promote, endorse or advertise any Modified Version without specific prior written permission, except a) to comply with the notice requirements otherwise contained herein; or b) to acknowledgethe contribution(s) of NVIDIA.
THE MDL MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSOR 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 USETHE MDL MATERIALS OR FROM OTHER DEALINGS IN THE MDL MATERIALS.*/
mdl 1.4;import ::df::*;import ::base::*;import ::anno::*;import ::math::*;import ::tex::*;import ::nvidia::core_definitions::*;
const string COPYRIGHT = " Copyright 2023 NVIDIA Corporation. All rights reserved.\n"" MDL MATERIALS ARE PROVIDED PURSUANT TO AN END USER LICENSE AGREEMENT,\n"" WHICH WAS ACCEPTED IN ORDER TO GAIN ACCESS TO THIS FILE. IN PARTICULAR,\n" " THE MDL MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n"" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\n"" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF\n" " COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL NVIDIA\n"" CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY\n"" GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN\n"" AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR\n"" INABILITY TO USE THE MDL MATERIALS OR FROM OTHER DEALINGS IN THE MDL MATERIALS.\n";
annotation preview_scale( float f);
uniform float4x4 rotation_translation_scale( uniform float3 rotation = float3(0.) [[ ::anno::description("Rotation applied to every UVW coordinate") ]], uniform float3 translation = float3(0.) [[ ::anno::description("Offset applied to every UVW coordinate") ]], uniform float3 scaling = float3(1.) [[ ::anno::description("Scale applied to every UVW coordinate") ]])[[ ::anno::description("Construct transformation matrix from Euler rotation, translation and scale"), ::anno::hidden()]]{ float4x4 scale = float4x4(scaling.x , 0. , 0. , 0., 0. , scaling.y , 0. , 0., 0. , 0. , scaling.z , 0., translation.x, translation.y, translation.z, 1.);
float3 s = ::math::sin(rotation); float3 c = ::math::cos(rotation); float4x4 rotate = float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0, c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0, -s.y , s.x*c.y , c.x*c.y , 0.0, 0. , 0 , 0 , 1.);
return scale*rotate;}
export material Felt_Plain ( color base_color = color(0.034230f, 0.373615f, 0.058187f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0f [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15f [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0f, 1.0f), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::preview_scale(1.8f), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Tournament Green"), ::anno::description("Felt template material from which all the other presets are derived"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "red", "warm")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Plain.png"), ::anno::hidden(), ::anno::copyright_notice(COPYRIGHT)]] = let{ // Felt Texture, the texture of the felt material uniform texture_2d felt_texture = texture_2d("./textures/felt_white_diff.jpg", ::tex::gamma_srgb); // Fuzz Texture uniform texture_2d felt_fuzz_texture = texture_2d("./textures/felt_fuzz_mask.jpg", ::tex::gamma_srgb);
::base::texture_coordinate_info uvw = ::base::coordinate_source( coordinate_system: ::base::texture_coordinate_uvw, texture_space: uv_space_index ); ::base::texture_coordinate_info transformed_uvw = ::base::transform_coordinate( transform: rotation_translation_scale( scaling: float3(8.f/texture_scale.x, 8.f/texture_scale.y, 1.0), rotation: float3(0.0, 0.0, texture_rotate/180.*::math::PI ), translation: float3(texture_translate.x, texture_translate.y, 0.0) ), coordinate: uvw ); ::base::texture_return felt_texture_return = ::base::file_texture( texture: felt_texture, mono_source: ::base::mono_alpha, uvw: transformed_uvw ); ::base::texture_return fuzz_texture_return = ::base::file_texture( texture: felt_fuzz_texture, color_scale: color(fuzz_opacity * 0.5), mono_source: ::base::mono_average, uvw: transformed_uvw ); ::base::texture_return tinted_felt_color = nvidia::core_definitions::blend_colors( color_1: felt_texture_return.tint, color_2: base_color, mode: ::base::color_layer_multiply, weight: 1.0 ); color felt_color = ::math::max(tinted_felt_color.tint, color((1.0-fill_dark_gaps) * 0.3) * base_color);
::base::texture_return final_color = nvidia::core_definitions::blend_colors( color_1: felt_color, color_2: color(1.0, 1.0, 1.0), mode: ::base::color_layer_blend, weight: fuzz_texture_return.mono ); float3 bump = ::nvidia::core_definitions::file_bump_texture( texture: felt_texture, bump_source: ::base::mono_average, scaling: float2 ((8.f/texture_scale.x), (8.f/ texture_scale.y)), translation: texture_translate, rotation: texture_rotate, clip: false, factor: bump_strength, texture_space: uv_space_index );
bsdf diffuse = ::df::diffuse_reflection_bsdf ( tint: final_color.tint ); bsdf base = ::df::custom_curve_layer( weight: felt_texture_return.mono * .15f, normal_reflectivity: 0.08, grazing_reflectivity: 1.0, exponent: 5.0, base: diffuse, layer: ::df::simple_glossy_bsdf( roughness_u: .85, tint: color(1.0, 1.0, 1.0) ) ); } in material ( surface: material_surface ( scattering: base ), geometry: material_geometry( normal: bump ));
// Redexport material Felt_Mat_Red ( color base_color = color(0.535642f, 0.007155f, 0.007155f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Red"), ::anno::description("Felt template material from which all the other presets are derived"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "red", "warm")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Red.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Burgundyexport material Felt_Mat_Burgundy ( color base_color = color(0.464741f, 0.014311f, 0.038473f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Burgundy"), ::anno::description("Felt template material from which all the other presets are derived"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "burgundy", "red", "warm")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Burgundy.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Brickexport material Felt_Mat_Brick ( color base_color = color(0.554227f, 0.061907f, 0.042987f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Brick"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "burgundy", "red", "warm")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Brick.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Brownexport material Felt_Mat_Brown ( color base_color = color(0.250840f, 0.071761f, 0.026549f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Brown"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "burgundy", "brown")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Brown.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Taupeexport material Felt_Mat_Taupe ( color base_color = color(0.197516f, 0.116576f, 0.091518) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Taupe"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "taupe", "brown")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Taupe.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Goldenexport material Felt_Mat_Golden ( color base_color = color(0.701170f, 0.431340f, 0.091518f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Golden"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "golden", "warm")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Golden.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Khakiexport material Felt_Mat_Khaki ( color base_color = color(0.487765f, 0.399293f, 0.242796f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Khaki"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "khaki", "brown")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Khaki.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Steel Grayexport material Felt_Mat_Steelgray ( color base_color = color(0.271577f, 0.302125f, 0.311180f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Steel Gray"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "neutral", "gray", "steel")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Steelgray.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Navy Blueexport material Felt_Mat_Navyblue ( color base_color = color(0.008373f, 0.023104f, 0.119264f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Navy Blue"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "navy", "blue", "dark", "cool")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Navyblue.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
export material Felt_Mat_Charcoal ( color base_color = color(0.035614f, 0.039947f, 0.041452f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Charcoal"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "charcoal", "dark")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Charcoal.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Euro Blueexport material Felt_Mat_Euroblue ( color base_color = color(0.011881f, 0.084642f, 0.632043f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Euro Blue"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "euro", "union", "cool", "blue", "saturated", "intense")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Euroblue.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
export material Felt_Mat_Electricblue ( color base_color = color(0.089194f, 0.325037f, 0.875138f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Electric Blue"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "electric", "blue", "cool")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Electricblue.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Academy Blueexport material Felt_Mat_Academyblue ( color base_color = color(0.007155f, 0.133209f, 0.535642f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Academy Blue"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "academy", "blue", "cool", "dark")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Academyblue.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Blackexport material Felt_Mat_Black ( color base_color = color(0.08f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Black"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "black", "neutral", "dark")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Black.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
// Dark Greenexport material Felt_Mat_Darkgreen ( color base_color = color(0.004560f, 0.106156f, 0.016068f) [[ ::anno::display_name("Base color"), ::anno::description("The base color of the material"), ::anno::in_group("Appearance") ]], float fill_dark_gaps = 1.0 [[ ::anno::display_name("Felt Contrast"), ::anno::description("Specifies how string the strong the occlusion in the texture shows through"), ::anno::hard_range(0.0f, 1.0f), ::anno::in_group("Appearance") ]], float fuzz_opacity = 0.15 [[ ::anno::display_name("Fuzz Opacity"), ::anno::soft_range(0.0, 1.0), ::anno::description("The amount of fuzz visible on the felt material"), ::anno::in_group("Appearance") ]],
/* Transform */ uniform float2 texture_translate = float2 ( 0.f) [[ ::anno::display_name("Translate"), ::anno::description("Controls the position of the texture."), ::anno::in_group("Transform") ]], uniform float texture_rotate = 0.f [[ ::anno::display_name("Rotate"), ::anno::description("Rotates angle of the texture in degrees."), ::anno::in_group("Transform") ]], uniform float2 texture_scale = float2 ( 1.f) [[ ::anno::display_name("Scale"), ::anno::description("Larger numbers increase the texture size."), ::nvidia::core_definitions::dimension(float2(1.0f, 1.0f)), ::anno::in_group("Transform") ]], /* Advanced */ uniform int uv_space_index = 0 [[ ::anno::display_name("UV Space Index"), ::anno::description("UV space index."), ::anno::hard_range(0,3), ::anno::in_group("Advanced") ]], uniform float bump_strength = 4.0 [[ ::anno::display_name("Bump Strength"), ::anno::soft_range(0.0f, 5.0f), ::anno::description("Controls the amount of the bump mapping effect"), ::anno::in_group("Appearance") ]]) [[ ::anno::display_name("Felt Dark Green"), ::anno::description("A soft felt material that can have fuzz on top"), ::anno::key_words (string[]("aec", "fabric", "felt", "fashion", "textile", "soft", "design", "fuzz", "green", "dark")), ::anno::author("NVIDIA vMaterials"), ::anno::thumbnail("./.thumbs/Felt_Plain.Felt_Mat_Darkgreen.png"), ::anno::copyright_notice(COPYRIGHT)]] = Felt_Plain( base_color: base_color, fill_dark_gaps: fill_dark_gaps, fuzz_opacity: fuzz_opacity, texture_translate: texture_translate, texture_rotate: texture_rotate, texture_scale: texture_scale, uv_space_index: uv_space_index, bump_strength: bump_strength);
123456789101112131415161718192021222324252627282930313233343536373839404142mdl 1.4;
using ::OmniPBR import OmniPBR;
import ::tex::gamma_mode;
import ::state::normal;
export material Rubber_Textured(*)
= OmniPBR(
diffuse_color_constant: color(0.500000, 0.500000, 0.500000),
diffuse_texture: texture_2d("./Rubber_Textured/Rubber_Textured_BaseColor.png", ::tex::gamma_srgb),
albedo_desaturation: 0.f,
albedo_add: 0.f,
albedo_brightness: 1.f,
diffuse_tint: color(1.f, 1.f, 1.f),
reflection_roughness_constant: 0.000000,
reflection_roughness_texture_influence: 1.f,
reflectionroughness_texture: texture_2d(),
metallic_constant: 0.000000,
metallic_texture_influence: 1.f,
metallic_texture: texture_2d(),
specular_level: 0.5f,
enable_ORM_texture: true,
ORM_texture: texture_2d("./Rubber_Textured/Rubber_Textured_ORM.png", ::tex::gamma_linear),
ao_to_diffuse: 0.f,
ao_texture: texture_2d(),
enable_emission: false,
emissive_color: color(1.000000, 1.000000, 1.000000),
emissive_mask_texture: texture_2d(),
emissive_intensity: 0.000000,
bump_factor: 1.f,
normalmap_texture: texture_2d("./Rubber_Textured/Rubber_Textured_Normal.png", ::tex::gamma_linear),
detail_bump_factor: 0.300000012f,
detail_normalmap_texture: texture_2d(),
project_uvw: false,
world_or_object: false,
uv_space_index: 0,
texture_translate: float2(0.f),
texture_rotate: 0.f,
texture_scale: float2(1.f),
detail_texture_translate: float2(0.f),
detail_texture_rotate: 0.f,
detail_texture_scale: float2(1.f));123version https://git-lfs.github.com/spec/v1oid sha256:09e3243c9d9fbc2c251ee0bd79b64523aec63b2ac377975c55aa4b75d399deaesize 18206478123version https://git-lfs.github.com/spec/v1oid sha256:0aba5dc1233f23dfcf68ec9103b7342fa8697f8505a0f59df3baaeb641c160a0size 18221452
123version https://git-lfs.github.com/spec/v1oid sha256:a3e04b57986c7ca65f9dec7b205930df8092cdf45acc28085c33cf7e0c353dc9size 11171578123version https://git-lfs.github.com/spec/v1oid sha256:bd54fe4441fba3fe73964f5df8c82a1671fb66cb72e21eecb86f56ab767672f1size 11171578
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127"""
Scene Optimizer Occluder Creation
=================================
Creates reference geometry to help Scene Optimizer's "findHiddenMeshes" processor
more easily identify internal components. The processor tests for hidden geometry
and uses this occluder as a reference to simplify internal component detection.
Workflow: Create Occluder -> findHiddenMeshes Testing -> Hide Internal Components
USD Concepts: Kit mesh commands, transform ops, scene hierarchy
"""
import omni.kit.commands
import omni.usd
from pxr import UsdGeom
def get_default_prim_path():
"""
Find appropriate parent prim for occluder geometry.
USD concepts: stage traversal, default prim, hierarchical paths
"""
stage = omni.usd.get_context().get_stage()
# USD: Get active stage context
if not stage:
print("Error: No stage available!")
return None
# USD: Get primary asset root from stage metadata
default_prim = stage.GetDefaultPrim()
if default_prim and default_prim.IsValid():
default_path = str(default_prim.GetPath())
print(f"Found default prim: {default_path}")
return default_path
else:
# USD: Fallback to first valid prim in scene hierarchy
for prim in stage.Traverse():
if prim.GetPath() != "/": # Skip pseudoroot
default_path = str(prim.GetPath())
print(f"No default prim found, using first prim: {default_path}")
return default_path
# If no prims exist, use root
print("No prims found, using root path")
return "/"
def create_cube_mesh():
"""
Create reference geometry to assist Scene Optimizer's "findHiddenMeshes" processor.
This geometry helps the processor identify internal components more efficiently.
USD concepts: Kit commands, mesh primitives, transform operations
"""
print("Creating 'Occluder' cube mesh using CreateMeshPrimCommand...")
# Get the default prim path
default_path = get_default_prim_path()
if default_path is None:
print("Could not determine default prim path")
return None
# USD: Build hierarchical path for occluder
if default_path == "/":
cube_path = "/Occluder"
else:
cube_path = f"{default_path}/Occluder"
try:
# Kit: High-level mesh creation (handles vertices, faces, normals, UVs)
result, path = omni.kit.commands.execute(
"CreateMeshPrimCommand",
prim_type="Cube",
prim_path=cube_path
)
if result:
print(f"Successfully created cube at: {path}")
# USD: Access newly created prim for transform setup
stage = omni.usd.get_context().get_stage()
cube_prim = stage.GetPrimAtPath(path)
if cube_prim.IsValid():
print("Setting transform properties...")
# USD: Apply Xformable schema for transform operations
xformable = UsdGeom.Xformable(cube_prim)
# USD: Position reference geometry to assist hidden mesh detection
translate_op = xformable.GetTranslateOp()
if not translate_op:
translate_op = xformable.AddTranslateOp()
translate_op.Set((0, -0.00106, 1.22138))
print(f"Set translation: (0, -0.00106, 1.22138)")
# USD: Identity rotation (axis-aligned cube)
rotate_op = xformable.GetRotateXYZOp()
if not rotate_op:
rotate_op = xformable.AddRotateXYZOp()
rotate_op.Set((0, 0, 0))
print(f"Set rotation: (0, 0, 0)")
# USD: Reference dimensions to help processor identify internal geometry
scale_op = xformable.GetScaleOp()
if not scale_op:
scale_op = xformable.AddScaleOp()
scale_op.Set((1.17346, 1.13044, 2.044)) # Helps processor distinguish internal components
print(f" Set scale: (1.17346, 1.13044, 2.044)")
print("Transform properties set successfully!")
else:
print("Warning: Could not access created prim to set transforms")
return path
else:
print("Failed to create cube with CreateMeshPrimCommand")
return None
except Exception as e:
print(f"Error with CreateMeshPrimCommand: {e}")
return None
create_cube_mesh()12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010"""
Extract Internal/External USD Files
Creates internal.usd and external.usd files by splitting geometry based on visibility states.
This module processes USD files to separate visible (external) and invisible (internal) meshes
into separate payload files, then creates a main file with payload references.
Process Overview:
1. Force show a list of prim paths
2. Analyze mesh visibility states (invisible=internal, visible=external)
3. Create internal.usd - keeps invisible meshes, deletes visible meshes
4. Create external.usd - keeps visible meshes, deletes invisible meshes
5. Restructure hierarchy by moving children and renaming default prim
6. Remove occluder meshes and empty leaf nodes
7. Set all remaining prims to visible state
8. Create new main file with payload references to both files
9. Deactivate internal payload prim in main file
This script is designed to work within the Scene Optimizer framework and expects
to be called without if __name__ == "__main__" guards.
"""
import omni.usd
from pxr import UsdGeom, Usd, Sdf, UsdShade, Kind, UsdGeom
import os
DEFAULT_PRIM_NAME = "XDU2300_Top"
def find_target_xform(stage):
"""
Find target Xform prim for asset processing.
USD concepts: default prim, scene hierarchy, Xform schema validation
"""
# Get the default prim
default_prim = stage.GetDefaultPrim()
if not default_prim or not default_prim.IsValid():
raise RuntimeError("Error: No default prim found in the stage")
# Find all xform children under the default prim
xform_children = []
for child in default_prim.GetChildren():
if child.IsValid() and child.IsA(UsdGeom.Xform):
xform_children.append(child)
# Validate we have exactly one xform
if len(xform_children) == 0:
raise RuntimeError(f"Error: No Xform prims found under default prim {default_prim.GetPath()}")
elif len(xform_children) > 1:
xform_paths = [xform.GetPath() for xform in xform_children]
raise RuntimeError(f"Error: Multiple Xform prims found under default prim {default_prim.GetPath()}: {xform_paths}")
return xform_children[0]
def find_meshes_with_visibility_state(stage):
"""
Analyze mesh visibility to determine internal vs. external components.
USD concepts: visibility attributes, UsdGeom.Imageable, computed visibility
Returns:
dict: {mesh_path: is_visible} (True=external, False=internal)
"""
# Find the target hierarchy automatically
try:
root_prim = find_target_xform(stage)
print(f"Searching for meshes under: {root_prim.GetPath()}")
except RuntimeError as e:
print(f"Failed to find target xform: {e}")
return {}
mesh_visibility = {}
def traverse_hierarchy(prim):
# Check if this is a mesh
if prim.IsA(UsdGeom.Mesh):
# Get visibility state using UsdGeom
imageable = UsdGeom.Imageable(prim)
if imageable:
# Get the computed visibility (takes inheritance into account)
visibility_attr = imageable.GetVisibilityAttr()
if visibility_attr and visibility_attr.IsValid():
visibility_value = visibility_attr.Get()
# Convert USD visibility token to boolean
# "invisible" = False (internal), "inherited"/"visible" = True (external)
is_visible = (visibility_value != "invisible")
mesh_visibility[str(prim.GetPath())] = is_visible
else:
# If no visibility attribute, assume inherited/visible (external)
mesh_visibility[str(prim.GetPath())] = True
# Traverse children
for child in prim.GetAllChildren():
traverse_hierarchy(child)
traverse_hierarchy(root_prim)
return mesh_visibility
def delete_meshes_by_visibility(stage, keep_visible=True):
"""
Split geometry by removing meshes based on visibility state.
USD concepts: prim removal, visibility-based filtering
Args:
keep_visible: True=create external file, False=create internal file
"""
# Find all meshes with their visibility state
mesh_visibility = find_meshes_with_visibility_state(stage)
if not mesh_visibility:
print("No meshes found!")
return
meshes_to_delete = []
if keep_visible:
# Keep visible meshes (external), delete invisible meshes (internal)
print("Keeping external meshes (visible), deleting internal meshes (invisible)")
meshes_to_delete = [path for path, is_visible in mesh_visibility.items() if not is_visible]
else:
# Keep invisible meshes (internal), delete visible meshes (external)
print("Keeping internal meshes (invisible), deleting external meshes (visible)")
meshes_to_delete = [path for path, is_visible in mesh_visibility.items() if is_visible]
print(f"Deleting {len(meshes_to_delete)} meshes...")
# Delete the meshes
for mesh_path in meshes_to_delete:
mesh_prim = stage.GetPrimAtPath(mesh_path)
if mesh_prim.IsValid():
print(f"Deleting mesh: {mesh_path}")
stage.RemovePrim(mesh_path)
else:
print(f"Warning: Mesh not found: {mesh_path}")
print(f"Mesh deletion complete!")
def prune_empty_leaf_nodes(stage, ignore_look_scopes=True):
"""
Remove empty leaf nodes, ignoring look scopes.
Args:
stage: USD Stage
ignore_look_scopes: If True, don't prune look scopes even if empty
"""
print("Pruning empty leaf nodes...")
def is_prim_empty(prim):
"""Check if a prim is empty and can be pruned."""
# Don't prune looks scopes if specified
if ignore_look_scopes and (prim.GetTypeName() == "Scope" and "looks" in prim.GetName().lower()):
return False
# Don't prune if it's a mesh
if prim.IsA(UsdGeom.Mesh):
return False
# Check if it has any children
children = prim.GetAllChildren()
if children:
# If all children are empty, this prim is effectively empty
return all(is_prim_empty(child) for child in children)
# If it's a leaf node, check if it has meaningful content
# Keep transform nodes even if empty
if prim.IsA(UsdGeom.Xform) or prim.IsA(UsdGeom.Xformable):
xformable = UsdGeom.Xformable(prim)
if xformable and xformable.GetOrderedXformOps():
return False # Has transforms, keep it
# Check for custom attributes
custom_attrs = [attr for attr in prim.GetAttributes()
if not attr.GetName().startswith('xformOp:') and
attr.GetName() not in ['visibility', 'purpose']]
if custom_attrs:
return False # Has custom attributes, keep it
return True # Truly empty
def prune_recursive(prim):
"""Recursively prune empty children."""
children_to_remove = []
for child in prim.GetAllChildren():
prune_recursive(child)
if is_prim_empty(child):
children_to_remove.append(child.GetPath())
for child_path in children_to_remove:
print(f" Pruning empty node: {child_path}")
stage.RemovePrim(child_path)
# Start pruning from root
for prim in stage.Traverse():
if prim.GetPath() != "/": # Skip root
prune_recursive(prim)
def copy_transform_values(stage, source_prim, target_prim):
"""
Copy all transform values from source prim to target prim.
This preserves rotation, translation, scale, and other transform operations.
Args:
stage: USD Stage
source_prim: Source prim with transforms to copy
target_prim: Target prim to receive transforms
"""
if not source_prim or not source_prim.IsValid():
print(" Warning: Source prim is invalid, cannot copy transforms")
return
if not target_prim or not target_prim.IsValid():
print(" Warning: Target prim is invalid, cannot copy transforms")
return
# Check if source prim is transformable (has Xformable schema)
if not source_prim.IsA(UsdGeom.Xformable):
print(f" Warning: Source prim {source_prim.GetPath()} is not Xformable, no transforms to copy")
return
# Make target prim transformable if it isn't already
if not target_prim.IsA(UsdGeom.Xformable):
UsdGeom.Xformable(target_prim)
print(f" Applied Xformable schema to target prim: {target_prim.GetPath()}")
source_xformable = UsdGeom.Xformable(source_prim)
target_xformable = UsdGeom.Xformable(target_prim)
# Get all transform operations from source
source_ops = source_xformable.GetOrderedXformOps()
if not source_ops:
print(" No transform operations found on source prim")
return
print(f" Copying {len(source_ops)} transform operations:")
# Get existing XformOps on target to avoid creating duplicates
existing_target_ops = target_xformable.GetOrderedXformOps()
# Copy each transform operation
for source_op in source_ops:
op_name = source_op.GetOpName()
op_type = source_op.GetOpType()
op_precision = source_op.GetPrecision()
# Get the transform value
transform_value = source_op.Get()
if transform_value is None:
print(f" Skipping {op_name} - no value set")
continue
print(f" {op_name} ({op_type}): {transform_value}")
# Look for existing matching XformOp on target (by type and precision)
target_op = None
for existing_op in existing_target_ops:
if (existing_op.GetOpType() == op_type and
existing_op.GetPrecision() == op_precision):
# Found matching existing op - use it instead of creating new one
target_op = existing_op
print(f" Using existing XformOp: {existing_op.GetOpName()}")
break
# If no matching existing op found, create a new one
if target_op is None:
try:
if op_type == UsdGeom.XformOp.TypeTranslate:
target_op = target_xformable.AddTranslateOp(op_precision)
elif op_type == UsdGeom.XformOp.TypeRotateXYZ:
target_op = target_xformable.AddRotateXYZOp(op_precision)
elif op_type == UsdGeom.XformOp.TypeRotateX:
target_op = target_xformable.AddRotateXOp(op_precision)
elif op_type == UsdGeom.XformOp.TypeRotateY:
target_op = target_xformable.AddRotateYOp(op_precision)
elif op_type == UsdGeom.XformOp.TypeRotateZ:
target_op = target_xformable.AddRotateZOp(op_precision)
elif op_type == UsdGeom.XformOp.TypeScale:
target_op = target_xformable.AddScaleOp(op_precision)
elif op_type == UsdGeom.XformOp.TypeTransform:
target_op = target_xformable.AddTransformOp(op_precision)
elif op_type == UsdGeom.XformOp.TypeOrient:
target_op = target_xformable.AddOrientOp(op_precision)
else:
print(f" Warning: Unsupported transform operation type: {op_type}")
continue
print(f" Created new XformOp: {target_op.GetOpName()}")
except Exception as e:
print(f" Error creating XformOp for {op_name}: {e}")
continue
# Set the transform value on the target op (existing or newly created)
try:
target_op.Set(transform_value)
print(f" Successfully set value on {target_op.GetOpName()}")
except Exception as e:
print(f" Error setting value on {target_op.GetOpName()}: {e}")
print(f" Transform inheritance complete for {target_prim.GetPath()}")
def restructure_hierarchy(stage, new_default_name="internal"):
"""
Restructure USD hierarchy for payload-based scene composition.
Uses dynamic discovery to find the target hierarchy and moves all children
to a new default prim with proper transform inheritance.
Args:
stage: USD Stage
new_default_name: New name for the default prim ("internal" or "external")
"""
print(f"Restructuring hierarchy - moving to '{new_default_name}'...")
try:
# Use dynamic discovery to find the target xform
target_xform = find_target_xform(stage)
old_root_path = target_xform.GetPath()
# Get the parent path (default prim)
parent_path = target_xform.GetParent().GetPath()
print(f"Target xform: {old_root_path}")
print(f"Parent path: {parent_path}")
except RuntimeError as e:
print(f"Failed to find target xform for restructuring: {e}")
return
old_root = stage.GetPrimAtPath(old_root_path)
parent_prim = stage.GetPrimAtPath(parent_path)
if not old_root.IsValid():
print(f"Warning: Old root prim not found: {old_root_path}")
return
if not parent_prim.IsValid():
print(f"Warning: Parent prim not found: {parent_path}")
return
# CRITICAL: Create new default prim FIRST and copy transforms BEFORE moving children
# This ensures children maintain their world transforms when moved
new_default_path = f"/{new_default_name}"
print(f" Step 1: Creating new default prim and copying transforms")
# Create new default prim
new_default_prim = stage.DefinePrim(new_default_path)
stage.SetDefaultPrim(new_default_prim)
# Set Kind to "subcomponent" - indicates this is part of a larger component
# USD CONCEPT: subcomponent = model-like part of a component, cannot stand alone
Usd.ModelAPI(new_default_prim).SetKind(Kind.Tokens.subcomponent)
print(f" Set Kind=subcomponent on {new_default_path}")
# Copy parent prim attributes and metadata to new default prim
for attr in parent_prim.GetAttributes():
if attr.IsValid():
target_attr = new_default_prim.CreateAttribute(attr.GetName(), attr.GetTypeName())
value = attr.Get()
if value is not None:
target_attr.Set(value)
# Copy transforms from target xform to new default prim BEFORE removing it
print(f" Copying transforms from target xform {old_root_path} to new default prim {new_default_path}")
copy_transform_values(stage, target_xform, new_default_prim)
# Copy metadata from parent to new default prim BEFORE removing parent
try:
all_metadata = parent_prim.GetAllMetadata()
for key, value in all_metadata.items():
if value is not None:
new_default_prim.SetMetadata(key, value)
except Exception as e:
print(f" Warning: Could not copy metadata: {e}")
# Store child paths and names before any prim modifications
children_to_move = [(str(child.GetPath()), child.GetName()) for child in old_root.GetAllChildren()]
print(f" Step 2: Moving {len(children_to_move)} children directly from {old_root_path} to {new_default_path}")
# Check specifically for Looks folder
looks_found = False
for child_path, child_name in children_to_move:
if child_name == "Looks":
looks_found = True
print(f" Found Looks folder to move: {child_path}")
break
if not looks_found:
# Check if Looks folder exists elsewhere in the hierarchy
looks_path_parent = f"{parent_path}/Looks"
looks_prim_parent = stage.GetPrimAtPath(looks_path_parent)
if looks_prim_parent.IsValid():
print(f" Looks folder found at parent level: {looks_path_parent}")
print(f" Adding to children_to_move for proper relocation")
children_to_move.append((looks_path_parent, "Looks"))
else:
print(f" Warning: No Looks folder found in expected locations")
# Move all children directly from target_xform to new default prim
# Since new default prim has same transforms as target_xform, children maintain world orientation
for child_path, child_name in children_to_move:
target_path = f"{new_default_path}/{child_name}"
# Verify the source prim still exists before moving
source_prim = stage.GetPrimAtPath(child_path)
if source_prim.IsValid():
if child_name == "Looks":
print(f" Moving Looks folder: {child_path} -> {target_path}")
else:
print(f" Moving: {child_path} -> {target_path}")
move_prim_with_children(stage, child_path, target_path)
else:
print(f" Warning: Source prim no longer exists: {child_path}")
# Step 3: Remove the old target xform prim
print(f" Step 3: Removing target xform: {old_root_path}")
stage.RemovePrim(old_root_path)
# Step 4: Remove the old parent prim entirely
print(f" Step 4: Removing parent prim: {parent_path}")
stage.RemovePrim(parent_path)
print(f" Completed hierarchy restructuring: {parent_path} -> {new_default_path}")
def move_prim_with_children(stage, source_path, target_path):
"""Move a prim and all its children to a new location."""
source_prim = stage.GetPrimAtPath(source_path)
if not source_prim.IsValid():
return
# Create target prim with same type
type_name = source_prim.GetTypeName()
if type_name:
target_prim = stage.DefinePrim(target_path, type_name)
else:
target_prim = stage.DefinePrim(target_path)
# Copy all attributes
for attr in source_prim.GetAttributes():
if attr.IsValid():
target_attr = target_prim.CreateAttribute(attr.GetName(), attr.GetTypeName())
value = attr.Get()
if value is not None:
target_attr.Set(value)
# Copy all relationships
for rel in source_prim.GetRelationships():
if rel.IsValid():
target_rel = target_prim.CreateRelationship(rel.GetName())
targets = rel.GetTargets()
if targets:
target_rel.SetTargets(targets)
# Copy metadata
try:
all_metadata = source_prim.GetAllMetadata()
for key, value in all_metadata.items():
if value is not None:
target_prim.SetMetadata(key, value)
except Exception as e:
print(f" Warning: Could not copy metadata for {source_path}: {e}")
# Recursively move children
for child in source_prim.GetAllChildren():
child_target = f"{target_path}/{child.GetName()}"
move_prim_with_children(stage, str(child.GetPath()), child_target)
def remove_occluder_mesh(stage):
"""
Remove occluder geometry used for Scene Optimizer processing.
USD concepts: prim removal by name, cleanup post-processing
"""
print("Removing 'Occluder' meshes...")
occluders_to_remove = []
for prim in stage.Traverse():
if (prim.GetName() == "Occluder" or prim.GetName() == "Occluder_2") and prim.IsA(UsdGeom.Mesh):
occluders_to_remove.append(str(prim.GetPath()))
for occluder_path in occluders_to_remove:
print(f" Removing Occluder: {occluder_path}")
stage.RemovePrim(occluder_path)
if not occluders_to_remove:
print(" No Occluder meshes found")
def set_all_prims_visible(stage):
"""
Reset all prims to visible state for payload files.
USD concepts: visibility attributes, UsdGeom.Imageable
"""
print("Setting all prims to visible...")
count = 0
for prim in stage.Traverse():
if prim.IsA(UsdGeom.Imageable):
imageable = UsdGeom.Imageable(prim)
visibility_attr = imageable.GetVisibilityAttr()
if visibility_attr and visibility_attr.IsValid():
current_value = visibility_attr.Get()
if current_value == "invisible":
visibility_attr.Set("inherited")
count += 1
print(f" Set {count} prims to visible")
def update_material_bindings(stage, new_default_name="internal"):
"""
Update material binding paths after hierarchy restructuring.
Uses dynamic discovery to automatically find old hierarchy paths.
Args:
stage: USD Stage
new_default_name: New default prim name ("internal" or "external")
"""
# Use dynamic discovery to find the actual original hierarchy paths
try:
# Find the current default prim and target xform to understand the original structure
default_prim = stage.GetDefaultPrim()
if not default_prim or not default_prim.IsValid():
print("Warning: No default prim found, cannot update material bindings")
return
# The original structure before restructuring would have been:
# /DefaultPrimName/TargetXformName/...
# After restructuring it becomes: /internal/ or /external/
default_prim_name = default_prim.GetName()
# Try to find if there are any material paths that need updating
# Look for common material path patterns
old_prefixes = [
f"/{default_prim_name}/",
"/World/", # Common default name
f"/{default_prim_name}/World/", # Nested structure
]
print(f"Updating material binding paths to /{new_default_name}")
print(f"Checking for old prefixes: {old_prefixes}")
except Exception as e:
print(f"Warning: Could not determine original paths, using fallback: {e}")
old_prefixes = ["/World/"]
new_prefix = f"/{new_default_name}/"
updated_count = 0
# Traverse all prims to find material bindings
for prim in stage.Traverse():
# Check for material bindings
if prim.HasAPI(UsdShade.MaterialBindingAPI):
material_binding_api = UsdShade.MaterialBindingAPI(prim)
# Get direct material binding
material_binding = material_binding_api.GetDirectBinding()
if material_binding.GetMaterial():
material_path = material_binding.GetMaterialPath()
if material_path:
material_path_str = str(material_path)
# Check each possible old prefix
binding_updated = False
for old_prefix in old_prefixes:
if material_path_str.startswith(old_prefix) and not binding_updated:
# Update the path to reference the new hierarchy
new_material_path_str = material_path_str.replace(old_prefix, new_prefix, 1)
# Verify the new material exists before rebinding
new_material_prim = stage.GetPrimAtPath(new_material_path_str)
if new_material_prim.IsValid():
try:
new_material = UsdShade.Material(new_material_prim)
material_binding_api.Bind(
new_material,
material_binding.GetBindingStrength(),
material_binding.GetMaterialPurpose()
)
print(f" Updated material binding: {material_path_str} -> {new_material_path_str}")
updated_count += 1
binding_updated = True
except Exception as e:
print(f" Error updating binding for {prim.GetPath()}: {e}")
else:
# Try without the first path component (sometimes the material path is nested differently)
path_parts = material_path_str.strip('/').split('/')
if len(path_parts) > 1:
alt_material_path = f"/{new_default_name}/" + '/'.join(path_parts[1:])
alt_material_prim = stage.GetPrimAtPath(alt_material_path)
if alt_material_prim.IsValid():
try:
new_material = UsdShade.Material(alt_material_prim)
material_binding_api.Bind(
new_material,
material_binding.GetBindingStrength(),
material_binding.GetMaterialPurpose()
)
print(f" Updated material binding (alt path): {material_path_str} -> {alt_material_path}")
updated_count += 1
binding_updated = True
except Exception as e:
print(f" Error updating alt binding for {prim.GetPath()}: {e}")
if not binding_updated:
print(f" Warning: Could not update material binding {material_path_str} - target not found")
# Also check collection-based bindings
for collection_binding in material_binding_api.GetCollectionBindings():
if collection_binding.GetMaterial():
material_path = collection_binding.GetMaterialPath()
if material_path:
material_path_str = str(material_path)
# Check each possible old prefix for collection bindings
collection_updated = False
for old_prefix in old_prefixes:
if material_path_str.startswith(old_prefix) and not collection_updated:
new_material_path_str = material_path_str.replace(old_prefix, new_prefix, 1)
# Verify the new material exists before rebinding
new_material_prim = stage.GetPrimAtPath(new_material_path_str)
if new_material_prim.IsValid():
try:
new_material = UsdShade.Material(new_material_prim)
# Rebind the collection material
material_binding_api.Bind(
collection_binding.GetCollection(),
new_material,
collection_binding.GetBindingStrength(),
collection_binding.GetMaterialPurpose()
)
print(f" Updated collection material binding: {material_path_str} -> {new_material_path_str}")
updated_count += 1
collection_updated = True
except Exception as e:
print(f" Error updating collection binding for {prim.GetPath()}: {e}")
else:
# Try alternative path structure
path_parts = material_path_str.strip('/').split('/')
if len(path_parts) > 1:
alt_material_path = f"/{new_default_name}/" + '/'.join(path_parts[1:])
alt_material_prim = stage.GetPrimAtPath(alt_material_path)
if alt_material_prim.IsValid():
try:
new_material = UsdShade.Material(alt_material_prim)
material_binding_api.Bind(
collection_binding.GetCollection(),
new_material,
collection_binding.GetBindingStrength(),
collection_binding.GetMaterialPurpose()
)
print(f" Updated collection material binding (alt): {material_path_str} -> {alt_material_path}")
updated_count += 1
collection_updated = True
except Exception as e:
print(f" Error updating alt collection binding for {prim.GetPath()}: {e}")
if not collection_updated:
print(f" Warning: Could not update collection material binding {material_path_str}")
# Also check for relationships that might reference materials
for rel in prim.GetRelationships():
if "material" in rel.GetName().lower():
targets = rel.GetTargets()
updated_targets = []
targets_updated = False
for target in targets:
target_str = str(target)
target_updated = False
# Check each possible old prefix for relationship targets
for old_prefix in old_prefixes:
if target_str.startswith(old_prefix) and not target_updated:
new_target_str = target_str.replace(old_prefix, new_prefix, 1)
# Verify the new target exists
if stage.GetPrimAtPath(new_target_str).IsValid():
updated_targets.append(Sdf.Path(new_target_str))
targets_updated = True
print(f" Updated relationship target: {target_str} -> {new_target_str}")
updated_count += 1
target_updated = True
else:
# Try alternative path structure
path_parts = target_str.strip('/').split('/')
if len(path_parts) > 1:
alt_target_str = f"/{new_default_name}/" + '/'.join(path_parts[1:])
if stage.GetPrimAtPath(alt_target_str).IsValid():
updated_targets.append(Sdf.Path(alt_target_str))
targets_updated = True
print(f" Updated relationship target (alt): {target_str} -> {alt_target_str}")
updated_count += 1
target_updated = True
if not target_updated:
updated_targets.append(target) # Keep original if no update worked
if targets_updated:
try:
rel.SetTargets(updated_targets)
except Exception as e:
print(f" Error updating relationship targets for {prim.GetPath()}: {e}")
print(f" Updated {updated_count} material binding paths")
def create_internal_external_files():
"""
Create internal.usd and external.usd files, then create a new main file with payloads.
Uses dynamic discovery to automatically find the target hierarchy.
"""
# Get current stage and its file path
usd_context = omni.usd.get_context()
stage = usd_context.get_stage()
if not stage:
print("Error: No stage is currently open!")
return
# Get the current stage file path
current_stage_url = usd_context.get_stage_url()
if not current_stage_url:
print("Error: Current stage has no file path! Please save the stage first.")
return
# Convert URL to local file path and get directory
def convert_url_to_path(url):
"""Convert various URL formats to local file path"""
if not url:
return ""
# Handle different URL schemes
if url.startswith("omniverse://"):
path = url[12:] # Remove "omniverse://"
elif url.startswith("file://"):
path = url[7:] # Remove "file://"
elif url.startswith("file:/"):
path = url[6:] # Remove "file:/"
elif url.startswith("file:"):
path = url[5:] # Remove "file:"
else:
path = url # Assume it's already a local path
# Remove leading slash on Windows
if path.startswith("/") and len(path) > 1:
path = path[1:]
return path
stage_path = convert_url_to_path(current_stage_url)
stage_dir = os.path.dirname(stage_path)
stage_name = os.path.splitext(os.path.basename(stage_path))[0]
stage_ext = os.path.splitext(os.path.basename(stage_path))[1]
# Define file paths - organize in payloads folder
payloads_dir = os.path.join(stage_dir, "payloads")
# Create payloads directory if it doesn't exist
if not os.path.exists(payloads_dir):
os.makedirs(payloads_dir)
print(f"Created payloads directory: {payloads_dir}")
internal_path = os.path.join(payloads_dir, "internal.usd")
external_path = os.path.join(payloads_dir, "external.usd")
print(f"Current stage: {stage_path}")
print(f"Payloads directory: {payloads_dir}")
print(f"Will create: {internal_path}")
print(f"Will create: {external_path}")
# Find all meshes with their visibility state first to show what we're working with
print("\nAnalyzing mesh visibility states...")
mesh_visibility = find_meshes_with_visibility_state(stage)
if not mesh_visibility:
print("No meshes found!")
return
internal_count = sum(1 for is_visible in mesh_visibility.values() if not is_visible)
external_count = sum(1 for is_visible in mesh_visibility.values() if is_visible)
print(f"Found {len(mesh_visibility)} meshes:")
print(f" - Internal (invisible): {internal_count} meshes")
print(f" - External (visible): {external_count} meshes")
# Step 1: Create internal.usd file from current stage
print(f"\n=== Step 1: Creating internal.usd ===")
print(f"Creating internal.usd from current stage...")
# Export current stage to internal.usd
stage.Export(internal_path)
# Open the internal file and process it
print("Opening internal.usd and processing...")
internal_stage = Usd.Stage.Open(internal_path)
if internal_stage:
# Step 1: Delete external (visible) meshes
delete_meshes_by_visibility(internal_stage, keep_visible=False)
# Step 2: Prune empty leaf nodes
prune_empty_leaf_nodes(internal_stage, ignore_look_scopes=True)
# Step 3: Restructure hierarchy
restructure_hierarchy(internal_stage, "internal")
# Step 4: Update material binding paths
update_material_bindings(internal_stage, "internal")
# Step 5: Remove Occluder mesh
remove_occluder_mesh(internal_stage)
# Step 6: Set all prims to visible
set_all_prims_visible(internal_stage)
internal_stage.Save()
print(f"Completed processing internal.usd with {internal_count} internal meshes")
else:
print(f"Error: Could not open {internal_path}")
return
# Step 2: Create external.usd file from current stage
print(f"\n=== Step 2: Creating external.usd ===")
print(f"Creating external.usd from current stage...")
# Export current stage to external.usd
stage.Export(external_path)
# Open the external file and process it
print("Opening external.usd and processing...")
external_stage = Usd.Stage.Open(external_path)
if external_stage:
# Step 1: Delete internal (invisible) meshes
delete_meshes_by_visibility(external_stage, keep_visible=True)
# Step 2: Prune empty leaf nodes
prune_empty_leaf_nodes(external_stage, ignore_look_scopes=True)
# Step 3: Restructure hierarchy
restructure_hierarchy(external_stage, "external")
# Step 4: Update material binding paths
update_material_bindings(external_stage, "external")
# Step 5: Remove Occluder mesh
remove_occluder_mesh(external_stage)
# Step 6: Set all prims to visible
set_all_prims_visible(external_stage)
external_stage.Save()
print(f"Completed processing external.usd with {external_count} external meshes")
else:
print(f"Error: Could not open {external_path}")
return
# Step 3: Create new main file with payloads
print(f"\n=== Step 3: Creating new main file with payloads ===")
# Create new main file path
main_file_path = os.path.join(stage_dir, f"{stage_name}_main{stage_ext}")
# Create a completely new stage for the main file
main_stage = Usd.Stage.CreateNew(main_file_path)
# Copy stage metadata from original
up_axis = UsdGeom.GetStageUpAxis(stage)
UsdGeom.SetStageUpAxis(main_stage, up_axis)
meters_per_unit = UsdGeom.GetStageMetersPerUnit(stage)
UsdGeom.SetStageMetersPerUnit(main_stage, meters_per_unit)
# Copy preset directory metadata from original stage to main stage
source_root_layer = stage.GetRootLayer()
source_custom_data = source_root_layer.customLayerData
if source_custom_data and "sceneOptimizerPresetDir" in source_custom_data:
preset_dir = source_custom_data["sceneOptimizerPresetDir"]
main_root_layer = main_stage.GetRootLayer()
main_custom_data = dict(main_root_layer.customLayerData) if main_root_layer.customLayerData else {}
main_custom_data["sceneOptimizerPresetDir"] = preset_dir
main_root_layer.customLayerData = main_custom_data
print(f"\n[OK] Copied preset directory metadata to main stage: {preset_dir}")
else:
print(f"\n[WARNING] No preset directory metadata found on source stage to copy")
# Create default prim as Xform
default_prim_path = f"/{DEFAULT_PRIM_NAME}"
default_prim = UsdGeom.Xform.Define(main_stage, default_prim_path).GetPrim()
main_stage.SetDefaultPrim(default_prim)
# Set Kind to "component" - indicates this is a complete, referenceable asset
# USD CONCEPT: Kind metadata helps tools understand asset hierarchy and purpose
Usd.ModelAPI(default_prim).SetKind(Kind.Tokens.component)
print(f" Created default prim (Xform) with Kind=component: {default_prim_path}")
# Create external payload prim (active)
external_prim_path = f"{default_prim_path}/external"
external_prim = main_stage.DefinePrim(external_prim_path)
# Add payload to external file (use forward slashes and ./ prefix for USD)
external_file_rel = os.path.relpath(external_path, os.path.dirname(main_file_path)).replace("\\", "/")
external_file_rel = f"./{external_file_rel}"
external_prim.GetPayloads().AddPayload(external_file_rel, "/external")
print(f" Added external payload: {external_file_rel}")
# Create internal payload prim (inactive)
internal_prim_path = f"{default_prim_path}/internal"
internal_prim = main_stage.DefinePrim(internal_prim_path)
# Add payload to internal file (use forward slashes and ./ prefix for USD)
internal_file_rel = os.path.relpath(internal_path, os.path.dirname(main_file_path)).replace("\\", "/")
internal_file_rel = f"./{internal_file_rel}"
internal_prim.GetPayloads().AddPayload(internal_file_rel, "/internal")
# Deactivate the internal payload prim
internal_prim.SetActive(False)
print(f" Added internal payload: {internal_file_rel} (deactivated)")
# Save the main stage
main_stage.Save()
print(f" Saved main stage: {main_file_path}")
# Close the current stage before opening the new one
# Clear pending edits to avoid save prompt
omni.usd.get_context().set_pending_edit(False)
omni.usd.get_context().close_stage()
# Open the new main stage in Kit
print(f"\n=== Opening converted file in Kit ===")
print(f" Type of main_file_path: {type(main_file_path)}")
print(f" Value of main_file_path: {main_file_path}")
omni.usd.get_context().open_stage(main_file_path)
print(f" Opened: {main_file_path}")
print(f"\n=== Process Complete! ===")
print(f"Created files:")
print(f" - {internal_path} (contains {internal_count} internal meshes)")
print(f" - {external_path} (contains {external_count} external meshes)")
print(f" - {main_file_path} (new main file with payloads)")
print(f"Original file unchanged: {stage_path}")
print(f"\nFile structure:")
print(f" {stage_name}{stage_ext} <- Original file")
print(f" {stage_name}_main{stage_ext} <- Main working file")
print(f" payloads/")
print(f" |-- internal.usd <- Internal meshes")
print(f" +-- external.usd <- External meshes")
def force_show_prims():
prim_paths_to_show = [
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_1/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_2/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_3/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_4/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_5/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_6/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_7/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_8/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_9/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_10/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_11/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/BRANDING_COOLCHIP_CDU_4/BRANDING_COOLCHIP_CDU_4_12/surface_0",
"/World/XDU2300_TOP/XDU2300A_ASM_20/XDU2300AG01001_AF0_ASM_19/tn__10154302_AF0_ASM_15_/tn__10077804_15_/surface_1"
]
usd_context = omni.usd.get_context()
stage = usd_context.get_stage()
for prim_path in prim_paths_to_show:
prim = stage.GetPrimAtPath(prim_path)
if prim.IsValid():
imageable = UsdGeom.Imageable(prim)
if imageable:
imageable.MakeVisible()
print(f"Force-showed prim: {prim_path}")
else:
print(f"Warning: Prim is not imageable: {prim_path}")
force_show_prims()
create_internal_external_files()
# # Example usage and test functions
# if __name__ == "__main__":
# print("This script will:")
# print("1. Create payloads/ directory for organization")
# print("2. Create payloads/internal.usd from current stage (invisible meshes)")
# print("3. Create payloads/external.usd from current stage (visible meshes)")
# print("4. Restructure hierarchy: /internal/Looks/Material1 (remove intermediate prim)")
# print("5. Update material binding paths after hierarchy changes")
# print("6. Create NEW main file with payloads (avoids UI prim invalidation)")
# print("7. Open the new main file in Kit")
# print("=" * 80)
# # Execute the asset splitting workflow
# force_show_prims()
# create_internal_external_files()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876"""
USD Dynamic Material Replacement
================================
Replaces CAD-imported materials with standardized target materials using template mapping
and fallback strategies.
USD Concepts: UsdShade.Material, UsdPreviewSurface shader, MaterialBindingAPI, Looks organization
Workflow: Analyze Materials -> Create Targets -> Replace Bindings -> Validate Results
"""
import omni.usd
from pxr import Usd, UsdShade, Sdf, UsdGeom, Gf
# Target material definitions using UsdPreviewSurface input names
# UsdPreviewSurface inputs: diffuseColor, roughness, metallic, specularColor, ior, opacity, emissiveColor
TARGET_MATERIALS = {
"vertiv_black": {
"diffuseColor": (0.015, 0.015, 0.015),
"roughness": 0.5,
"metallic": 0.0,
"ior": 1.5
},
"plastic": {
"diffuseColor": (0.00554, 0.00597, 0.008), # Dark gray
"roughness": 0.89,
"metallic": 0.0,
"ior": 1.5
},
"shiny_plastic": {
"diffuseColor": (0.00554, 0.00597, 0.008), # Dark gray
"roughness": 0.25,
"metallic": 0.0,
"ior": 1.5
},
"logo_white": {
"diffuseColor": (1.0, 1.0, 1.0), # White
"roughness": 0.85,
"metallic": 0.0,
"ior": 1.5
},
"glass": {
"diffuseColor": (0.95, 0.95, 0.95), # Nearly white (slight tint)
"roughness": 0.0, # Perfectly smooth (mirror-like)
"metallic": 0.0, # Non-metallic (dielectric)
"opacity": 0.1, # 90% transparent
"ior": 1.5, # Index of refraction for glass (1.5-1.52)
"specularColor": (1.0, 1.0, 1.0), # White highlights
"clearcoat": 1.0, # Optional: adds extra glossy layer
"clearcoatRoughness": 0.0 # Optional: smooth clearcoat
},
"steel": {
"diffuseColor": (0.8, 0.8, 0.8), # Light gray
"roughness": 0.21,
"metallic": 1.0,
"ior": 1.5
},
"screen": {
"diffuseColor": (0.01158, 0.01158, 0.01158), # Very light gray
"roughness": 0.05,
"metallic": 0.04,
"ior": 1.5
}
}
# Material replacement templates (relative to default prim)
MATERIAL_REPLACEMENT_TEMPLATES = {
# Materials that become vertiv_black (dark)
# Materials that become steel (medium gray)
# "Looks/ref_color266": "steel",
# "Looks/ref_color36": "steel",
# "Looks/tn__03_grau_75_": "steel",
# "Looks/tn__13_orange_": "steel",
# Materials that become screen (light)
# "Looks/ref_color556": "screen",
}
# Fallback material for any unspecified materials
FALLBACK_MATERIAL = "vertiv_black"
# Prim path overrides: Assign specific materials to specific prim paths
# If the path is an Xform, all meshes under it will receive the material
# Format: "prim_path": "target_material_name"
PRIM_PATH_MATERIAL_OVERRIDES = {
"/external/XDU2300A_ASM_18/AC00014_12/surface_0": "steel",
"/external/XDU2300A_ASM_18/XDU2300AG01001_AF0_ASM_17/tn__10154302_ASM_13_/tn__10077804_13_/surface_0": "plastic",
"/external/XDU2300A_ASM_18/XDU2300AG01001_AF0_ASM_17/tn__10154302_ASM_13_/tn__10077804_13_/surface_1/Geometry": "screen",
# Add specific prim path overrides here if needed
# Example: "/Root/SomeComponent": "steel",f
}
def get_dynamic_material_replacements():
"""
Build dynamic material replacement mapping using template patterns and fallbacks.
USD concepts: default prim navigation, UsdShade.Material discovery, path construction
"""
stage = omni.usd.get_context().get_stage()
if not stage:
print("Error: No active stage found")
return {}
# USD: Get default prim path for relative material addressing
default_prim = stage.GetDefaultPrim()
if default_prim and default_prim.IsValid():
default_prim_path = str(default_prim.GetPath())
else:
# USD fallback: extract from layer metadata
root_layer = stage.GetRootLayer()
default_prim_name = root_layer.defaultPrim or "World"
default_prim_path = f"/{default_prim_name}"
print(f"Building material replacements for: {default_prim_path}")
# USD: Build absolute material paths from relative templates
dynamic_replacements = {}
for template_path, target_material in MATERIAL_REPLACEMENT_TEMPLATES.items():
full_path = f"{default_prim_path}/{template_path}" # Convert to absolute path
dynamic_replacements[full_path] = target_material
# UsdShade: Discover all materials in Looks folder for fallback handling
looks_path = f"{default_prim_path}/Looks"
looks_prim = stage.GetPrimAtPath(looks_path)
fallback_count = 0
if looks_prim.IsValid():
for child in looks_prim.GetAllChildren():
if child.IsA(UsdShade.Material): # USD material schema filtering
material_path = str(child.GetPath())
if material_path not in dynamic_replacements:
dynamic_replacements[material_path] = FALLBACK_MATERIAL
fallback_count += 1
print(f" {len(MATERIAL_REPLACEMENT_TEMPLATES)} explicit + {fallback_count} fallback = {len(dynamic_replacements)} total replacements")
return dynamic_replacements
def create_or_find_material(material_name, material_props):
"""
Create or reuse target material with UsdPreviewSurface shader.
USD concepts: material creation, UsdShade.Shader, UsdPreviewSurface
"""
stage = omni.usd.get_context().get_stage()
# USD: Build material path following Looks organization convention
default_prim = stage.GetDefaultPrim()
if default_prim and default_prim.IsValid():
default_prim_path = str(default_prim.GetPath())
else:
root_layer = stage.GetRootLayer()
default_prim_name = root_layer.defaultPrim or "World"
default_prim_path = f"/{default_prim_name}"
material_path = f"{default_prim_path}/Looks/{material_name}" # Standard Looks folder
# USD: Check for existing material to avoid duplication
existing_material = stage.GetPrimAtPath(material_path)
if existing_material.IsValid():
print(f" Reusing existing material: {material_path}")
return material_path
# Create new UsdPreviewSurface material
print(f" Creating new UsdPreviewSurface material: {material_path}")
# USD: Ensure parent Looks scope exists
looks_path = f"{default_prim_path}/Looks"
looks_prim = stage.GetPrimAtPath(looks_path)
if not looks_prim.IsValid():
UsdGeom.Scope.Define(stage, looks_path)
# UsdShade: Create material prim
material = UsdShade.Material.Define(stage, material_path)
# UsdShade: Create UsdPreviewSurface shader
shader_path = f"{material_path}/Shader"
shader = UsdShade.Shader.Define(stage, shader_path)
shader.CreateIdAttr("UsdPreviewSurface")
# UsdShade: Connect shader output to material surface
shader_output = shader.CreateOutput("surface", Sdf.ValueTypeNames.Token)
material.CreateSurfaceOutput().ConnectToSource(shader_output)
# UsdShade: Set all shader properties from material_props
# UsdPreviewSurface standard inputs and their types
input_types = {
"diffuseColor": Sdf.ValueTypeNames.Color3f,
"emissiveColor": Sdf.ValueTypeNames.Color3f,
"specularColor": Sdf.ValueTypeNames.Color3f,
"roughness": Sdf.ValueTypeNames.Float,
"metallic": Sdf.ValueTypeNames.Float,
"ior": Sdf.ValueTypeNames.Float,
"opacity": Sdf.ValueTypeNames.Float,
"clearcoat": Sdf.ValueTypeNames.Float,
"clearcoatRoughness": Sdf.ValueTypeNames.Float,
"displacement": Sdf.ValueTypeNames.Float,
"occlusion": Sdf.ValueTypeNames.Float,
"useSpecularWorkflow": Sdf.ValueTypeNames.Int,
}
for prop_name, prop_value in material_props.items():
# Determine value type from known types or infer from value
if prop_name in input_types:
value_type = input_types[prop_name]
elif isinstance(prop_value, (int, float)):
value_type = Sdf.ValueTypeNames.Float
elif isinstance(prop_value, tuple) and len(prop_value) == 3:
value_type = Sdf.ValueTypeNames.Color3f
else:
continue # Skip unknown types
# Create and set the input
shader_input = shader.CreateInput(prop_name, value_type)
# Convert value to appropriate type
if value_type == Sdf.ValueTypeNames.Color3f:
shader_input.Set(Gf.Vec3f(*prop_value))
elif value_type == Sdf.ValueTypeNames.Float:
shader_input.Set(float(prop_value))
elif value_type == Sdf.ValueTypeNames.Int:
shader_input.Set(int(prop_value))
else:
shader_input.Set(prop_value)
return material_path
def replace_material_bindings(old_material_path, new_material_path):
"""
Replace material bindings across all geometry using MaterialBindingAPI.
USD concepts: material binding relationships, direct vs collection bindings
"""
stage = omni.usd.get_context().get_stage()
# Validate that the new material exists
new_material_prim = stage.GetPrimAtPath(new_material_path)
if not new_material_prim.IsValid() or not new_material_prim.IsA(UsdShade.Material):
print(f" ERROR: Target material does not exist: {new_material_path}")
return 0
# UsdShade: Find all prims with material bindings to old material
bindings_found = []
for prim in stage.Traverse():
if prim.HasAPI(UsdShade.MaterialBindingAPI): # Check for binding API
binding_api = UsdShade.MaterialBindingAPI(prim)
# UsdShade: Check direct material binding
direct_binding = binding_api.GetDirectBinding()
if direct_binding.GetMaterial() and str(direct_binding.GetMaterialPath()) == old_material_path:
bindings_found.append(prim)
# UsdShade: Check collection-based bindings
for collection_binding in binding_api.GetCollectionBindings():
if collection_binding.GetMaterial() and str(collection_binding.GetMaterialPath()) == old_material_path:
bindings_found.append(prim)
if not bindings_found:
print(f" No bindings found for: {old_material_path}")
return 0
print(f" Found {len(bindings_found)} bindings to replace")
# Omniverse: Update bindings with proper inheritance strength
updated_count = 0
for prim in bindings_found:
try:
omni.kit.commands.execute('BindMaterial',
prim_path=str(prim.GetPath()),
material_path=new_material_path,
strength='weakerThanDescendants' # Allow child overrides
)
updated_count += 1
except Exception as e:
print(f" Warning: Failed to rebind {prim.GetPath()}: {e}")
return updated_count
def clear_invalid_material_bindings():
"""
Clear material bindings that reference non-existent materials.
This pre-pass ensures that all material bindings point to valid materials
in the stage. Any binding to a material that doesn't exist will be cleared,
allowing those prims to be treated as unbound and receive the fallback material.
USD concepts: MaterialBindingAPI for checking/clearing bindings, UsdShade.Material validity
"""
print("\n=== Clearing Invalid Material Bindings ===")
stage = omni.usd.get_context().get_stage()
if not stage:
print("Error: No active stage found")
return 0
# Collect all valid material paths in the stage (including from payloads/references)
valid_materials = set()
for prim in stage.Traverse():
if prim.IsA(UsdShade.Material):
valid_materials.add(str(prim.GetPath()))
print(f"Found {len(valid_materials)} valid materials in stage")
if valid_materials:
print(f" Sample materials: {list(valid_materials)[:3]}")
# Check all geometry prims for invalid material bindings
# Use PrimRange with predicate to include both regular prims and prototypes (source prims for instances)
cleared_count = 0
invalid_materials_found = set()
processed_prims = set()
# Create a predicate that includes both active prims and prototypes (instance sources)
predicate = Usd.PrimIsActive & Usd.PrimIsDefined
# Traverse all prims including prototypes
for prim in Usd.PrimRange.Stage(stage, predicate):
# Check meshes and geom subsets
if not (prim.IsA(UsdGeom.Gprim) or prim.IsA(UsdGeom.Subset)):
continue
# Skip instances - we only want to process the actual source prims
if prim.IsInstance():
continue
# Skip if already processed
prim_path_str = str(prim.GetPath())
if prim_path_str in processed_prims:
continue
processed_prims.add(prim_path_str)
if prim.HasAPI(UsdShade.MaterialBindingAPI):
binding_api = UsdShade.MaterialBindingAPI(prim)
# Check direct bindings
direct_binding = binding_api.GetDirectBinding()
if direct_binding:
bound_material = direct_binding.GetMaterial()
if bound_material:
material_path = str(bound_material.GetPath())
# Check if the material actually exists
if material_path not in valid_materials:
invalid_materials_found.add(material_path)
print(f" Clearing invalid binding on {prim.GetPath()}")
print(f" References non-existent material: {material_path}")
# Clear the binding using Kit command
try:
omni.kit.commands.execute('BindMaterial',
prim_path=str(prim.GetPath()),
material_path=None, # Unbind
strength='weakerThanDescendants'
)
cleared_count += 1
except Exception as e:
print(f" Warning: Failed to clear binding: {e}")
# Check collection-based bindings
for collection_binding in binding_api.GetCollectionBindings():
bound_material = collection_binding.GetMaterial()
if bound_material:
material_path = str(bound_material.GetMaterialPath())
if material_path not in valid_materials:
invalid_materials_found.add(material_path)
print(f" Found invalid collection binding on {prim.GetPath()}")
print(f" References non-existent material: {material_path}")
print(f" Note: Collection bindings may need manual cleanup")
print(f"Cleared {cleared_count} invalid material bindings")
if invalid_materials_found:
print(f"Invalid material paths found ({len(invalid_materials_found)} unique):")
for invalid_path in list(invalid_materials_found)[:5]:
print(f" - {invalid_path}")
if len(invalid_materials_found) > 5:
print(f" ... and {len(invalid_materials_found) - 5} more")
return cleared_count
def assign_fallback_to_unbound_meshes():
"""
Assign fallback material to meshes that have no material binding.
USD concepts: UsdGeom.Mesh, MaterialBindingAPI existence check, binding creation
"""
print("\n=== Assigning Fallback Material to Unbound Meshes ===")
stage = omni.usd.get_context().get_stage()
if not stage:
print("Error: No active stage found")
return 0
# Find or create the fallback material
fallback_material_path = create_or_find_material(FALLBACK_MATERIAL, TARGET_MATERIALS[FALLBACK_MATERIAL])
# Validate that the fallback material exists
material_prim = stage.GetPrimAtPath(fallback_material_path)
if not material_prim.IsValid() or not material_prim.IsA(UsdShade.Material):
print(f"ERROR: Fallback material does not exist in stage: {fallback_material_path}")
print("Cannot assign fallback material to unbound meshes")
return 0
print(f"Using fallback material: {fallback_material_path}")
# Find all meshes without material bindings
unbound_meshes = []
for prim in stage.Traverse():
# Check if it's a mesh
if prim.IsA(UsdGeom.Mesh):
# Check if it has NO material binding
has_binding = False
if prim.HasAPI(UsdShade.MaterialBindingAPI):
binding_api = UsdShade.MaterialBindingAPI(prim)
direct_binding = binding_api.GetDirectBinding()
if direct_binding.GetMaterial():
has_binding = True
if not has_binding:
unbound_meshes.append(prim)
print(f"Found {len(unbound_meshes)} meshes without material assignments")
# Assign fallback material to unbound meshes
assigned_count = 0
for prim in unbound_meshes:
try:
omni.kit.commands.execute('BindMaterial',
prim_path=str(prim.GetPath()),
material_path=fallback_material_path,
strength='weakerThanDescendants'
)
assigned_count += 1
print(f" Assigned {FALLBACK_MATERIAL} to: {prim.GetPath()}")
except Exception as e:
print(f" Warning: Failed to bind {prim.GetPath()}: {e}")
print(f"Assigned {FALLBACK_MATERIAL} to {assigned_count} unbound meshes")
return assigned_count
def apply_prim_path_overrides():
"""
Apply material overrides to specific prim paths with flexible path matching.
Path Matching Modes:
1. Exact Match: If the full path exists in the stage, uses it directly
2. Partial Match: If exact path not found, searches for prims whose path ends with the specified path
Example: "/A/B/C" will match any prim ending with "/A/B/C" like "/Root/X/Y/A/B/C"
Prim Type Handling:
- If the prim is an Xform, assigns the material to all meshes in its hierarchy
- If the prim is a GeomSubset, clears the parent mesh binding to allow subset override
- If the prim is a Mesh, assigns directly
USD concepts: Usd.PrimRange for hierarchy traversal, UsdGeom.Mesh/Xform type checking,
UsdGeom.Subset for face-level material assignment, MaterialBindingAPI for binding materials
"""
if not PRIM_PATH_MATERIAL_OVERRIDES:
print("\n=== No Prim Path Overrides Configured ===")
return 0
print("\n=== Applying Prim Path Material Overrides ===")
stage = omni.usd.get_context().get_stage()
if not stage:
print("Error: No active stage found")
return 0
# First pass: Filter out paths that don't exist in the stage
print(f"Filtering {len(PRIM_PATH_MATERIAL_OVERRIDES)} configured overrides...")
valid_overrides = {}
skipped_overrides = []
for prim_path, target_material_name in PRIM_PATH_MATERIAL_OVERRIDES.items():
# Quick check: try exact path first
prim = stage.GetPrimAtPath(prim_path)
if prim.IsValid():
valid_overrides[prim_path] = target_material_name
else:
# Check if progressive suffix matching would find anything
path_segments = [seg for seg in prim_path.split('/') if seg]
found_match = False
for start_idx in range(min(3, len(path_segments))): # Only try first 3 levels for filtering
suffix_segments = path_segments[start_idx:]
suffix_path = '/' + '/'.join(suffix_segments)
# Quick check: see if ANY prim ends with this suffix
for stage_prim in stage.Traverse():
if str(stage_prim.GetPath()).endswith(suffix_path):
found_match = True
break
if found_match:
valid_overrides[prim_path] = target_material_name
break
if not found_match:
skipped_overrides.append(prim_path)
if skipped_overrides:
print(f"Skipping {len(skipped_overrides)} overrides with no matching prims in stage:")
for skipped_path in skipped_overrides[:5]: # Show first 5
print(f" - {skipped_path}")
if len(skipped_overrides) > 5:
print(f" ... and {len(skipped_overrides) - 5} more")
print(f"Processing {len(valid_overrides)} valid overrides")
if not valid_overrides:
print("No valid prim path overrides found in stage")
return 0
total_overrides = 0
cleared_mesh_bindings = set() # Track meshes we've cleared bindings from
def find_prims_by_partial_path(partial_path):
"""
Find all prims whose path matches a progressive suffix of the specified partial path.
Strategy:
1. Try exact suffix match: prim_path.endswith(partial_path)
2. If no match, try progressive suffixes starting from each "/" in the configured path
Example: If partial_path is "/Root/A/B/C", will try to match:
- "/Root/A/B/C" (exact)
- "/A/B/C" (skip first segment)
- "/B/C" (skip first two segments)
- "/C" (skip first three segments)
This handles cases where the stage has been deduplicated and top-level prims removed.
"""
matching_prims = []
# Split the path into segments
path_segments = [seg for seg in partial_path.split('/') if seg]
print(f" Trying to match path with {len(path_segments)} segments: {partial_path}")
# Try progressively shorter suffixes (from most specific to least specific)
for start_idx in range(len(path_segments)):
# Build the suffix path
suffix_segments = path_segments[start_idx:]
suffix_path = '/' + '/'.join(suffix_segments)
if start_idx > 0:
print(f" Trying suffix (skipping {start_idx} segment(s)): {suffix_path}")
# Check all prims for this suffix
for prim in stage.Traverse():
prim_path_str = str(prim.GetPath())
if prim_path_str.endswith(suffix_path):
# Avoid duplicates
if prim not in matching_prims:
matching_prims.append(prim)
print(f" MATCH: {prim_path_str}")
# If we found matches, stop trying shorter suffixes
if matching_prims:
print(f" Found {len(matching_prims)} match(es) with suffix: {suffix_path}")
break
if not matching_prims:
print(f" No matches found for any suffix of: {partial_path}")
print(f" DEBUG: First 5 prim paths in stage:")
for i, prim in enumerate(stage.Traverse()):
if i >= 5:
break
print(f" {prim.GetPath()}")
return matching_prims
for prim_path, target_material_name in valid_overrides.items():
print(f"\nProcessing override: {prim_path} -> {target_material_name}")
# USD: Validate target material exists in config
if target_material_name not in TARGET_MATERIALS:
print(f" Error: Unknown target material '{target_material_name}'")
continue
# USD: Try exact path match first
prim = stage.GetPrimAtPath(prim_path)
matching_prims = []
if prim.IsValid():
# Exact match found
matching_prims = [prim]
print(f" Found exact match: {prim_path}")
else:
# Try partial path matching
print(f" Exact path not found, searching for partial matches...")
matching_prims = find_prims_by_partial_path(prim_path)
if matching_prims:
print(f" Found {len(matching_prims)} partial match(es):")
for match in matching_prims:
print(f" - {match.GetPath()}")
else:
print(f" Warning: No prims found matching path: {prim_path}")
continue
# Process each matching prim
for prim in matching_prims:
# USD: Create or find the target material
material_path = create_or_find_material(target_material_name, TARGET_MATERIALS[target_material_name])
# Validate that the material actually exists in the stage
material_prim = stage.GetPrimAtPath(material_path)
if not material_prim.IsValid() or not material_prim.IsA(UsdShade.Material):
print(f" ERROR: Material does not exist in stage: {material_path}")
print(f" Skipping material assignment for: {prim.GetPath()}")
continue
print(f" Using material: {material_path}")
# USD: Check if prim is a GeomSubset (child of a Mesh for face-level materials)
if prim.IsA(UsdGeom.Subset):
print(f" Prim is a GeomSubset at {prim.GetPath()}, handling parent mesh binding...")
# USD: Get the parent mesh prim
parent_prim = prim.GetParent()
if parent_prim and parent_prim.IsA(UsdGeom.Mesh):
parent_path = str(parent_prim.GetPath())
# Clear parent mesh binding only once to allow GeomSubset bindings to take effect
# USD: strongerThanDescendants on parent would override GeomSubset bindings
if parent_path not in cleared_mesh_bindings:
try:
# Unbind material from parent mesh (set to None)
omni.kit.commands.execute('BindMaterial',
prim_path=parent_path,
material_path=None, # Clear the binding
strength='weakerThanDescendants'
)
cleared_mesh_bindings.add(parent_path)
print(f" Cleared material binding on parent mesh: {parent_path}")
except Exception as e:
print(f" Warning: Failed to clear parent mesh binding: {e}")
# Bind material to the GeomSubset
try:
omni.kit.commands.execute('BindMaterial',
prim_path=str(prim.GetPath()),
material_path=material_path,
strength='weakerThanDescendants' # Standard strength for subsets
)
total_overrides += 1
print(f" Assigned {target_material_name} to GeomSubset: {prim.GetPath()}")
except Exception as e:
print(f" Warning: Failed to bind material to GeomSubset {prim.GetPath()}: {e}")
continue
# Collect prims to assign material to
prims_to_assign = []
# USD: Check if prim is a mesh directly
if prim.IsA(UsdGeom.Mesh):
prims_to_assign.append(prim)
print(f" Prim is a Mesh, assigning directly")
# USD: Check if prim is an Xform (or any transformable) - traverse hierarchy for meshes
elif prim.IsA(UsdGeom.Xformable):
print(f" Prim is an Xform, finding all meshes in hierarchy...")
# USD: Use PrimRange to traverse all descendants
for descendant in Usd.PrimRange(prim):
if descendant.IsA(UsdGeom.Mesh):
prims_to_assign.append(descendant)
print(f" Found {len(prims_to_assign)} meshes under {prim.GetPath()}")
else:
print(f" Warning: Prim at {prim.GetPath()} is neither a Mesh, Xform, nor GeomSubset (type: {prim.GetTypeName()})")
continue
# USD: Apply material binding to each prim using MaterialBindingAPI
for target_prim in prims_to_assign:
try:
# Omniverse: Use BindMaterial command for proper undo support and binding
omni.kit.commands.execute('BindMaterial',
prim_path=str(target_prim.GetPath()),
material_path=material_path,
strength='strongerThanDescendants' # Override any inherited bindings
)
total_overrides += 1
print(f" Assigned {target_material_name} to: {target_prim.GetPath()}")
except Exception as e:
print(f" Warning: Failed to bind material to {target_prim.GetPath()}: {e}")
print(f"\nApplied {total_overrides} prim path material overrides")
if cleared_mesh_bindings:
print(f"Cleared bindings on {len(cleared_mesh_bindings)} parent meshes for GeomSubset overrides")
return total_overrides
def replace_materials():
"""
Execute complete material replacement workflow with template mapping and fallbacks.
USD concepts: material organization, batch processing, binding validation
"""
print("=== Material Replacement Process ===")
stage = omni.usd.get_context().get_stage()
if not stage:
print("Error: No active stage found")
return
# PRE-PASS: Clear any invalid material bindings (references to non-existent materials)
cleared_invalid = clear_invalid_material_bindings()
# USD: Pre-create all target materials if they don't exist
print("\n=== Ensuring Target Materials Exist ===")
for material_name, material_props in TARGET_MATERIALS.items():
material_path = create_or_find_material(material_name, material_props)
print(f" {material_name}: {material_path}")
# USD: Build material replacement mapping
material_replacements = get_dynamic_material_replacements()
if not material_replacements:
print("No material replacements to process")
# Still continue to process prim path overrides even if no replacements
else:
# Optimization: Group replacements by target material to minimize creation
target_groups = {}
for old_path, target_name in material_replacements.items():
if target_name not in target_groups:
target_groups[target_name] = []
target_groups[target_name].append(old_path)
print(f"\nProcessing {len(material_replacements)} replacements grouped into {len(target_groups)} targets")
total_replacements = 0
created_materials = {}
# Process each target material group
for target_name, old_material_paths in target_groups.items():
print(f"\n=== Target Material: {target_name} ===")
# Validate target material exists in config
if target_name not in TARGET_MATERIALS:
print(f" Error: Unknown target material '{target_name}'")
continue
# USD: Get material path (already created above)
default_prim = stage.GetDefaultPrim()
if default_prim and default_prim.IsValid():
default_prim_path = str(default_prim.GetPath())
else:
root_layer = stage.GetRootLayer()
default_prim_name = root_layer.defaultPrim or "World"
default_prim_path = f"/{default_prim_name}"
new_material_path = f"{default_prim_path}/Looks/{target_name}"
# Replace all materials that map to this target
group_replacements = 0
for old_material_path in old_material_paths:
# USD: Validate old material exists before replacement
old_material_prim = stage.GetPrimAtPath(old_material_path)
if not old_material_prim.IsValid():
print(f" Skipping missing material: {old_material_path}")
continue
# Replace bindings
updated_count = replace_material_bindings(old_material_path, new_material_path)
group_replacements += updated_count
total_replacements += updated_count
print(f" {target_name}: {group_replacements} bindings updated")
print(f"\n=== Complete ===")
print(f"Updated {total_replacements} total bindings")
# Assign fallback material to meshes with no material binding
unbound_assigned = assign_fallback_to_unbound_meshes()
# Apply specific prim path overrides (runs last to take priority)
overrides_applied = apply_prim_path_overrides()
# Clean up unused materials
removed_count = remove_unused_materials()
print(f"\n=== Final Summary ===")
print(f"Invalid material bindings cleared: {cleared_invalid}")
print(f"Total material bindings replaced: {total_replacements if material_replacements else 0}")
print(f"Total unbound meshes assigned fallback: {unbound_assigned}")
print(f"Total prim path overrides applied: {overrides_applied}")
print(f"Total unused materials removed: {removed_count}")
def remove_unused_materials():
"""
Remove materials that don't contribute to any rendered geometry.
Uses ComputeBoundMaterial() to resolve actual winning materials after
considering binding strength, hierarchy, and material purpose.
USD concepts: ComputeBoundMaterial resolution, binding strength, material purpose
"""
print("\n=== Removing Non-Contributing Materials ===")
stage = omni.usd.get_context().get_stage()
if not stage:
print("Error: No active stage found")
return 0
# Step 1: Collect all materials in the stage
all_materials = set()
for prim in stage.Traverse():
if prim.IsA(UsdShade.Material):
all_materials.add(str(prim.GetPath()))
print(f"Found {len(all_materials)} total materials in stage")
if not all_materials:
return 0
# Step 2: Collect all geometry prims (meshes, subsets, etc.)
geometry_prims = []
for prim in stage.Traverse():
# Include meshes and geom subsets (face-level material assignments)
if prim.IsA(UsdGeom.Gprim) or prim.IsA(UsdGeom.Subset):
geometry_prims.append(prim)
print(f"Found {len(geometry_prims)} geometry prims to check")
if not geometry_prims:
print("No geometry found - removing all materials")
contributing_materials = set()
else:
# Step 3: Use ComputeBoundMaterial to find materials that ACTUALLY contribute
# This resolves binding strength, hierarchy, and returns the winning material
contributing_materials = set()
for prim in geometry_prims:
binding_api = UsdShade.MaterialBindingAPI(prim)
# ComputeBoundMaterial returns the resolved/winning material
# considering all binding strengths and hierarchy
bound_material, binding_rel = binding_api.ComputeBoundMaterial()
if bound_material:
contributing_materials.add(str(bound_material.GetPath()))
print(f"Found {len(contributing_materials)} materials that actually contribute to rendering")
# Step 4: Find non-contributing materials
non_contributing = all_materials - contributing_materials
if not non_contributing:
print("All materials contribute - nothing to remove")
return 0
print(f"Found {len(non_contributing)} non-contributing materials to remove:")
# Step 5: Delete non-contributing materials
removed_count = 0
for material_path in sorted(non_contributing): # Sort for consistent output
prim = stage.GetPrimAtPath(material_path)
if prim.IsValid():
try:
material_name = prim.GetName()
omni.kit.commands.execute('DeletePrims', paths=[material_path])
removed_count += 1
print(f" Removed: {material_name}")
except Exception as e:
print(f" Warning: Failed to remove {material_path}: {e}")
print(f"Removed {removed_count} non-contributing materials")
return removed_count
replace_materials()
# # Material standardization workflow: Replace CAD materials with production-ready PBR materials
# if __name__ == "__main__":
# print("=== Dynamic Material Replacement ===")
# replace_materials()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419/***************************************************************************************************
* Copyright 2022 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.7;
import ::df::*;
import ::state::*;
import ::math::*;
import ::base::*;
import ::state::*;
import ::tex::*;
import ::anno::*;
import ::debug::*;
import ::nvidia::core_definitions::file_texture;
import ::nvidia::core_definitions::normalmap_texture;
import OmniPBR_ClearCoat::*;
// OmniPBR //
export material OmniPBR(
// Albdeo //
color diffuse_color_constant = color(0.2) [[
anno::display_name("Albedo Color"),
anno::description("This is the albedo base color"),
anno::in_group("Albedo")
]],
uniform texture_2d diffuse_texture = texture_2d() [[
anno::display_name("Albedo Map"),
anno::in_group("Albedo")
]],
float albedo_desaturation = float(0.0) [[
anno::display_name("Albedo Map Desaturation"),
anno::description("Desaturates the albedo map"),
anno::in_group("Albedo"),
anno::soft_range(float(0.0), float(1.0))
]],
float albedo_add = float(0.0) [[
anno::display_name("Albedo Add"),
anno::description("Adds a constant value to the diffuse color "),
anno::in_group("Albedo"),
anno::soft_range(float(-1.0), float(1.0))
]],
float albedo_brightness = float(1.0) [[
anno::display_name("Albedo Brightness"),
anno::description("Multiplier for the diffuse color "),
anno::in_group("Albedo"),
anno::soft_range(float(0.0), float(1.0))
]],
color diffuse_tint = color(1.0) [[
anno::display_name("Color Tint"),
anno::description("When enabled, this color value is multiplied over the final albedo color"),
anno::in_group("Albedo")
]],
// Reflectivity //
float reflection_roughness_constant = float(0.5) [[
anno::display_name("Roughness Amount"),
anno::description("Higher roughness values lead to more blurry reflections"),
anno::in_group("Reflectivity"),
anno::hard_range(float(0.0), float(1.0))
]],
float reflection_roughness_texture_influence = float(0.0) [[
anno::display_name("Roughness Map Influence"),
anno::description("Blends between the constant value and the lookup of the roughness texture"),
anno::in_group("Reflectivity"),
anno::hard_range(float(0.0), float(1.0))
]],
uniform texture_2d reflectionroughness_texture = texture_2d() [[
anno::display_name("Roughness Map"),
anno::in_group("Reflectivity"),
anno::usage("roughness")
]],
float metallic_constant = float(0.0) [[
anno::display_name("Metallic Amount"),
anno::description("Metallic Material"),
anno::in_group("Reflectivity"),
anno::hard_range(float(0.0), float(1.0))
]],
float metallic_texture_influence = float(0.0) [[
anno::display_name("Metallic Map Influence"),
anno::description("Blends between the constant value and the lookup of the metallic texture"),
anno::in_group("Reflectivity"),
anno::hard_range(float(0.0), float(1.0))
]],
uniform texture_2d metallic_texture = texture_2d() [[
anno::display_name("Metallic Map"),
anno::in_group("Reflectivity"),
anno::usage("metalness")
]],
float specular_level = float(0.5) [[
anno::display_name("Specular"),
anno::description("The specular level (intensity) of the material"),
anno::in_group("Reflectivity"),
anno::soft_range(float(0.0), float(1.0))
]],
// ORM //
uniform bool enable_ORM_texture = false [[
anno::display_name("Enable ORM Texture"),
anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"),
anno::in_group("Reflectivity")
]],
uniform texture_2d ORM_texture = texture_2d() [[
anno::display_name("ORM Map"),
anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"),
anno::in_group("Reflectivity"),
anno::usage("roughness")
]],
// AO Group //
float ao_to_diffuse = 0.0 [[
anno::display_name("AO to diffuse"),
anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"),
anno::in_group("AO"),
anno::hard_range(float(0.0), float(1.0))
]],
uniform texture_2d ao_texture = texture_2d() [[
anno::display_name("Ambient Occlusion Map"),
anno::description("The ambient occlusion texture for the material"),
anno::in_group("AO"),
anno::usage("occlusion")
]],
// Emission //
uniform bool enable_emission = false [[
anno::display_name("Enable Emission"),
anno::description("Enables the emission of light from the material"),
anno::in_group("Emissive")
]],
color emissive_color = color(1.0,0.1,0.1) [[
anno::display_name("Emissive Color"),
anno::description("The emission color"),
anno::in_group("Emissive"),
anno::enable_if("enable_emission == true")
]],
uniform texture_2d emissive_color_texture = texture_2d() [[
anno::display_name("Emissive Color map"),
anno::in_group("Emissive"),
anno::description("The emissive color texture"),
anno::enable_if("enable_emission == true")
]],
uniform texture_2d emissive_mask_texture = texture_2d() [[
anno::display_name("Emissive Mask map"),
anno::description("The texture masking the emissive color"),
anno::in_group("Emissive"),
anno::enable_if("enable_emission == true"),
anno::usage("occlusion")
]],
float emissive_intensity = float(40.0) [[
anno::display_name("Emissive Intensity"),
anno::description("Intensity of the emission"),
anno::in_group("Emissive"),
anno::enable_if("enable_emission == true")
]],
// Cutout Opacity //
uniform bool enable_opacity = false [[
anno::display_name("Enable Opacity"),
anno::description("Enables the use of cutout opacity"),
anno::in_group("Opacity")
]],
uniform texture_2d opacity_texture = texture_2d() [[
anno::display_name("Opacity Map"),
anno::in_group("Opacity"),
anno::usage("opacity")
]],
float opacity_constant = float(1.0) [[
anno::display_name("Opacity Amount"),
anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"),
anno::in_group("Opacity"),
anno::hard_range(float(0.0), float(1.0))
]],
uniform bool enable_opacity_texture = false [[
anno::display_name("Enable Opacity Texture"),
anno::description("Enables or disables the usage of the opacity texture map"),
anno::in_group("Opacity")
]],
uniform base::mono_mode opacity_mode = base::mono_average [[
anno::display_name("Opacity Mono Source"),
anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"),
anno::in_group("Opacity")
]],
uniform float opacity_threshold = float(0.0) [[
anno::hard_range(0.0, 1.0),
anno::display_name("Opacity Threshold"),
anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"),
anno::in_group("Opacity")
]],
// Normal //
uniform float geometry_normal_roughness_strength = 1.f
[[
anno::hard_range(0.0, 1.0),
anno::display_name("Normal map to roughness weight"),
anno::description("Enables and weights roughness induced by normal maps"),
anno::in_group("Normal")
]],
uniform float bump_factor = float(1.0) [[
anno::display_name("Normal Strength"),
anno::description("Strength of normal map"),
anno::in_group("Normal"),
anno::soft_range(float(0.0), float(1.0))
]],
uniform texture_2d normalmap_texture = texture_2d() [[
anno::display_name("Normal Map"),
anno::in_group("Normal"),
anno::usage("normal")
]],
uniform float detail_bump_factor = float(0.3) [[
anno::display_name("Detail Normal Strength"),
anno::in_group("Normal"),
anno::description("Strength of the detail normal"),
anno::soft_range(float(0.0), float(1.0))
]],
uniform texture_2d detail_normalmap_texture = texture_2d() [[
anno::display_name("Detail Normal Map"),
anno::in_group("Normal"),
anno::usage("normal")
]],
uniform bool flip_tangent_u = false [[
anno::display_name("Normal Map Flip U Tangent"),
anno::in_group("Normal")
]],
uniform bool flip_tangent_v = true [[
anno::display_name("Normal Map Flip V Tangent"),
anno::in_group("Normal")
]],
// UVW Projection Group //
uniform bool project_uvw = false [[
anno::display_name("Enable Project UVW Coordinates"),
anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"),
anno::in_group("UV")
]],
uniform bool world_or_object = false [[
anno::display_name("Enable World Space"),
anno::description("When enabled, uses world space for projection, otherwise object space is used"),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform int uv_space_index = 0 [[
anno::display_name("UV Space Index"),
anno::description("UV Space Index."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true"),
anno::hard_range(int(0), int(3))
]],
// UVW Adjustments Group //
uniform float2 texture_translate = float2(0.0) [[
anno::display_name("Texture Translate"),
anno::description("Controls position of texture."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform float texture_rotate = float(0.0) [[
anno::display_name("Texture Rotate"),
anno::description("Rotates angle of texture in degrees."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform float2 texture_scale = float2(1.0) [[
anno::display_name("Texture Tiling"),
anno::description("Controls the repetition of the texture."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform float2 detail_texture_translate = float2(0.0) [[
anno::display_name("Detail Texture Translate"),
anno::description("Controls the position of the detail texture."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform float detail_texture_rotate = float(0.0) [[
anno::display_name("Detail Texture Rotate"),
anno::description("Rotates angle of the detail texture in degrees."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform float2 detail_texture_scale = float2(1.0) [[
anno::display_name("Detail Texture Tiling"),
anno::description("Controls the repetition of the detail texture."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
// Geometry //
uniform float round_edges_radius = float(0.0) [[
anno::display_name("Round Edge Radius"),
anno::description("Influence radius around the edges in meters"),
anno::in_group("Geometry"),
anno::soft_range(0.0, 1.0)
]],
uniform float round_edges_roundness = float(1.0) [[
anno::display_name("Round Edge Roundness"),
anno::description("Determines how round the edge will look"),
anno::in_group("Geometry"),
anno::hard_range(0.0, 1.0)
]],
uniform bool round_edges_across_materials = false [[
anno::display_name("Round Edge Across Materials"),
anno::description("Normal smoothing happens only between facets of equal material, \n"
"\t\tunless this parameter is set true, in which case the smoothing \n"
"\t\thappens between facets irrespective of their materials"),
anno::in_group("Geometry")
]]
)
[[
anno::display_name("OmniPBR"),
anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."),
anno::in_group("Base"),
anno::version( 2, 1, 2),
anno::author("NVIDIA CORPORATION"),
anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic"))
]] = let {
material base = OmniPBR_ClearCoat::OmniPBR_ClearCoat(
diffuse_color_constant: diffuse_color_constant,
diffuse_texture: diffuse_texture,
albedo_desaturation: albedo_desaturation,
albedo_add: albedo_add,
albedo_brightness: albedo_brightness,
diffuse_tint: diffuse_tint,
reflection_roughness_constant: reflection_roughness_constant,
reflection_roughness_texture_influence: reflection_roughness_texture_influence,
reflectionroughness_texture: reflectionroughness_texture,
metallic_constant: metallic_constant,
metallic_texture_influence: metallic_texture_influence,
metallic_texture: metallic_texture,
specular_level: specular_level,
enable_ORM_texture: enable_ORM_texture,
ORM_texture: ORM_texture,
ao_to_diffuse: ao_to_diffuse,
ao_texture: ao_texture,
enable_emission: enable_emission,
emissive_color: emissive_color,
emissive_color_texture: emissive_color_texture,
emissive_mask_texture: emissive_mask_texture,
emissive_intensity: emissive_intensity,
enable_opacity: enable_opacity,
opacity_texture: opacity_texture,
opacity_constant: opacity_constant,
enable_opacity_texture: enable_opacity_texture,
opacity_mode: opacity_mode,
opacity_threshold: opacity_threshold,
geometry_normal_roughness_strength: geometry_normal_roughness_strength,
bump_factor: bump_factor,
normalmap_texture: normalmap_texture,
detail_bump_factor: detail_bump_factor,
detail_normalmap_texture: detail_normalmap_texture,
flip_tangent_u: flip_tangent_u,
flip_tangent_v: flip_tangent_v,
project_uvw: project_uvw,
world_or_object: world_or_object,
uv_space_index: uv_space_index,
texture_translate: texture_translate,
texture_rotate: texture_rotate,
texture_scale: texture_scale,
detail_texture_translate: detail_texture_translate,
detail_texture_rotate: detail_texture_rotate,
detail_texture_scale: detail_texture_scale,
round_edges_radius: round_edges_radius,
round_edges_roundness: round_edges_roundness,
round_edges_across_materials: round_edges_across_materials
);
} in material(
surface: base.surface,
geometry: base.geometry
);123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493/***************************************************************************************************
* Copyright 2022 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.7;
import ::df::*;
import ::state::*;
import ::math::*;
import ::base::*;
import ::tex::*;
import ::anno::*;
import ::anno::*;
export float3 HemiOctahedronToUnitVector( float2 Oct ) [[
anno::hidden()
]]
{
Oct = float2( Oct.x + Oct.y, Oct.x - Oct.y ) * 0.5;
float3 N = float3( Oct.x, Oct.y, 1.0 - math::dot( float2(1.0), math::abs(Oct) ) );
return math::normalize(N);
}
export struct NormalData [[
anno::hidden()
]]
{
float3 normal;
float2 roughness;
};
export NormalData tangent_space_normal_roughness_texture(
uniform texture_2d texture
[[
anno::description("The input texture"),
anno::usage("normal")
]],
uniform float factor = 1.0f
[[ anno::description("Determines the degree of bumpiness") ]],
uniform bool flip_tangent_u = false
[[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]],
uniform bool flip_tangent_v = false
[[ anno::description("Can be used to fix mismatches between the object's tangent space and the normal map's tangent space") ]],
base::texture_coordinate_info uvw = base::texture_coordinate_info()
[[ anno::description("Parameterization to be used for texture mapping. Defaults to texture channel 0.") ]],
uniform float2 crop_u = float2( 0.0, 1.0)
[[ anno::description("Restricts the texture access to sub-domain of the texture in the u direction") ]],
uniform float2 crop_v = float2( 0.0, 1.0)
[[ anno::description("Restricts the texture access to sub-domain of the texture in the v direction") ]],
uniform tex::wrap_mode wrap_u = tex::wrap_repeat
[[ anno::description("Wrapping mode in the u direction") ]],
uniform tex::wrap_mode wrap_v = tex::wrap_repeat
[[ anno::description("Wrapping mode in the v direction") ]],
uniform bool clip = false
[[
anno::description("deprecated, usewrap_mode=tex::wrap_clip. Defines wrap_clamp behavior. If true, lookup outside [0,1] results in no bump"),
anno::hidden()
]],
uniform float scale = 1.
[[
anno::description("Scales the value red from the texture file. Can be used to adapt to different normal map formats"),
anno::unused()
]],
uniform float offset = 0.
[[
anno::description("Offset applied to the value red from the texture file. Can be used to adapt to different normal map formats"),
anno::unused()
]],
uniform float animation_start_time = 0.
[[ anno::description("When to start playing first frame of the animation ") ]],
uniform int2 animation_crop = int2(0, 0)
[[ anno::description("If the texture is an animation, the range of frames to be played can be specified.") ]],
uniform tex::wrap_mode animation_wrap = tex::wrap_repeat
[[ anno::description("Defines what to do outside of regular animation time") ]],
uniform float animation_fps = 30
[[ anno::description("Framerate to use for animation playback") ]]
)
[[
anno::description("Interprets the color values of a bitmap as a vector in tangent space"),
anno::hidden(),
anno::noinline()
]]
{
NormalData normalData;
normalData.roughness = float2(0);
normalData.normal = state::normal();
float frame = 0.0;
if(animation_crop != int2(0,0)) //only if we have an animation
{
frame = (::state::animation_time()-animation_start_time) * animation_fps ; //start playing at first frame of the animation
switch ( animation_wrap) {
case tex::wrap_repeat:
frame=frame>0? math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.x:
math::fmod(frame,animation_crop.y-animation_crop.x)+animation_crop.y;
break;
case tex::wrap_mirrored_repeat:
float animation_crop_2y = 2.0*animation_crop.y;
frame=frame>0? math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop.x:
math::fmod(frame,(animation_crop.y-animation_crop.x)*2.0)+animation_crop_2y-animation_crop.x;
if(frame>animation_crop.y)
frame = animation_crop_2y-frame;
break;
case tex::wrap_clamp:
frame = math::clamp( frame+animation_crop.x, animation_crop.x, animation_crop.y);
break;
case tex::wrap_clip:
frame += animation_crop.x;
if(frame < animation_crop.x || frame > animation_crop.y) return normalData;
break;
}
}
if (tex::width(texture) == 0 || tex::height(texture) == 0 || // avoid division by zero in texremapu for invalid resource
factor == 0.0f)
return normalData;
{
if (clip) {
if (wrap_u == tex::wrap_clamp && (uvw.position.x < 0. || uvw.position.x > 1.)) {
return normalData;
}
if (wrap_v == tex::wrap_clamp && (uvw.position.y < 0. || uvw.position.y > 1.)) {
return normalData;
}
}
if (wrap_u == tex::wrap_clip && (uvw.position.x < 0. || uvw.position.x > 1.)) {
return normalData;
}
if (wrap_v == tex::wrap_clip && (uvw.position.y < 0. || uvw.position.y > 1.)) {
return normalData;
}
}
bool pixel_flip_u = flip_tangent_u;
bool pixel_flip_v = flip_tangent_v;
//if we mirror repeat a tangent space texture, tangent space needs to be flipped for every other tile
if (wrap_u == tex::wrap_mirrored_repeat) {
if( uvw.position.x > 0. && int(uvw.position.x) % 2 == 1)
pixel_flip_u = ! pixel_flip_u;
else if( uvw.position.x < 0. && int(uvw.position.x) % 2 == 0)
pixel_flip_u = ! pixel_flip_u;
}
if (wrap_v == tex::wrap_mirrored_repeat) {
if( uvw.position.y > 0. && int(uvw.position.y) % 2 == 1)
pixel_flip_v = ! pixel_flip_v;
else if( uvw.position.y < 0. && int(uvw.position.y) % 2 == 0)
pixel_flip_v = ! pixel_flip_v;
}
float3 transformed_tangent_u = uvw.tangent_u;
float3 transformed_tangent_v = uvw.tangent_v;
if (pixel_flip_u)
transformed_tangent_u=-transformed_tangent_u;
if (pixel_flip_v)
transformed_tangent_v=-transformed_tangent_v;
float3 tangent_space_normal;
float4 normal_raw = tex::lookup_float4(texture,float2(uvw.position.x,uvw.position.y), wrap_u, wrap_v, crop_u, crop_v, frame);
if(normal_raw.x > 1.5)
{
// octahedron packed by OV
normal_raw.x -= 2.0;
normal_raw.x -= 0.5;
normal_raw.y -= 0.5;
tangent_space_normal = HemiOctahedronToUnitVector(float2(normal_raw.x, normal_raw.y) * 2.0);
normalData.roughness = float2(normal_raw.z, normal_raw.w);
}
else
{
// regular
tangent_space_normal = (float3(normal_raw.x, normal_raw.y, normal_raw.z) - float3(0.5)) * 2.0;
normalData.roughness = float2(0);
}
normalData.normal = math::normalize(
transformed_tangent_u * tangent_space_normal.x * factor +
transformed_tangent_v * tangent_space_normal.y * factor +
state::normal() * tangent_space_normal.z);
return normalData;
}
export material OmniPBRBase(
// Albdeo //
color diffuse_reflection_color = color(0.2) [[
anno::display_name("Albedo Color"),
anno::description("This is the albedo base color"),
anno::in_group("Albedo")
]],
color diffuse_tint = color(1.0) [[
anno::display_name("Albedo Tint"),
anno::description("When enabled, this color value is multiplied over the final albedo color"),
anno::in_group("Albedo")
]],
// Reflecitivity //
float specular_reflection_roughness = float(0.0) [[
anno::display_name("Roughness"),
anno::description("Higher roughness values lead to more blurry reflections"),
anno::in_group("Reflectivity"),
anno::hard_range(0.0, 1.0)
]],
float2 specular_reflection_aniso_roughness = float2(0.0, 0.0) [[
anno::display_name("Aniso roughness"),
anno::description("Higher roughness values lead to more blurry reflections"),
anno::in_group("Reflectivity"),
anno::hidden()
]],
float metalness = float(0.0) [[
anno::display_name("Metalness"),
anno::description("Bias towards pure specular reflection"),
anno::in_group("Reflectivity"),
anno::hard_range(0.0, 1.0)
]],
float specular_level = float(0.5) [[
anno::display_name("Specular"),
anno::description("The specular level (intensity) of the material"),
anno::in_group("Reflectivity"),
anno::soft_range(0.0, 1.0)
]],
// Emission //
uniform bool enable_emission = false [[
anno::display_name("Enable Emission"),
anno::description("Enables the emission of light from the material"),
anno::in_group("Emissive")
]],
color emission_color = color(1.0,0.1,0.1) [[
anno::display_name("Emissive Color"),
anno::description("The emission color"),
anno::in_group("Emissive"),
anno::enable_if("enable_emission == true")
]],
float emission_intensity = float(40.0) [[
anno::display_name("Emissive Intensity"),
anno::description("Intensity of the emission"),
anno::in_group("Emissive"),
anno::soft_range(0.0, 1000.0),
anno::enable_if("enable_emission == true")
]],
// Geometry Opacity //
uniform bool enable_opacity = false [[
anno::display_name("Enable Opacity"),
anno::description("Enables the use of cutout opacity"),
anno::in_group("Opacity")
]],
float geometry_opacity = float(1.0) [[
anno::display_name("Opacity Amount"),
anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"),
anno::in_group("Opacity"),
anno::hard_range(0.0, 1.0)
]],
uniform float geometry_opacity_threshold = 0.f
[[
anno::display_name("Opacity Threshold"),
anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"),
anno::in_group("Opacity"),
anno::hard_range(0.0, 1.0)
]],
// Clearcoat //
uniform bool enable_coat = false [[
anno::display_name("Enable Clearcoat Layer"),
anno::description("Adds a coat layer on top of the material when enabled"),
anno::in_group("Clearcoat")
]],
float coat_weight = float(1.0) [[
anno::display_name("Clearcoat Weight"),
anno::description("Sets the weight for coat layer"),
anno::in_group("Clearcoat"),
anno::hard_range(0.0, 1.0)
]],
color coat_color = color(1.0) [[
anno::display_name("Clearcoat Tint"),
anno::description("Clearcoat is tinted and affects the underlying material"),
anno::in_group("Clearcoat")
]],
float coat_transparency = float(1.0) [[
anno::display_name("Clearcoat Transparency"),
anno::description("Adjusts the transparency of the coat. Can be turned into a fully opaque coat covering the underlying layer"),
anno::in_group("Clearcoat"),
anno::hard_range(0.0, 1.0)
]],
float coat_roughness = float(0.0) [[
anno::display_name("Clearcoat Roughness"),
anno::description("Higher roughness values lead to more blurry reflections"),
anno::in_group("Clearcoat"),
anno::hard_range(0.0, 1.0)
]],
float2 coat_aniso_roughness = float2(0.0, 0.0) [[
anno::display_name("Clearcoat aniso roughness"),
anno::description("Higher roughness values lead to more blurry reflections"),
anno::in_group("Clearcoat"),
anno::hidden()
]],
float coat_ior = float(1.56) [[
anno::display_name("Clearcoat IOR"),
anno::description("Sets the Index of refraction for the coat layer"),
anno::in_group("Clearcoat"),
anno::soft_range(0.0, 4.0)
]],
float3 clearcoat_geometry_normal = state::normal() [[
anno::display_name("Clearcoat Normal"),
anno::in_group("Clearcoat"),
anno::usage("normal")
]],
// Geometry //
uniform float round_edges_radius = float(0.0) [[
anno::display_name("Round Edge Radius"),
anno::description("Influence radius around the edges in meters"),
anno::in_group("Geometry"),
anno::soft_range(0.0, 1.0)
]],
uniform float round_edges_roundness = float(1.0) [[
anno::display_name("Round Edge Roundness"),
anno::description("Determines how round the edge will look"),
anno::in_group("Geometry"),
anno::hard_range(0.0, 1.0)
]],
uniform bool round_edges_across_materials = false [[
anno::display_name("Round Edge Across Materials"),
anno::description("Normal smoothing happens only between facets of equal material, \n"
"\t\tunless this parameter is set true, in which case the smoothing \n"
"\t\thappens between facets irrespective of their materials"),
anno::in_group("Geometry")
]],
float3 geometry_normal = state::normal() [[
anno::display_name("Geometry Normal"),
anno::in_group("Geometry"),
anno::usage("normal")
]]
)
[[
anno::display_name("OmniPBR Base"),
anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."),
anno::in_group("Omni Materials"),
anno::version( 2, 1, 1),
anno::author("NVIDIA CORPORATION"),
anno::key_words(string[]("omni", "PBR", "opacity", "omniverse", "generic"))
]]
= let{
// Diffuse Bsdf //
color tinted_diffuse_color = diffuse_reflection_color * diffuse_tint;
color base_color = tinted_diffuse_color;
bsdf diffuse_bsdf = df::weighted_layer(
weight: 1.0,
layer: df::diffuse_reflection_bsdf(
tint: base_color,
roughness: float(0.0)
),
base: bsdf(),
normal: geometry_normal
);
// Glossy Reflection Bsdf //
float roughness_u = math::clamp(specular_reflection_roughness * specular_reflection_roughness
+ specular_reflection_aniso_roughness.x * specular_reflection_aniso_roughness.x, 0, 1);
float roughness_v = math::clamp(specular_reflection_roughness * specular_reflection_roughness
+ specular_reflection_aniso_roughness.y * specular_reflection_aniso_roughness.y, 0, 1);
bsdf ggx_smith_bsdf = df::microfacet_ggx_smith_bsdf(
roughness_u: roughness_u,
roughness_v: roughness_v,
tint: color(1.0),
mode: df::scatter_reflect
);
bsdf custom_curve_layer_bsdf = df::custom_curve_layer(
normal_reflectivity: 0.08,
grazing_reflectivity: 1.0,
exponent: 5.0,
weight: specular_level,
layer: ggx_smith_bsdf,
base: diffuse_bsdf,
normal: geometry_normal
);
bsdf directional_factor_bsdf = df::tint(base_color, ggx_smith_bsdf);
bsdf omni_PBR_bsdf = df::weighted_layer(
weight: metalness,
layer: directional_factor_bsdf,
base: custom_curve_layer_bsdf,
normal: geometry_normal
);
// Clear Coat //
float coat_roughness_u = math::clamp(coat_roughness * coat_roughness
+ coat_aniso_roughness.x * coat_aniso_roughness.x, 0, 1);
float coat_roughness_v = math::clamp(coat_roughness * coat_roughness
+ coat_aniso_roughness.y * coat_aniso_roughness.y, 0, 1);
bsdf coat_bsdf = df::microfacet_ggx_smith_bsdf(
roughness_u: coat_roughness_u,
roughness_v: coat_roughness_v,
tint: color(1.0),
mode: df::scatter_reflect
);
bsdf opaque_coat = df::weighted_layer(
weight: coat_transparency,
layer: ::df::tint(
tint: coat_color,
base: omni_PBR_bsdf
),
base: ::df::diffuse_reflection_bsdf(
tint: coat_color
)
);
bsdf omni_PBR_coated_bsdf = df::fresnel_layer(
ior: coat_ior,
weight: coat_weight,
layer: coat_bsdf,
base: opaque_coat,
normal: clearcoat_geometry_normal
);
bsdf final_bsdf = enable_coat ? omni_PBR_coated_bsdf : omni_PBR_bsdf;
color emission_value = enable_emission ? emission_color * color(emission_intensity) : color(0.0);
float opacity_value = geometry_opacity;
float cutout_opacity = enable_opacity ? ((geometry_opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= geometry_opacity_threshold) ? 1.0 : 0)) : 1.0;
material_emission emission = material_emission(
df::diffuse_edf(),
intensity: emission_value
);
material_surface surface = material_surface(
scattering: final_bsdf,
emission: emission
);
material_geometry geometry = material_geometry(
normal: state::rounded_corner_normal(
radius: round_edges_radius,
across_materials: round_edges_across_materials,
roundness: round_edges_roundness
),
cutout_opacity: cutout_opacity
);
} in material(
surface: surface,
geometry: geometry
);123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734/***************************************************************************************************
* Copyright 2022 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.7;
import ::df::*;
import ::state::*;
import ::math::*;
import ::base::*;
import ::state::*;
import ::tex::*;
import ::anno::*;
import ::debug::*;
import ::nvidia::core_definitions::file_texture;
import ::nvidia::core_definitions::normalmap_texture;
import OmniPBRBase::*;
// Functions //
// Returns a matrix from R,T,S. inputs //
uniform float4x4 rotation_translation_scale(
uniform float3 rotation = float3(0.)
[[ anno::description("Rotation applied to every UVW coordinate") ]],
uniform float3 translation = float3(0.)
[[ anno::description("Offset applied to every UVW coordinate") ]],
uniform float3 scaling = float3(1.)
[[ anno::description("Scale applied to every UVW coordinate") ]]
)
[[
anno::description("Construct a transformation matrix from euler rotation, translation and scale"),
anno::hidden()
]]
{
float4x4 scale =
float4x4(scaling.x , 0.0 , 0.0 , 0.0,
0.0 , scaling.y , 0.0 , 0.0,
0.0 , 0.0 , scaling.z , 0.0,
translation.x , translation.y , translation.z , 1.0);
float3 s = math::sin(rotation);
float3 c = math::cos(rotation);
float4x4 rotate =
float4x4( c.y*c.z , -c.x*s.z + s.x*s.y*c.z , s.x*s.z + c.x*s.y*c.z , 0.0,
c.y*s.z , c.x*c.z + s.x*s.y*s.z , -s.x*c.z + c.x*s.y*s.z , 0.0,
-s.y , s.x*c.y , c.x*c.y , 0.0,
0.0 , 0.0 , 0 , 1.0);
return scale * rotate;
}
// Returns the normal n in tangent space, given n is in internal space. //
float3 transform_internal_to_tangent(float3 n)
{
/* flip_tangent_v */
return
n.x* float3(state::texture_tangent_u(0).x,-state::texture_tangent_v(0).x,state::normal().x)+
n.y* float3(state::texture_tangent_u(0).y,-state::texture_tangent_v(0).y,state::normal().y)+
n.z* float3(state::texture_tangent_u(0).z,-state::texture_tangent_v(0).z,state::normal().z);
}
// Returns the normal n in internal space, given n is in tangent space.
float3 transform_tangent_to_internal(float3 n)
{
return state::texture_tangent_u(0) * n.x -
state::texture_tangent_v(0) * n.y + /* flip_tangent_v */
state::normal() * n.z;
}
// Returns a normal by adding a detail normal to a global normal.
export float3 add_detail_normal(float3 nd = state::normal(), float3 n = state::normal())
{
// http://blog.selfshadow.com/publications/blending-in-detail/
float3 n_t = transform_internal_to_tangent(n);
float3 nd_t = transform_internal_to_tangent(nd);
n_t = n_t + float3(0.,0.,1.);
nd_t = nd_t * float3(-1.,-1.,1.);
n = n_t * math::dot(n_t, nd_t)/n_t.z - nd_t;
return math::normalize(transform_tangent_to_internal(n));
}
base::texture_return multiply_colors(
color color_1 = color(1.0, 1.0, 1.0),
color color_2 = color(.5, .5, .5),
float weight = 1.0
)
[[
anno::hidden()
]]
{
return base::blend_color_layers(
layers: base::color_layer[](
base::color_layer(
layer_color: color_2,
weight: weight,
mode: base::color_layer_multiply
)),
base: color_1
);
}
// OmniPBR Clearcoat //
export material OmniPBR_ClearCoat(
// Albdeo //
color diffuse_color_constant = color(0.2) [[
anno::display_name("Albedo Color"),
anno::description("This is the albedo base color"),
anno::in_group("Albedo")
]],
uniform texture_2d diffuse_texture = texture_2d() [[
anno::display_name("Albedo Map"),
anno::in_group("Albedo")
]],
float albedo_desaturation = float(0.0) [[
anno::display_name("Albedo Map Desaturation"),
anno::description("Desaturates the albedo map"),
anno::in_group("Albedo"),
anno::soft_range(float(0.0), float(1.0))
]],
float albedo_add = float(0.0) [[
anno::display_name("Albedo Add"),
anno::description("Adds a constant value to the diffuse color "),
anno::in_group("Albedo"),
anno::soft_range(float(-1.0), float(1.0))
]],
float albedo_brightness = float(1.0) [[
anno::display_name("Albedo Brightness"),
anno::description("Multiplier for the diffuse color "),
anno::in_group("Albedo"),
anno::soft_range(float(0.0), float(1.0))
]],
color diffuse_tint = color(1.0) [[
anno::display_name("Color Tint"),
anno::description("When enabled, this color value is multiplied over the final albedo color"),
anno::in_group("Albedo")
]],
// Reflectivity //
float reflection_roughness_constant = float(0.5) [[
anno::display_name("Roughness Amount"),
anno::description("Higher roughness values lead to more blurry reflections"),
anno::in_group("Reflectivity"),
anno::hard_range(float(0.0), float(1.0))
]],
float reflection_roughness_texture_influence = float(0.0) [[
anno::display_name("Roughness Map Influence"),
anno::description("Blends between the constant value and the lookup of the roughness texture"),
anno::in_group("Reflectivity"),
anno::hard_range(float(0.0), float(1.0))
]],
uniform texture_2d reflectionroughness_texture = texture_2d() [[
anno::display_name("Roughness Map"),
anno::in_group("Reflectivity"),
anno::usage("roughness")
]],
float metallic_constant = float(0.0) [[
anno::display_name("Metallic Amount"),
anno::description("Metallic Material"),
anno::in_group("Reflectivity"),
anno::hard_range(float(0.0), float(1.0))
]],
float metallic_texture_influence = float(0.0) [[
anno::display_name("Metallic Map Influence"),
anno::description("Blends between the constant value and the lookup of the metallic texture"),
anno::in_group("Reflectivity"),
anno::hard_range(float(0.0), float(1.0))
]],
uniform texture_2d metallic_texture = texture_2d() [[
anno::display_name("Metallic Map"),
anno::in_group("Reflectivity"),
anno::usage("metalness")
]],
float specular_level = float(0.5) [[
anno::display_name("Specular"),
anno::description("The specular level (intensity) of the material"),
anno::in_group("Reflectivity"),
anno::soft_range(float(0.0), float(1.0))
]],
// ORM //
uniform bool enable_ORM_texture = false [[
anno::display_name("Enable ORM Texture"),
anno::description("The ORM texture will be used to extract the Occlusion, Roughness and Metallic textures from R,G,B channels"),
anno::in_group("Reflectivity")
]],
uniform texture_2d ORM_texture = texture_2d() [[
anno::display_name("ORM Map"),
anno::description("Texture that has Occlusion, Roughness and Metallic maps stored in their respective R, G and B channels"),
anno::in_group("Reflectivity"),
anno::usage("roughness")
]],
// AO Group //
float ao_to_diffuse = 0.0 [[
anno::display_name("AO to diffuse"),
anno::description("Controls the amount of ambient occlusion multiplied against the diffuse color channel"),
anno::in_group("AO"),
anno::hard_range(float(0.0), float(1.0))
]],
uniform texture_2d ao_texture = texture_2d() [[
anno::display_name("Ambient Occlusion Map"),
anno::description("The ambient occlusion texture for the material"),
anno::in_group("AO"),
anno::usage("occlusion")
]],
// Emission //
uniform bool enable_emission = false [[
anno::display_name("Enable Emission"),
anno::description("Enables the emission of light from the material"),
anno::in_group("Emissive")
]],
color emissive_color = color(1.0,0.1,0.1) [[
anno::display_name("Emissive Color"),
anno::description("The emission color"),
anno::in_group("Emissive"),
anno::enable_if("enable_emission == true")
]],
uniform texture_2d emissive_color_texture = texture_2d() [[
anno::display_name("Emissive Color map"),
anno::in_group("Emissive"),
anno::description("The emissive color texture"),
anno::enable_if("enable_emission == true")
]],
uniform texture_2d emissive_mask_texture = texture_2d() [[
anno::display_name("Emissive Mask map"),
anno::description("The texture masking the emissive color"),
anno::in_group("Emissive"),
anno::enable_if("enable_emission == true"),
anno::usage("occlusion")
]],
float emissive_intensity = float(40.0) [[
anno::display_name("Emissive Intensity"),
anno::description("Intensity of the emission"),
anno::in_group("Emissive"),
anno::enable_if("enable_emission == true")
]],
// Cutout Opacity //
uniform bool enable_opacity = false [[
anno::display_name("Enable Opacity"),
anno::description("Enables the use of cutout opacity"),
anno::in_group("Opacity")
]],
uniform texture_2d opacity_texture = texture_2d() [[
anno::display_name("Opacity Map"),
anno::in_group("Opacity"),
anno::usage("opacity")
]],
float opacity_constant = float(1.0) [[
anno::display_name("Opacity Amount"),
anno::description("Opacity value between 0 and 1, when Opacity Map is not valid"),
anno::in_group("Opacity"),
anno::hard_range(float(0.0), float(1.0))
]],
uniform bool enable_opacity_texture = false [[
anno::display_name("Enable Opacity Texture"),
anno::description("Enables or disables the usage of the opacity texture map"),
anno::in_group("Opacity")
]],
uniform base::mono_mode opacity_mode = base::mono_average [[
anno::display_name("Opacity Mono Source"),
anno::description("Determines how to lookup opacity from the supplied texture. mono_alpha, mono_average, mono_luminance, mono_maximum"),
anno::in_group("Opacity")
]],
uniform float opacity_threshold = float(0.0) [[
anno::display_name("Opacity Threshold"),
anno::description("If 0, use fractional opacity values 'as is'; if > 0, remap opacity values to 1 when >= threshold and to 0 otherwise"),
anno::in_group("Opacity"),
anno::hard_range(float(0.0), float(1.0))
]],
// Clearcoat //
uniform bool enable_clearcoat = false [[
anno::display_name("Enable Clearcoat Layer"),
anno::description("Adds a clearcoat layer on top of the material when enabled"),
anno::in_group("Clearcoat")
]],
float clearcoat_weight = float(1.0) [[
anno::display_name("Clearcoat Weight"),
anno::description("Sets the weight for clearcoat layer"),
anno::in_group("Clearcoat"),
anno::hard_range(float(0.0), float(1.0))
]],
color clearcoat_tint = color(1.0) [[
anno::display_name("Clearcoat Tint"),
anno::description("Clearcoat is tinted and affects the underlying material"),
anno::in_group("Clearcoat")
]],
float clearcoat_transparency = float(1.0) [[
anno::display_name("Clearcoat Transparency"),
anno::description("Adjusts the transparency of the clearcoat. Can be turned into a fully opaque clearcoat covering the underlying layer"),
anno::in_group("Clearcoat"),
anno::hard_range(float(0.0), float(1.0))
]],
float clearcoat_reflection_roughness = float(0.0) [[
anno::display_name("Clearcoat Roughness"),
anno::description("Higher roughness values lead to more blurry reflections"),
anno::in_group("Clearcoat"),
anno::hard_range(float(0.0), float(1.0))
]],
float clearcoat_ior = float(1.56) [[
anno::display_name("Clearcoat IOR"),
anno::description("Sets the Index of refraction for the clearcoat layer"),
anno::in_group("Clearcoat"),
anno::soft_range(float(0.0), float(4.0))
]],
uniform float clearcoat_bump_factor = float(1.0) [[
anno::display_name("Clearcoat Normal Map Strength"),
anno::description("Strength of normal map."),
anno::in_group("Clearcoat"),
anno::soft_range(float(0.0), float(1.0))
]],
uniform texture_2d clearcoat_normalmap_texture = texture_2d() [[
anno::display_name("Clearcoat Normal Map"),
anno::description("Enables the usage of the normalmap texture"),
anno::in_group("Clearcoat"),
anno::usage("normal")
]],
uniform float2 clearcoat_texture_translate = float2(0.0) [[
anno::display_name("Clearcoat Texture Translate"),
anno::description("Controls the position of the clearcoat texture"),
anno::ui_order(1),
anno::in_group("UV")
]],
uniform float clearcoat_texture_rotate = float(0.0) [[
anno::display_name("Clearcoat Texture Rotate"),
anno::description("Rotates angle of the clearcoat texture in degrees"),
anno::ui_order(2),
anno::in_group("UV")
]],
uniform float2 clearcoat_texture_scale = float2(1.0) [[
anno::display_name("Clearcoat Texture Tiling"),
anno::description("Controls the repetition of the clearcoat texture"),
anno::ui_order(3),
anno::in_group("UV")
]],
float clearcoat_flatten = float(1.0) [[
anno::display_name("Clearcoat Flatten"),
anno::description("Flattens the clearcoat to even out the underlying bump maps"),
anno::in_group("Clearcoat"),
anno::hard_range(float(0.0), float(1.0))
]],
// Normal //
uniform float geometry_normal_roughness_strength = 1.f
[[
anno::hard_range(0.0, 1.0),
anno::display_name("Normal map to roughness weight"),
anno::description("Enables and weights roughness induced by normal maps"),
anno::in_group("Normal")
]],
uniform float bump_factor = float(1.0) [[
anno::display_name("Normal Strength"),
anno::description("Strength of normal map"),
anno::in_group("Normal"),
anno::soft_range(float(0.0), float(1.0))
]],
uniform texture_2d normalmap_texture = texture_2d() [[
anno::display_name("Normal Map"),
anno::in_group("Normal"),
anno::usage("normal")
]],
uniform float detail_bump_factor = float(0.3) [[
anno::display_name("Detail Normal Strength"),
anno::in_group("Normal"),
anno::description("Strength of the detail normal"),
anno::soft_range(float(0.0), float(1.0))
]],
uniform texture_2d detail_normalmap_texture = texture_2d() [[
anno::display_name("Detail Normal Map"),
anno::in_group("Normal"),
anno::usage("normal")
]],
uniform bool flip_tangent_u = false [[
anno::display_name("Normal Map Flip U Tangent"),
anno::in_group("Normal")
]],
uniform bool flip_tangent_v = true [[
anno::display_name("Normal Map Flip V Tangent"),
anno::in_group("Normal")
]],
// UVW Projection Group //
uniform bool project_uvw = false [[
anno::display_name("Enable Project UVW Coordinates"),
anno::description("When enabled, UV coordinates will be generated by projecting them from a coordinate system"),
anno::in_group("UV")
]],
uniform bool world_or_object = false [[
anno::display_name("Enable World Space"),
anno::description("When enabled, uses world space for projection, otherwise object space is used"),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform int uv_space_index = 0 [[
anno::display_name("UV Space Index"),
anno::description("UV Space Index"),
anno::in_group("UV"),
anno::enable_if("project_uvw == true"),
anno::hard_range(int(0), int(3))
]],
// UVW Adjustments Group //
uniform float2 texture_translate = float2(0.0) [[
anno::display_name("Texture Translate"),
anno::description("Controls position of texture."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform float texture_rotate = float(0.0) [[
anno::display_name("Texture Rotate"),
anno::description("Rotates angle of texture in degrees."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform float2 texture_scale = float2(1.0) [[
anno::display_name("Texture Tiling"),
anno::description("Controls repetition of the texture."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform float2 detail_texture_translate = float2(0.0) [[
anno::display_name("Detail Texture Translate"),
anno::description("Controls the position of the detail texture."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform float detail_texture_rotate = float(0.0) [[
anno::display_name("Detail Texture Rotate"),
anno::description("Rotates angle of the detail texture in degrees."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
uniform float2 detail_texture_scale = float2(1.0) [[
anno::display_name("Detail Texture Tiling"),
anno::description("Controls repetition of the detail texture."),
anno::in_group("UV"),
anno::enable_if("project_uvw == true")
]],
// Geometry //
uniform float round_edges_radius = float(0.0) [[
anno::display_name("Round Edge Radius"),
anno::description("Influence radius around the edges in meters"),
anno::in_group("Geometry"),
anno::soft_range(0.0, 1.0)
]],
uniform float round_edges_roundness = float(1.0) [[
anno::display_name("Round Edge Roundness"),
anno::description("Determines how round the edge will look"),
anno::in_group("Geometry"),
anno::hard_range(0.0, 1.0)
]],
uniform bool round_edges_across_materials = false [[
anno::display_name("Round Edge Across Materials"),
anno::description("Normal smoothing happens only between facets of equal material, \n"
"\t\tunless this parameter is set true, in which case the smoothing \n"
"\t\thappens between facets irrespective of their materials"),
anno::in_group("Geometry")
]]
)
[[
anno::display_name("OmniPBR ClearCoat "),
anno::description("OmniPBR Base with support for clear coat, opacity and ORM textures."),
anno::in_group("Base"),
anno::version( 2, 1, 1),
anno::author("NVIDIA CORPORATION"),
anno::key_words(string[]("omni", "PBR", "opacity", "clearcoat", "omniverse", "generic"))
]] = let {
// UVW lookup and transformation //
base::texture_coordinate_system the_system = world_or_object ? base::texture_coordinate_world : base::texture_coordinate_object;
base::texture_coordinate_info uvw = project_uvw ? base::coordinate_projection(
coordinate_system: the_system,
texture_space: uv_space_index,
projection_type: base::projection_cubic
) :
base::coordinate_source(
coordinate_system: base::texture_coordinate_uvw,
texture_space: uv_space_index
);
base::texture_coordinate_info transformed_uvw = base::transform_coordinate(
transform: rotation_translation_scale(
scaling: float3(texture_scale.x, texture_scale.y, 1.0),
rotation: float3(0.0, 0.0, texture_rotate/180.*math::PI ),
translation: float3(texture_translate.x, texture_translate.y, 0.0)
),
coordinate: uvw
);
base::texture_coordinate_info detail_transformed_uvw = base::transform_coordinate(
transform: rotation_translation_scale(
scaling: float3(detail_texture_scale.x, detail_texture_scale.y, 1.0),
rotation: float3(0.0, 0.0, detail_texture_rotate/180.*math::PI ),
translation: float3(detail_texture_translate.x, detail_texture_translate.y, 0.0)
),
coordinate: uvw
);
base::texture_coordinate_info clearcoat_transformed_uvw = base::transform_coordinate(
transform: rotation_translation_scale(
scaling: float3(clearcoat_texture_scale.x, clearcoat_texture_scale.y, 1.0),
rotation: float3(0.0, 0.0, clearcoat_texture_rotate/180.*math::PI ),
translation: float3(clearcoat_texture_translate.x, clearcoat_texture_translate.y, 0.f)
),
coordinate: uvw
);
// Normal calculations //
OmniPBRBase::NormalData defaultData = OmniPBRBase::NormalData(state::normal(), float2(0));
OmniPBRBase::NormalData normal_data = tex::texture_isvalid(normalmap_texture) ?
OmniPBRBase::tangent_space_normal_roughness_texture(
texture: normalmap_texture,
factor: bump_factor,
uvw: transformed_uvw,
flip_tangent_u: flip_tangent_u,
flip_tangent_v: flip_tangent_v // true for dx, false for opengl
//flip_tangent_v: true
) : defaultData;
float3 the_normal = normal_data.normal;
OmniPBRBase::NormalData detail_normal_data = tex::texture_isvalid(detail_normalmap_texture) ?
OmniPBRBase::tangent_space_normal_roughness_texture(
texture: detail_normalmap_texture,
factor: detail_bump_factor,
uvw: detail_transformed_uvw,
flip_tangent_u: flip_tangent_u,
flip_tangent_v: flip_tangent_v // true for dx, false for opengl
) : defaultData;
float3 detail_normal = detail_normal_data.normal;
OmniPBRBase::NormalData clearcoat_normal_data = tex::texture_isvalid(clearcoat_normalmap_texture) ?
OmniPBRBase::tangent_space_normal_roughness_texture(
texture: clearcoat_normalmap_texture,
factor: clearcoat_bump_factor,
uvw: clearcoat_transformed_uvw,
flip_tangent_u: flip_tangent_u,
flip_tangent_v: flip_tangent_v // true for dx, false for opengl
) : defaultData;
float3 clearcoat_normal = clearcoat_normal_data.normal;
float3 diffuse_gloss_normal = tex::texture_isvalid(detail_normalmap_texture) ? add_detail_normal(detail_normal, the_normal) : the_normal;
float3 flattened_clearcoat_normal = ::math::lerp(diffuse_gloss_normal, ::state::normal(), clearcoat_flatten);
float3 final_clearcoat_normal = tex::texture_isvalid(clearcoat_normalmap_texture) ? add_detail_normal(flattened_clearcoat_normal, clearcoat_normal)
: flattened_clearcoat_normal;
// ORM Handling //
float3 ORM_lookup = tex::lookup_float3(
tex: ORM_texture,
coord: float2(transformed_uvw.position.x, transformed_uvw.position.y)
);
float3 roughness_lookup = tex::lookup_float3(
tex: reflectionroughness_texture,
coord: float2(transformed_uvw.position.x, transformed_uvw.position.y)
);
float roughness_selection = enable_ORM_texture ? ORM_lookup.y : roughness_lookup.x;
float reflection_roughness_s = math::lerp(reflection_roughness_constant, roughness_selection, reflection_roughness_texture_influence);
float2 reflection_roughness = float2(math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.x * normal_data.roughness.x)),
math::sqrt(reflection_roughness_s*reflection_roughness_s + (geometry_normal_roughness_strength * normal_data.roughness.y * normal_data.roughness.y)));
float2 clearcoat_reflection_roughness2 = float2(math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.x * clearcoat_normal_data.roughness.x)),
math::sqrt(clearcoat_reflection_roughness*clearcoat_reflection_roughness + (geometry_normal_roughness_strength * clearcoat_normal_data.roughness.y * clearcoat_normal_data.roughness.y)));
// Diffuse Color Lookup and AO //
base::texture_return base_lookup = base::file_texture(
texture: diffuse_texture,
color_offset: color(albedo_add),
color_scale: color(albedo_brightness),
mono_source: base::mono_luminance,
uvw: transformed_uvw,
clip: false
);
base::texture_return ao_lookup = base::file_texture(
texture: ao_texture,
color_offset: color(0.0, 0.0, 0.0),
color_scale: color(1.0, 1.0, 1.0),
mono_source: base::mono_average,
uvw: transformed_uvw,
clip: false
);
color ao_color = enable_ORM_texture ? color(ORM_lookup.x) : ao_lookup.tint;
color desaturated_base = math::lerp(base_lookup.tint, color(base_lookup.mono), albedo_desaturation);
color diffuse = tex::texture_isvalid(diffuse_texture)? desaturated_base : diffuse_color_constant;
color tinted_diffuse = multiply_colors(diffuse, diffuse_tint, 1.0).tint;
color base_color = multiply_colors(
color_1: tinted_diffuse,
color_2: ao_color,
weight: ao_to_diffuse
).tint;
// Metalness //
float3 metallic_lookup = tex::lookup_float3(
tex: metallic_texture,
coord: float2(transformed_uvw.position.x, transformed_uvw.position.y)
);
float metallic_selection = enable_ORM_texture ? ORM_lookup.z : metallic_lookup.x;
float metallic = math::lerp(metallic_constant, metallic_selection, metallic_texture_influence);
// Emission //
color emission_color_texture = tex::texture_isvalid(emissive_color_texture) ?
base::file_texture(
texture: emissive_color_texture,
color_offset: color(0.0, 0.0, 0.0),
color_scale: color(1.0, 1.0, 1.0),
mono_source: base::mono_average,
uvw: transformed_uvw,
clip: false
).tint : emissive_color;
color emission_mask_texture = tex::texture_isvalid(emissive_mask_texture) ?
base::file_texture(
texture: emissive_mask_texture,
color_offset: color(0.0, 0.0, 0.0),
color_scale: color(1.0, 1.0, 1.0),
mono_source: base::mono_average,
uvw: transformed_uvw,
clip: false
).tint : color(1.0);
color final_emission_color = enable_emission ? emission_color_texture * emission_mask_texture: color(0.0);
// Opacity //
float opacity_value = enable_opacity_texture ? base::file_texture(
texture: opacity_texture,
mono_source: opacity_mode,
uvw: transformed_uvw
).mono : opacity_constant;
float cutout_opacity = enable_opacity ? ((opacity_threshold == 0.0) ? opacity_value : ((opacity_value >= opacity_threshold) ? 1.0 : 0)) : 1.0;
material base = OmniPBRBase::OmniPBRBase(
diffuse_reflection_color: base_color,
specular_reflection_aniso_roughness: reflection_roughness,
specular_level: specular_level,
metalness: metallic,
enable_emission: enable_emission,
emission_color: final_emission_color,
emission_intensity: emissive_intensity,
enable_coat: enable_clearcoat,
coat_weight: clearcoat_weight,
coat_color: clearcoat_tint,
coat_transparency: clearcoat_transparency,
coat_aniso_roughness: clearcoat_reflection_roughness2,
coat_ior: clearcoat_ior,
enable_opacity: enable_opacity,
geometry_opacity: cutout_opacity,
clearcoat_geometry_normal: final_clearcoat_normal,
round_edges_radius: round_edges_radius,
round_edges_roundness: round_edges_roundness,
round_edges_across_materials: round_edges_across_materials,
geometry_normal: diffuse_gloss_normal
);
} in material(
surface: base.surface,
geometry: base.geometry
);XDU2300_Top/com.nvidia.simready.packaging.json+1-1
XDU2300_Top/simready_usd/.thumbs/256x256/XDU2300_Top_main.usd.png
Large File Pointer Details
- SHA256: aa7df310484a04ef9661cddc9ea4923e8017f6f208ab666def942573d522fcae
- Pointer size: 128 Bytes
- Size of remote file: 568 Bytes
Large File Pointer Details
- SHA256: f7834a6cd0084239ee49b85aeeef53b72aaec99fa37bf9deda705de28a9f1fe2
- Pointer size: 129 Bytes
- Size of remote file: 2.59 kB
XDU2300_Top/simready_usd/XDU2300_Top_main.jsonDeleted-8
XDU2300_Top/simready_usd/XDU2300_Top_main.usd
XDU2300_Top/simready_usd/layers/.thumbs/256x256/XDU2300_Top_ConnectionPoints.usd.png
Large File Pointer Details
- SHA256: aa7df310484a04ef9661cddc9ea4923e8017f6f208ab666def942573d522fcae
- Pointer size: 128 Bytes
- Size of remote file: 568 Bytes
Large File Pointer Details
- SHA256: f7834a6cd0084239ee49b85aeeef53b72aaec99fa37bf9deda705de28a9f1fe2
- Pointer size: 129 Bytes
- Size of remote file: 2.59 kB
XDU2300_Top/simready_usd/layers/.thumbs/256x256/XDU2300_Top_Properties.usda.png
Large File Pointer Details
- SHA256: aa7df310484a04ef9661cddc9ea4923e8017f6f208ab666def942573d522fcae
- Pointer size: 128 Bytes
- Size of remote file: 568 Bytes
Large File Pointer Details
- SHA256: f7834a6cd0084239ee49b85aeeef53b72aaec99fa37bf9deda705de28a9f1fe2
- Pointer size: 129 Bytes
- Size of remote file: 2.59 kB
XDU2300_Top/simready_usd/layers/XDU2300_Top_ConnectionPoints.usd
XDU2300_Top/simready_usd/layers/XDU2300_Top_Properties.json+16-16
XDU2300_Top/simready_usd/layers/XDU2300_Top_Properties.usda+1172-1179
XDU2300_Top/simready_usd/materials/Carpaint_Solid.mdlDeleted-1112
XDU2300_Top/simready_usd/materials/Copper.mdlDeleted-54
XDU2300_Top/simready_usd/materials/Felt_Plain.mdlDeleted-1467
XDU2300_Top/simready_usd/materials/Rubber_Textured.mdlDeleted-42
XDU2300_Top/simready_usd/materials/Stainless_Steel_Brushed.mdlDeleted
XDU2300_Top/simready_usd/payloads/.thumbs/256x256/external.usd.png
Large File Pointer Details
- SHA256: aa7df310484a04ef9661cddc9ea4923e8017f6f208ab666def942573d522fcae
- Pointer size: 128 Bytes
- Size of remote file: 568 Bytes
Large File Pointer Details
- SHA256: f7834a6cd0084239ee49b85aeeef53b72aaec99fa37bf9deda705de28a9f1fe2
- Pointer size: 129 Bytes
- Size of remote file: 2.59 kB
XDU2300_Top/simready_usd/payloads/.thumbs/256x256/internal.usd.png
Large File Pointer Details
- SHA256: aa7df310484a04ef9661cddc9ea4923e8017f6f208ab666def942573d522fcae
- Pointer size: 128 Bytes
- Size of remote file: 568 Bytes
Large File Pointer Details
- SHA256: f7834a6cd0084239ee49b85aeeef53b72aaec99fa37bf9deda705de28a9f1fe2
- Pointer size: 129 Bytes
- Size of remote file: 2.59 kB
XDU2300_Top/simready_usd/payloads/external.usd+2-2
XDU2300_Top/simready_usd/payloads/internal.usd+1-1
XDU2300_Top/simready_usd/scripts/01_Occluder.pyAdded+127
XDU2300_Top/simready_usd/scripts/02_Internal_External.pyAdded+1010
XDU2300_Top/simready_usd/scripts/03_Material_Replacement.pyAdded+876
XDU2300_Top/simready_usd/textures/.thumbs/256x256/vertiv_logo.usd.png
Large File Pointer Details
- SHA256: aa7df310484a04ef9661cddc9ea4923e8017f6f208ab666def942573d522fcae
- Pointer size: 128 Bytes
- Size of remote file: 568 Bytes
Large File Pointer Details
- SHA256: f7834a6cd0084239ee49b85aeeef53b72aaec99fa37bf9deda705de28a9f1fe2
- Pointer size: 129 Bytes
- Size of remote file: 2.59 kB
XDU2300_Top/simready_usd/textures/materials/OmniPBR/OmniPBR.mdlAdded+419
XDU2300_Top/simready_usd/textures/materials/OmniPBR/OmniPBRBase.mdlAdded+493
XDU2300_Top/simready_usd/textures/materials/OmniPBR/OmniPBR_ClearCoat.mdlAdded+734
XDU2300_Top/simready_usd/textures/vertiv_logo.usd