MaterialX.PyMaterialXRenderOsl Module¶
Rendering support for Open Shading Language.
- class MaterialX.PyMaterialXRenderOsl.OslRenderer¶
Bases:
ShaderRendererHelper class for rendering generated OSL code to produce images.
The main services provided are: Source code validation: Use of “oslc” to compile and test output results Introspection check: None at this time. Binding: None at this time. Render validation: Use of “testrender” to output rendered images. Assumes source compilation was success as it depends on the existence of corresponding .oso files.
- static create(arg0: SupportsInt, arg1: SupportsInt, arg2: MaterialX.PyMaterialXRender.BaseType) MaterialX.PyMaterialXRenderOsl.OslRenderer¶
Create an OSL renderer instance.
- captureImage(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: MaterialX.PyMaterialXRender.Image) MaterialX.PyMaterialXRender.Image¶
Capture the current rendered output as an image.
- compileOSL(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: MaterialX.PyMaterialXFormat.FilePath) None¶
Compile OSL code stored in a file.
- Parameters:
oslFilePath – OSL file path.
- createProgram(*args, **kwargs)¶
Overloaded function.
createProgram(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: MaterialX.PyMaterialXGenShader.Shader) -> None
createProgram(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: collections.abc.Mapping[str, str]) -> None
- getCamera(self: MaterialX.PyMaterialXRender.ShaderRenderer) MaterialX.PyMaterialXRender.Camera¶
Return the camera.
- getGeometryHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer) MaterialX.PyMaterialXRender.GeometryHandler¶
Return the geometry handler.
- getImageHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer) MaterialX.PyMaterialXRender.ImageHandler¶
Return the image handler.
- getLightHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer) MaterialX.PyMaterialXRender.LightHandler¶
Return the light handler.
- initialize(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, renderContextHandle: typing_extensions.CapsuleType = None) None¶
Internal initialization required for program validation and rendering.
An exception is thrown on failure. The exception will contain a list of initialization errors.
- render(self: MaterialX.PyMaterialXRenderOsl.OslRenderer) None¶
Render OSL program to disk.
This is done by using either “testshade” or “testrender”. Currently only “testshade” is supported.
Usage of both executables requires compiled source (.oso) files as input. A shader output must be set before running this test via the setOslOutputName() method to ensure that the appropriate .oso files can be located.
- setCamera(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: MaterialX.PyMaterialXRender.Camera) None¶
Set the camera.
- setGeometryHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: MaterialX.PyMaterialXRender.GeometryHandler) None¶
Set the geometry handler.
- setImageHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: MaterialX.PyMaterialXRender.ImageHandler) None¶
Set the image handler used by this renderer for image I/O.
- setLightHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: MaterialX.PyMaterialXRender.LightHandler) None¶
Set the light handler used by this renderer for light bindings.
- setOslCompilerExecutable(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: MaterialX.PyMaterialXFormat.FilePath) None¶
Set the path to the OSL executable.
- Parameters:
executableFilePath – Path to OSL compiler executable
- setOslIncludePath(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: MaterialX.PyMaterialXFormat.FileSearchPath) None¶
Set the search locations for OSL include files.
- Parameters:
dirPath – Include path(s) for the OSL compiler. This should include the path to stdosl.h.
- setOslOutputFilePath(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: MaterialX.PyMaterialXFormat.FilePath) None¶
Set the location where compiled OSL files will reside.
- Parameters:
dirPath – Path to output location
- setOslShaderName(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: str) None¶
Set the name of the shader to be used for the input XML scene file.
- Parameters:
shaderName – Name of shader
- setOslShaderOutput(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: str, arg1: str) None¶
Set the OSL shader output.
- Parameters:
outputName – Name of shader output
outputType – The MaterialX type of the output
- setOslTestRenderExecutable(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: MaterialX.PyMaterialXFormat.FilePath) None¶
Set the path to the OSL rendering tester.
- Parameters:
executableFilePath – Path to OSL “testrender” executable
- setOslTestRenderSceneTemplateFile(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: MaterialX.PyMaterialXFormat.FilePath) None¶
Set the XML scene file to use for testrender.
This is a template file with the following tokens for replacement: shader% : which will be replaced with the name of the shader to use shader_output% : which will be replace with the name of the shader output to use templateFilePath Scene file name
- Parameters:
templateFilePath – Scene file name
- setOslTestShadeExecutable(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: MaterialX.PyMaterialXFormat.FilePath) None¶
Set the path to the OSL shading tester.
- Parameters:
executableFilePath – Path to OSL “testshade” executable
- setOslUtilityOSOPath(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: MaterialX.PyMaterialXFormat.FilePath) None¶
Set the search path for dependent shaders (.oso files) which are used when rendering with testrender.
- Parameters:
dirPath – Path to location containing .oso files.
- setShaderParameterOverrides(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: collections.abc.Sequence[str]) None¶
Set shader parameter strings to be added to the scene XML file.
These strings will set parameter overrides for the shader.
- setSize(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: SupportsInt, arg1: SupportsInt) None¶
Set the size of the rendered image.
- updateUniform(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: str, arg1: MaterialX.PyMaterialXCore.Value) None¶
Update the program with value of the uniform.
- useTestRender(self: MaterialX.PyMaterialXRenderOsl.OslRenderer, arg0: bool) None¶
Used to toggle to either use testrender or testshade during render validation By default testshade is used.
- Parameters:
useTestRender – Indicate whether to use testrender.
- validateInputs(self: MaterialX.PyMaterialXRenderOsl.OslRenderer) None¶
Validate inputs for the compiled OSL program.
Note: Currently no validation has been implemented.
- OSL_CLOSURE_COLOR_STRING = 'closure color'¶