The ui sections can be set to visible with the below code.
# Set pbr ui sections visible
new_pbr.SetParameter("pbr-show-ui-basic-metalrough", True);
new_pbr.SetParameter("pbr-show-ui-subsurface", True);
new_pbr.SetParameter("pbr-show-ui-specularity", True);
new_pbr.SetParameter("pbr-show-ui-anisotropy", True);
new_pbr.SetParameter("pbr-show-ui-sheen", True);
new_pbr.SetParameter("pbr-show-ui-clearcoat", True);
new_pbr.SetParameter("pbr-show-ui-opacity", True);
new_pbr.SetParameter("pbr-show-ui-emission", True);
new_pbr.SetParameter("pbr-show-ui-bump-displacement", True);
new_pbr.SetParameter("pbr-show-ui-ambient-occlusion", True);
I modified @nathanletwory code here below
import Rhino
import scriptcontext as sc
bmtex = Rhino.Render.RenderContentType.NewContentFromTypeId(Rhino.Render.ContentUuids.BitmapTextureType)
bmtex.Filename = "C:\\Users\\Nathan\\Pictures\\uvtester.png"
simtex = bmtex.SimulatedTexture(Rhino.Render.RenderTexture.TextureGeneration.Allow)
#
#print(Rhino.Render.ContentUuids.PhysicallyBasedMaterialType)
# first create an empty PBR material
pbr_rm = Rhino.Render.RenderContentType.NewContentFromTypeId(Rhino.Render.ContentUuids.PhysicallyBasedMaterialType)
# to get to a Rhino.DocObjects.PhysicallyBasedMaterial we need to simulate the
# render material first.
sim = pbr_rm.SimulatedMaterial(Rhino.Render.RenderTexture.TextureGeneration.Allow)
# from the simulated material we can get the Rhino.DocObjects.PhysicallyBasedMaterial
pbr = sim.PhysicallyBased;
# now we have an instance of a type that has all the API you need to set the PBR
# properties. For simple glass we set color to white, opacity to 0 and opacity
# IOR to 1.52
pbr.Opacity = 0.0
pbr.OpacityIOR = 1.52
pbr.BaseColor = Rhino.Display.Color4f.White
pbr.SetTexture(simtex.Texture(), Rhino.DocObjects.TextureType.PBR_BaseColor)
# convert it back to RenderMaterial
new_pbr = Rhino.Render.RenderMaterial.FromMaterial(pbr.Material, sc.doc)
# Set a good name
new_pbr.Name = "My Own Glass"
# Set pbr ui sections visible
new_pbr.SetParameter("pbr-show-ui-basic-metalrough", True);
new_pbr.SetParameter("pbr-show-ui-subsurface", True);
new_pbr.SetParameter("pbr-show-ui-specularity", True);
new_pbr.SetParameter("pbr-show-ui-anisotropy", True);
new_pbr.SetParameter("pbr-show-ui-sheen", True);
new_pbr.SetParameter("pbr-show-ui-clearcoat", True);
new_pbr.SetParameter("pbr-show-ui-opacity", True);
new_pbr.SetParameter("pbr-show-ui-emission", True);
new_pbr.SetParameter("pbr-show-ui-bump-displacement", True);
new_pbr.SetParameter("pbr-show-ui-ambient-occlusion", True);
# Add it to the document
sc.doc.RenderMaterials.Add(new_pbr)
I am going to fix the YT issue so that users do not need to turn on the ui sections manually.