This page provides information on the GLSL Material.

Overview


The VRayGLSLMtl can be used to load OpenGL Shading Language GLSL shaders and render them directly with V-Ray.

This material is the first stage of the V-Ray implementation of GLSL support. In this version, the shaders are compiled to byte code for a software virtual machine, which is then interpreted. Due to this run-time interpretation, GLSL shaders can be somewhat slower to render than V-Ray shaders written in C++. In future builds of V-Ray, shaders will be directly compiled to machine code for faster rendering.

In addition, you can modify the shader or write your own code directly in the Quick Shader area.

Please refer to the VRayGLSLTex page and GLSL Support page for information.

 

 

 

 

General


The General rollout holds parameters that control common shader characteristics.

Shader file – Specifies the .glsl or .frag 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

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.

Export shader – Allows you to save his shader file as a binary precompiled fragment shader file ( .pfrag ).

 

Parameters


This is automatically generated rollout menu showing the shader's specific options. 

 

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 material 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 .glsl (.frag) file in there. It loads 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, press 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.