Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces the lobe pruning concept to MaterialX shaders generated by either MayaUSD or LookdevX. We look into shader graph implemnetation and find where we can cut the graph to simplify it based on the value of the main lobe attributes. This means a shader with a subsurface weight of zero will completely prune the evaluation of the subsurface, while a value of 1 will completely prune the evaluation of the dielectric base. This provides interesting performance values: ``` MayaUSD: Tumbling speed of a stage with a 11x11x11 set of cubes with a red OpenPBR shader initial optimized Default light 434fps 441fps Dome light 17fps 115fps LookdevX/MaterialX: Tumbling speed of a heavy geometry scene from MAYA-136105 using OpenPBR surface initial optimized Default light 192fps 476fps Dome light 7.6fps 65fps ``` Technical side: The code looks for nodes in the nodegraph implementation and checks any node that directly connects to the interface on a 0-1 slider: - Mix nodes: If the mix value if 0 or 1, forward the value/connection of the bg or fg port to the node directly upstream. Delete node. - Multiply nodes: If any value is zero, write zero to the corresponding port on the upstream node. Delete node. - PBR nodes: If the weight parameter is zero, substitute with a no-op PBR node. Delete node. This makes sure the ShaderGen works on a reduced codebase and greatly reduces code size and complexity by disconnecting unused subgraphs and skipping black PBR calls.
- Loading branch information