The MaterialX Viewer leverages shader generation to build GLSL shaders from MaterialX graphs, rendering the results using the NanoGUI framework. Both the standard set of MaterialX nodes and the PBR node set are supported.
Figure 1: Standard Surface Shader with procedural and uniform materials
Figure 2: Standard Surface Shader with textured, color-space-managed materials
Select the MATERIALX_BUILD_VIEWER
option to build the MaterialX Viewer. Installation will copy the MaterialXView executable to a bin/
directory within the selected install folder.
- Load Mesh: Load in geometry for viewing. There is currently support for OBJ file loading.
- Load Material: Load in a MaterialX document containing elements to render.
- Property Editor: View or edit the properties for the current element selected.
- Advanced Settings : Loading and fidelity options.
Upon launching MaterialXView, a teapot model is automatically loaded.
To change this preview geometry, click Load Mesh
and navigate to /resources/Geometry
for a list of available models.
Currently, files using the OBJ file format are supported. If a file contains more than one group
, then a Select Geometry
option is available which lists the available groups. One group is chosen as the current active group. To change the active group, click the Select Geometry
list to choose from a list of available groups.
Under Advanced Settings
it is possible to have a wireframe overlay displayed for the active group by choosing Outline Selected Geometry
.
To experiment with different materials, click Load Material
. Navigate to
resources/Materials/TestSuite/pbrlib/material
for a selection of .mtlx
files.
To adjust the attributes on the materials, click Property Editor
to show or hide the material properties. Note that this changes the generated shader inputs and not the original MaterialX document.
Multiple materials can be loaded using the following options:
- Have more than one renderable item specified in the input MaterialX document (.mtlx).
- Loading in additional renderable item in an input MaterialX document (.mtlx) by
- Clicking on
Advanced Setting
s and enableAdd Materials
. - Clicking on
Load Material
to select additional.mtlx
files.
- Clicking on
If more than one material has been loaded they will be listed in a pop-up menu under an Assigned Material
label.
To assign a renderable item to either an existing group or the entire object, click on the pop-up menu to switch among (between) the available materials. Alternatively the LEFT
and RIGHT
arrows can be used to cycle through the list.
Note: Once you have loaded a material, it remains in the list even after you disable Add Materials
.
To clear the entries, disable Add Materials
and load in a new .mtlx
file. The list will be refreshed to include only the renderable items from that document.
The binding between materials and geometry can be performed by loading in a MaterialX document which contains a look if the 'Assign Looks' option is enabled. If the referenced material and assigned geometry exist then the material will be assigned.
MaterialXView currently provides built-in direct and indirect lighting (IBL). You can enable one or both by selecting Advanced Settings > Lighting Options
.
To improve the indirect lighting highlights on your material, increase the Advanced Settings > Environment Samples
. This may cause your system to slow down, so you may want to balance speed with quality.
- The GLSL source code for the currently selected material can be saved to disk by pressing the
S
key while focus is in the viewer. - This source code can be reloaded back in by pressing the
L
key while focus is in the viewer. This is useful to make quick adjustments on the source code for debugging purposes. The original MaterialX document is not affected. - The current frame can be saved to disk by pressing the
F
key while focus is in the viewer. - Node graphs can be saved to disk as DOT files by pressing the
D
key while focus is in the viewer. See www.graphviz.org for more details on this format.
Command line arguments can be specified by using the --
prefix on startup:
--library
: Additional library folder location(s).--path
: Additional file search path location(s).--mesh
: Mesh file name.--material
: Material file name.--envMethod
: Environment lighting method. 1 means to use prefiltered environment maps. The default is to use filtered importance sampling.--msaa
: Multi sampling count for anti-aliasing.