Molekel 5.2 and above supports programmable shaders for rendering a molecule structure or molecular surfaces. OpenGL GLSL shaders can be assigned on a per-molecule, per-surface basis.
A video showing how to apply shaders is available here: http://molekel.cscs.ch/video/eldens_shader_apply_big.htm
To apply a shader to a molecule or one of the generated surfaces select the Display->Shaders menu which is enabled only when a molecule is selected and the system supports OpenGL 2.0 GLSL shaders (this is automatically detected by Molekel).
After the shader dialog opens:
- select the surface to which the shader should be applied by clicking on one of the tabs
- select the vertex shader file (acts on geometry)
- select the fragment shader file (acts on pixels)
- if available select a parameter file containing the shader parameters' values
- click on Apply
When the shader is applied to the surface Molekel checks the configurable shader parameters and builds a GUI which allows the user to interactively modify the parameter values; in case the parameter name contains the string color or colour (case insensitive) and the type is vec3 the value can be edited through a color dialog by clicking on the button under the parameter's name.
If a parameter file is selected the values read from the file are automatically applied to the shader and displayed in the GUI.
Shader parameter values can be saved to a text file and read back when needed.
IMPORTANT: If the vertex and fragment shader field are left blank and a parameter file is read first the vertex and fragment shader fields are automatically filled with filenames having the same filepath as the parameter file with the extension changed to .vert (vertex shaders) and .frag (fragment shaders).
A few shaders are provided in the
/shaders directory; try to apply e.g. the phong shader to a molecule and the x-ray shader to a surface by loading the corresponding .params file and clicking on Apply.