diff --git a/lib/flowViewport/usdPlugins/shadersDiscoveryPlugin/README b/lib/flowViewport/usdPlugins/shadersDiscoveryPlugin/README index ec0723f5a..f8eceaff3 100644 --- a/lib/flowViewport/usdPlugins/shadersDiscoveryPlugin/README +++ b/lib/flowViewport/usdPlugins/shadersDiscoveryPlugin/README @@ -3,3 +3,34 @@ The shaders defined in shadersDef.usda will be loaded by usd/hydra and available You can add the plugInfo.json file path in the environment variable PXR_PLUGINPATH_NAME or use another .json file to load it so USD/Hydra loads it at startup. + +To use the FVP_CustomBasicLightingShader GLSLFX shader into a usd file, just add this definition to your file : + +def Scope "mtl" +{ + def Material "CustomGLSL" + { + token outputs:surface.connect = + + def Shader "CustomGLSLShader1" + { + uniform token info:id = "FVP_CustomBasicLightingShader" + token outputs:surface + } + } +} + +You can also assign the material binding to a prim directly by adding : + +def Mesh "Mesh1" ( + prepend apiSchemas = ["MaterialBindingAPI"] +) +{ + uniform bool doubleSided = 1 + float3[] extent = [(-1.0000002, -1, -1.0000005), (1, 1, 1.0000001)] + int[] faceVertexCounts = ... + int[] faceVertexIndices = ... + rel material:binding = + point3f[] points = ... + ... +} diff --git a/lib/mayaHydra/flowViewportAPIExamples/customShadersNode/mhCustomShadersNode.cpp b/lib/mayaHydra/flowViewportAPIExamples/customShadersNode/mhCustomShadersNode.cpp index 0ab0410d7..8bc2e5b7b 100644 --- a/lib/mayaHydra/flowViewportAPIExamples/customShadersNode/mhCustomShadersNode.cpp +++ b/lib/mayaHydra/flowViewportAPIExamples/customShadersNode/mhCustomShadersNode.cpp @@ -25,6 +25,37 @@ // // createNode("MhCustomShaders") // +// To use the custom shader into a usd file, please add to your file : +/* +def Scope "mtl" +{ + def Material "CustomGLSL" + { + token outputs:surface.connect = + + def Shader "CustomGLSLShader1" + { + uniform token info:id = "FVP_CustomBasicLightingShader" + token outputs:surface + } + } +} + +You can also assign the material binding to a prim directly by adding : + +def Mesh "Mesh1" ( + prepend apiSchemas = ["MaterialBindingAPI"] +) +{ + uniform bool doubleSided = 1 + float3[] extent = [(-1.0000002, -1, -1.0000005), (1, 1, 1.0000001)] + int[] faceVertexCounts = ... + int[] faceVertexIndices = ... + rel material:binding = + point3f[] points = ... + ... +} +*/ //////////////////////////////////////////////////////////////////////// //maya headers