©BBB3viz

Table of Contents

This page provides information on the GLSL Map.

 

Overview


The VRayGLSLTex texture map can be used to load OpenGL Shading Language GLSL shaders (.frag, .glsl files), as well as V-Ray precompiled fragment shaders (.pfrag files), and render them directly with V-Ray. If the shader file describes a material (rather than a texture), the shader definition can be rendered by either assigning the texture map to the color slot of a VRayLightMtl material, or just by using the VRayGLSLMtl material.

Note that both VRayGLSLMtl and VRayGLSLTex share the same user interface. See the V-Ray GLSL page for more detailed description of the language and examples.

This texture map and 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 the example shown here an example GLSL file has been used.

 

 

 

General


The General rollout holds parameters that control common shader characteristics.

Shader file – Specifies the .glsl, .frag, or .pfrag file which contains the shader code. This button 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 external text editor.
Open in Quick Shader – Opens the shader in the built-in text editor.
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 material editor.

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

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

Export shader – Saves the shader file as a binary precompiled fragment shader file (.pfrag).

 

 

Compiler Diagnostics


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

 

 

Quick Shader


The Quick Shader rollout allows fast shader sketching inside the plug-in without the use of external files.

Enable – Activates the built-in text editor. 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 the 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. 

Compile – Compiles the written shader, keeping the current shader parameters. To compile the shader and reset its parameters to default, hold the Shift button and then click Compile.

Right-click the Quick Shader panel to open a context menu, containing basic text editing functions. Through the menu options, you can also Compile the code after doing changes or Compile and Reset Parameters, which affects the values of the parameters in the shader as well.

 

 

Parameters


Any additional shader-specific parameters (if any) are listed in this rollout.

 

Notes


  • Currently the VRayGLSLTex texture and VRayGLSLMtl are only available in 3ds Max 2011 and later.
  • For details on the V-Ray GPU support of VRayGLSLTex and VRayGLSLMtl, see the GLSL Support page.

 

References


Randi J. Rost et al, OpenGL Shading Language, second edition, Addison-Wesley, 2006
(No longer works) Lighthouse3D.com  - a useful site that describes the basics of GLSL and has many shader examples
(No longer works) http://www.lighthouse3d.com/tutorials/glsl-tutorial/communication-opengl-shaders/