OSL Material | VRayOSLMtl
This page provides information on the OSL Material.
Section Contents
Page Contents
Overview
The VRayOSLMtl material can be used to load OSL shader code files (.osl) or OSL object code files (.oso) and render them directly with V-Ray.
The VRayOSLMtl plug-in can be used with shaders that use closure color output parameters. See the OSL Support page for more detailed descriptions and examples for writing an OSL shader in V-Ray.
UI Path: ||Material Editor window|| > Material/Map Browser > Materials > V-Ray > VRayOSLMtl
Coordinates and Noise
The Coordinates and Noise rollouts are standard 3ds Max texture rollouts.
General
The General rollout holds parameters that control common shader characteristics.
shader file – Specifies the .osl or .oso file which contains the shader (object) code. This button control also supports a context menu with the following options:
Clear – Unloads the current shader and restores the plug-in as if no shaders have been loaded.
Reset – Reloads the shader and resets its parameters to the default values.
Reload – Reloads the shader but keeps the current parameter values.
Open Containing Folder – Reveals the shader location in Explorer.
Open in External Editor – Opens the shader in an appropriate text editor.
Recent Files – Holds a list of the recently loaded shaders and an option to clear the list.
If you edit your OSL shader, the new version would be loaded only after a Clear, Reset, or a Reload option has been selected.
closure output – Specifies the closure color source for the materials's output. The built-in output closure color parameter Ci is selected by default.
max ray depth – Specifies the maximum reflection/refraction depth for the shader.
show preview – Determines whether to render a shader preview in the 3ds Max Material Editor.
clamp shader result – Determines whether to force the result into the [0, clamping limit] range.
clamping limit – Specifies the upper clamp limit if clamp shader result is enabled.
viewport color – Specifies the diffuse component of the material used in viewport shading.
wrap texture coordinates – Automatically wraps the texture coordinates for the OSL shader, passing only values in the [0.0, 1.0] range.
Save oso shader – Saves an .osl shader as an object code shader (.oso). This button is enabled only if an .osl shader is loaded.
Compiler Output
The Compiler Output rollout holds shader compilation and manipulation result messages.
Shader Parameters
Any additional shader-specific parameters (if any) are listed in this rollout.
Notes
-
The VRayOSLTex texture and VRayOSLMtl are only available in 3ds Max 2011 and later.
-
The VRayOSLMtl material automatically compiles OSL shaders to object code (OSO format) upon shader selection. No following compilations occur (even at render events). If the loaded OSL shader is modified, use the context menu options Reset or Reload of the Shader file button for your changes to take effect.
-
An OSL compiler that translates *.osl files to *.oso files can be found in the tools subdirectory of V-Ray's root installation folder.
-
If the oslutil.h or stdosl.h include files need to be placed without modifying the V-Ray environment variable VRAY_OSL_PATH_3DSMAX####_x64, create a folder named vrayosl in the folder C:\Program Files\Autodesk\3ds Max #### and copy the include files into it. The default location for the include files is C:\Program Files\Chaos Group\V-Ray\3dsmax #### for x64\opensl.
References
-
OSL home page at SPI - Open Shading Language home page at Sony Pictures Imageworks
-
OSL Google Code page - Google Code project page for Open Shading Language
-
OSL GitHub page - GitHub project page for Open Shading Language