©BBB3viz

Table of Contents

This page provides information on the OSL Map.

Overview


The VRayOSLTex texture map can be used to load Open Shading Language OSL shader code files (.osl) or OSL object code files (.oso) and render them directly with V-Ray. The VRayOSLTex plug-in can be used with shaders that have simple color and float output parameters. These parameters are considered respectively as texture RGB and alpha outputs.

If the shader file describes a material (rather than a texture) and writes its result in an output closure color parameter, it is advised to use the VRayOSLMtl material. Otherwise, the texture map will not evaluate the materials and would be rendered black. See the V-Ray OSL page for more detailed description and examples.

For more on OSL in general, see the Github reference.

 

 

 

Parameters


Coordinates and Noise

Coordinates and Noise are the 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.
Open in Quick Shader  Opens the loaded file's code in the text editor of the Quick Shader.
Copy File Path – Puts the full path of the currently loaded file in the clipboard.
Copy Folder Path – Copies the parent directory of the currently loaded file into the clipboard.
Recent Files – Holds a list of the recently loaded shaders and an option to clear the list.

Shortcut KeyCommand
CClear
RReset
EReload
OOpen Containing Folder
XOpen in External Editor
QOpen in Quick Shader 
FCopy File Path
PCopy Folder Path
TRecent Files
1-0The first 10 items of the Recent Files submenu have assigned shortcuts from 1 to 0

If you edit your OSL shader, the new version would be loaded only after a ClearReset, or Reload option has been selected.

Color output – Specifies the color source for the texture's RGB output. If None is selected the texture renders black.

Alpha output – Specifies the float source for the texture's alpha output. If None is selected the texture is considered fully opaque.

Show preview – Determines whether to render a shader preview in the material editor.

Clamp shader result – Determines whether to force the result in the [0, clamping limit] range.

Clamping limit – Specifies the upper clamp limit if Clamp shader result is enabled.

Wrap texture coordinates – Automatically wraps the texture coordinates for the OSL shader passing only values in the [0.0, 1.0] range.

Flip textures – Flips all attached textures vertically for compatibility with 3ds Max OSL Map.

Export shader name to OSO – Saves the shader as *.oso file.

 – Help button which opens a URL provided by the shader.

Parameters

Any additional shader – Specific parameters (if any) from the loaded shader file are listed in this rollout.

Compiler Diagnostics

The Compiler diagnostics rollout holds shader compilation and manipulation result messages.

 


Quick Shader


If you want to manually modify the shader's code, you can do that in the Quick Shader area.

Enable – Makes the Quick Shader's text area active. Once enabled, place the original code inside the text area. Alternatively, start writing in the blank area your own code. If you have already loaded a shader in the texture parameters, right-click on it and select Open in Quick Shader option. 

Another way to do this is to activate the text area and drag and drop the .osl file in there. It will load the code instantly.

Right-clicking on the Quick Shader panel opens a context menu. You can Compile the code after doing changes or Compile and Reset Parameters, which affects the values of the parameters in the shader as well.

Once ready with editing, click the Compile button to refresh the UI. Modifications are updated in the UI and renderer after the successful code compilation. You can monitor the messages in the Compiler diagnostics rollout during compilation. 

The shader file originally loaded in the material (if any) is not affected in the compilation. You need to manually save your code.

 

 

OSL Include Paths


Custom Include Paths  Search paths list that is used when an osl module is not found in the available system paths. You can Add or Remove additional paths directly from the UI by clicking the corresponding button. 

 

 

Notes


  • The VRayOSLTex texture 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.

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

 

Was this helpful?