This repo contains two scripts to allow:
- Cloning the current USD Standard Shader Ball scene only.
- Converting the scene used Blender (bpy) to output a glTF (GLB) file.
- Use
usdball_download.shto clone only the shader ball scene into a new repo folder calledStandardShaderBall. - Use
togltf.pyfrom the root of that repo to create the GLB file called:standard_shader_ball_scene.glb. Use the--smoothoption if additional smoothing is desired for the surface material geometry.
The non shader ball geometry, cameras, and lights are all stripped away. As well no materials are saved.
A Python virtual environment can also be used.
- On non-windows:
bpy_env.shsets up a virtual environment and installsbpy. - On Windoows:
bpy_env_win.batsets up a virtual environment and installsbpy.
The geometry with just the script conversion is shown below:
| MaterialX Web Viewer (drag geometry into viewer) | Blender |
|---|---|
![]() |
![]() |
The geometry in the glTF file can be assigned so that the main material to "preview" can be assigned to the outer shell and ring around the base. The rest can be assigned some "default" material. You can also assign to the "Arnold"shader ball using the same material assignments.
Below is an example look with "base,"core","sss_bars" and "material_surface" the names of geometry in the USD shader ball, and "Calibration_Mesh" and "Preview_Mesh" the names of geometry in the Arnold shader ball:
<look name="look1">
<materialassign name="default" geom="base,core,sss_bars,Calibration_Mesh" material="MY_DEFAULT_MATERIAL" />
<materialassign name="preview" geom="material_surface,Preview_Mesh" material="MY_PREVIEW_MATERIAL" />
</look>with an example default OpenPBR material:
<?xml version="1.0"?>
<materialx version="1.39" colorspace="lin_rec709">
<surfacematerial name="MY_DEFAULT_MATERIAL" type="material">
<input name="surfaceshader" type="surfaceshader" nodename="open_pbr_surface_surfaceshader" />
</surfacematerial>
<open_pbr_surface name="open_pbr_surface_surfaceshader" type="surfaceshader">
<input name="base_weight" type="float" value="1.0" />
<input name="base_color" type="color3" value="0.3, 0.3, 0.3" />
<input name="base_diffuse_roughness" type="float" value="0.2" />
<input name="base_metalness" type="float" value="0.0" />
<input name="specular_weight" type="float" value="0.1" />
<input name="specular_color" type="color3" value="1, 1, 1" />
<input name="specular_roughness" type="float" value="0.5" />
<input name="specular_ior" type="float" value="1.5" />
</open_pbr_surface>
</materialx>The togltf script does not currently extract out the USDPreviewSurface materials from the USD asset to avoid having to build or install a USD release.
The remaining USD asset examples can be extracted and have looks added to it using the addLook.py script.
The script can also perform rendering as specified by a user defined render string argument such that:
%gis replaced by the geometry file name%mis replaced by the Materialx file name%ois replaced by the output image name%pis replaced by the path to the source content to aid in resolving image references.
Below is an example which iterates over all MaterialX documents in the USD asset and creates new documents with the appropriate looks which are then rendered using a release version of MaterialXView.
addlook.py ./StandardShaderBall/full_assets/StandardShaderBall/example_materials -r "MaterialXView --material %m --mesh %g --screenWidth 480 --screenHeight 480 --captureFilename %o --cameraPosition 7.5,17.0,17.0 --cameraZoom 6 --shadowMap true --lightRotation 20 --screenColor 0.6,0.6,0.6" --g ./standard_shader_ball_scene_smooth.glb -o example_materialsResults of executing this script are shown below:
| Material | Standard Surface | OpenPBR |
|---|---|---|
| Surface Plastic | ![]() |
![]() |
| Surface Bubblegum | ![]() |
![]() |
| Glass | ![]() |
![]() |
| Gold | ![]() |
![]() |
The glTF, OpenPBR and Autodesk Standard Surface release sample materials have been rendered using this script. The resulting
MaterialX documents and rendered images can be found in the *_1.39.5 subfolders in the repository:
The script is generic enough to add looks and render arbitrary MaterialX documents containing materials.
Below is an example using a material from PolyHaven using the same MaterialX document but applied to different shader ball geometry.
| USD Shader Ball | Arnold Shader Ball |
|---|---|
![]() |
![]() |











