Why can not use vex vop together with materialx vop?

   1160   2   0
User Avatar
Member
620 posts
Joined: Nov. 2013
Offline
Hi,
Materialx nodes seemed still to be compiled to vex code and Karma CPU did know Vex Vop.
Why no result when we merge them?
Edited by jerry7 - Nov. 29, 2021 11:04:03
User Avatar
Member
7747 posts
Joined: Sept. 2011
Offline
The mechanism by which they are translated to vex is different. MaterialX is JIT converted from the graph while rendering, whereas vex vops generate code directly when generating the USD. MaterialX vops could theoretically generate vex code too and be mixed with other vex vops, but this would generate a vex shader and someone defeat the purpose of using an open interchange format. It would also be incompatible with XPU.
User Avatar
Staff
1448 posts
Joined: July 2005
Offline
Vex VOPs represent explicit VEX code snippets. When translating to USD, all the snippets need to be combined into one shader function, which is stroed as sourceCode attribute on the USD Shader primitive. That sourceCode can only have valid VEX function and syntax. It can't refer to foreign MaterialX entities.

MaterialX are abstracted shader functions, and in theory some of them could be incorporated as VEX code snippets into a VEX shader. But not all of them (eg, MaterialX has some data types like VDF and EDF that are not handled in VEX).

In the end they are two separate ways of building shaders, and combining them in a coherent way presents some challenges.
  • Quick Links