<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Shiven</id>
	<title>PyMOL Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Shiven"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php/Special:Contributions/Shiven"/>
	<updated>2026-08-14T09:33:25Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Talk:GLSL_Shaders&amp;diff=207</id>
		<title>Talk:GLSL Shaders</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Talk:GLSL_Shaders&amp;diff=207"/>
		<updated>2013-03-04T20:21:46Z</updated>

		<summary type="html">&lt;p&gt;Shiven: /* Thanks! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I believe the test script for e.g. sphere is a PyMOL script, not a Python script. So the way to do the tst is to save the script as a file named e.g. &amp;quot;test-sphere.pml&amp;quot; and then in PyMOL command line, type &amp;quot;@test-sphere.pml&amp;quot; to run this automated test. Saving it as a Python script and use FILE-&amp;gt;RUN won't work.&lt;br /&gt;
&lt;br /&gt;
==== Thanks! ====&lt;br /&gt;
&lt;br /&gt;
Thanks for the feedback, I'll update the page to reflect this. FILE-&amp;gt;RUN works with MacPyMOL and PyMOLX11Hybrid; both are commercial versions of PyMOL for Apple OS X.&lt;br /&gt;
&amp;lt;br /&amp;gt;Just tested this on OS X Lion.&lt;br /&gt;
&lt;br /&gt;
== Can't get sphere to work ==&lt;br /&gt;
&lt;br /&gt;
Tried it with PyMOL 1.5.0.3 with Python 2.6.6 or 2.7.3, on a Sony VAIO running Vista Business with nVidia GeForce 8400M GS. Caused a crash at the final draw command complaining something about the graphics driver, and thus a runtime error.&lt;br /&gt;
&lt;br /&gt;
==== Driver Hell? ====&lt;br /&gt;
&lt;br /&gt;
Since you are having this problem on a Microsoft Windows platform, my first guess would be that the nVidia graphics drivers need updating as they may not be supporting the advanced OpenGL features required for this to work. Give it another shot on a different platform perhaps? :-)&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7375</id>
		<title>GLSL Shaders</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7375"/>
		<updated>2013-03-04T20:19:48Z</updated>

		<summary type="html">&lt;p&gt;Shiven: /* Epilogue */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
GLSL Shaders, shipped with PyMOL, may be modified to provide interesting and useful visual effects. The following modifications provide &amp;quot;Toon&amp;quot; shading effects, in some ways similar to the illustrations by David Goodsell as seen in the RCSB/PDB &amp;quot;Molecule of the Month&amp;quot; series [http://www.rcsb.org/pdb/101/motm.do?momID=150].&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
[[File:GLSLToonSperes.png|600px|thumb|center|GLSL Toon Spheres]]&lt;br /&gt;
[[File:GLSLToonCartoon.png|600px|thumb|center|GLSL Toon Cartoon]]&lt;br /&gt;
&lt;br /&gt;
= Instructions =&lt;br /&gt;
&lt;br /&gt;
The fragment shaders have been modified for [[Cartoon]] and [[Spheres]] only as of now.&lt;br /&gt;
The PyMOL shaders directory is located under:&lt;br /&gt;
* &amp;quot;/Applications/MacPyMOL.app/pymol/data/shaders&amp;quot; on Mac OSX&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Spheres ==&lt;br /&gt;
&lt;br /&gt;
=== Sphere Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;sphere.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;sphere.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;sphere.fs&amp;quot; (using a text editor) in the same directory:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
// Sphere impostor fragment shader&lt;br /&gt;
&lt;br /&gt;
// Sphere Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform float ortho;&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform vec3 fog_color_top;&lt;br /&gt;
uniform vec3 fog_color_bottom;&lt;br /&gt;
uniform float inv_height;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
varying vec4 COLOR;&lt;br /&gt;
varying vec3 sphere_center;&lt;br /&gt;
varying float radius2;&lt;br /&gt;
varying vec3 point;&lt;br /&gt;
// varying fog;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(vec3 N, vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  //&lt;br /&gt;
  // Begin code for calculating the Sphere Outline&lt;br /&gt;
  //&lt;br /&gt;
  float spheredge = dot(N,L);&lt;br /&gt;
  float edgeweight = 1.025;&lt;br /&gt;
  float edgegain = 16.0;&lt;br /&gt;
  spheredge = edgeweight - (spheredge * spheredge);&lt;br /&gt;
  spheredge = 1.0 - pow(spheredge, shine * edgegain);&lt;br /&gt;
  diffuse = mix(diffuse, diffuse * spheredge, shine);&lt;br /&gt;
&lt;br /&gt;
  ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
  NdotL = dot(N, L);&lt;br /&gt;
  if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
    ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
    NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
    ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
  }&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main(void)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_origin = mix(vec3(0.,0.,0.), point, ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_direction = mix(normalize(point), vec3(0., 0., 1.), ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 sphere_direction = mix(sphere_center, ray_origin - sphere_center, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate sphere-ray intersection&lt;br /&gt;
    float b = dot(sphere_direction, ray_direction);&lt;br /&gt;
&lt;br /&gt;
    float position = b * b + radius2 - dot(sphere_direction, sphere_direction);&lt;br /&gt;
&lt;br /&gt;
    // Check if the ray missed the sphere&lt;br /&gt;
    if (position &amp;lt; 0.0)&lt;br /&gt;
       discard;&lt;br /&gt;
&lt;br /&gt;
    // Calculate nearest point of intersection&lt;br /&gt;
    float nearest = mix(b - sqrt(position), sqrt(position) - b, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate intersection point on the sphere surface.  The ray&lt;br /&gt;
    // origin is at the quad (center point), so we need to project&lt;br /&gt;
    // back towards the user to get the front face.&lt;br /&gt;
    vec3 ipoint = nearest * ray_direction + ray_origin;&lt;br /&gt;
&lt;br /&gt;
    // Calculate normal at the intersection point&lt;br /&gt;
    vec3 N = normalize(ipoint - sphere_center);&lt;br /&gt;
&lt;br /&gt;
    // Calculate depth in clipping space&lt;br /&gt;
    vec2 clipZW = ipoint.z * gl_ProjectionMatrix[2].zw +&lt;br /&gt;
        gl_ProjectionMatrix[3].zw;&lt;br /&gt;
&lt;br /&gt;
    float depth = 0.5 + 0.5 * clipZW.x / clipZW.y;&lt;br /&gt;
&lt;br /&gt;
    // this is a workaround necessary for Mac&lt;br /&gt;
    // otherwise the modified fragment wont clip properly&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;lt;= 0.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;gt;= 1.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (COLOR.a &amp;lt;= 1.0)&lt;br /&gt;
      gl_FragDepth = depth;&lt;br /&gt;
    else&lt;br /&gt;
      gl_FragDepth = 1.0;&lt;br /&gt;
&lt;br /&gt;
    vec4 color;&lt;br /&gt;
&lt;br /&gt;
    vec3 L0 = normalize(vec3(gl_LightSource[0].position) - ipoint);&lt;br /&gt;
&lt;br /&gt;
    float NdotL = max(dot(N, L0), 0.0);&lt;br /&gt;
&lt;br /&gt;
    float NdotH;&lt;br /&gt;
&lt;br /&gt;
    vec4 final_color = gl_LightModel.ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
    if (light_count&amp;gt;0){&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[0].ambient,&lt;br /&gt;
                                          gl_LightSource[0].diffuse,&lt;br /&gt;
                                          spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
    }}}}}}}}&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    int i;&lt;br /&gt;
    for (i=0; i&amp;lt;light_count; i++){&lt;br /&gt;
      vec3 L = normalize(gl_LightSource[i].position.xyz);&lt;br /&gt;
      vec3 H = normalize(gl_LightSource[i].halfVector.xyz);&lt;br /&gt;
      float spec = 0., shine = 0.;&lt;br /&gt;
      if (i==0){&lt;br /&gt;
        spec = spec_value_0;&lt;br /&gt;
        shine = shininess_0;&lt;br /&gt;
      } else if (spec_count &amp;gt;= i){&lt;br /&gt;
        spec = spec_value;&lt;br /&gt;
        shine = shininess;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      //      final_color += gl_LightSource[i].ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                          gl_LightSource[i].diffuse * COLOR,&lt;br /&gt;
                                          spec, shine);&lt;br /&gt;
&lt;br /&gt;
      NdotL = dot(N, L);&lt;br /&gt;
&lt;br /&gt;
      if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
&lt;br /&gt;
        //    final_color += gl_LightSource[i].diffuse * NdotL * COLOR;&lt;br /&gt;
&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                            gl_LightSource[i].diffuse * COLOR * NdotL * 0.333,&lt;br /&gt;
                                            spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
        NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
        final_color += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    float fog = clamp((gl_Fog.end + ipoint.z) * gl_Fog.scale, 0.0, 1.0);&lt;br /&gt;
    fog = mix(1.0, fog, fog_enabled);&lt;br /&gt;
    vec3 fog_color;&lt;br /&gt;
&lt;br /&gt;
    if (bg_gradient){&lt;br /&gt;
      fog_color = mix(fog_color_bottom, fog_color_top, gl_FragCoord.y * inv_height);&lt;br /&gt;
    } else {&lt;br /&gt;
      fog_color = fog_color_top;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    final_color.rgb = mix(fog_color, final_color.rgb, fog);&lt;br /&gt;
&lt;br /&gt;
    vec4 f = vec4(final_color.rgb, COLOR.a);&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Fake shadows based on depth&lt;br /&gt;
    //&lt;br /&gt;
    // vec4 f = vec4(final_color.rgb * ( 1.05 - gl_FragDepth), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sphere Testing PyMOL Script ===&lt;br /&gt;
Now test out the sphere shader by saving the following PyMOL script as &amp;quot;test1.pml&amp;quot; and running it from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;br /&amp;gt;(If File &amp;gt; Run does not work for you, try typing in &amp;quot;@test1.pml&amp;quot; on the PyMOL command line. First make sure to &amp;quot;cd&amp;quot; on the PyMOL command line to the directory where you saved test1.pml)&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
show sphere, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set sphere_mode, 9&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
set_color carbons, [100, 225,90]&lt;br /&gt;
set_color others, [75, 100, 230]&lt;br /&gt;
util.cbaw 3V4K&lt;br /&gt;
set sphere_scale, 1.05&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.327029049,   -0.944887519,    0.015455140,\&lt;br /&gt;
     0.943798959,   -0.327394068,   -0.045230716,\&lt;br /&gt;
     0.047797613,   -0.000204348,    0.998857021,\&lt;br /&gt;
     0.000143192,   -0.000024423, -184.973327637,\&lt;br /&gt;
   -14.873787880,  -17.664234161,   35.063804626,\&lt;br /&gt;
   136.028396606,  233.926559448,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[-0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[-0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[-0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[ 0.0, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[ 0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[ 0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[ 0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',10)&lt;br /&gt;
cmd.set('spec_count',-1)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[1.0, 1.0, 1.0])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Cartoons ==&lt;br /&gt;
&lt;br /&gt;
=== Cartoon Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;default_es2.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;default_es2.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;default_es2.fs&amp;quot; (using a text editor) in the same directory: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
// Cartoon Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
varying vec3 packed_data_0 ;&lt;br /&gt;
varying vec4 packed_data_1 ;&lt;br /&gt;
varying vec4 packed_data_2 ;&lt;br /&gt;
varying vec4 packed_data_3 ;&lt;br /&gt;
varying vec4 packed_data_4 ;&lt;br /&gt;
&lt;br /&gt;
//varying vec3 N;&lt;br /&gt;
#define NORMAL packed_data_0.xyz&lt;br /&gt;
#define COLOR packed_data_3&lt;br /&gt;
#define fog (packed_data_1.w )&lt;br /&gt;
#define fog_color packed_data_1.x, packed_data_1.y, packed_data_1.z&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
uniform bool two_sided_lighting_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform vec4 interior_color;&lt;br /&gt;
uniform float interior_color_threshold;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform bool use_interior_color_threshold;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(bool is_interior, bool two_sided_lighting_enabled,&lt;br /&gt;
                          vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (!is_interior){&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  if (two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(-NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(-NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
  vec4 final_color = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (lighting_enabled){&lt;br /&gt;
    bool is_interior = false;&lt;br /&gt;
    if (use_interior_color_threshold){&lt;br /&gt;
      vec3 viewV = vec3(0.,0.,-1.);&lt;br /&gt;
      float dotp = dot(NORMAL, viewV);&lt;br /&gt;
      is_interior = ( dotp &amp;gt; interior_color_threshold );&lt;br /&gt;
    }&lt;br /&gt;
    if (!two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
      final_color = interior_color;&lt;br /&gt;
    } else {&lt;br /&gt;
      final_color = (gl_LightModel.ambient) * COLOR;&lt;br /&gt;
&lt;br /&gt;
      if (light_count&amp;gt;0){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[0].ambient,&lt;br /&gt;
                                            gl_LightSource[0].diffuse,&lt;br /&gt;
                                            spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      }}}}}}}}&lt;br /&gt;
    }&lt;br /&gt;
/*&lt;br /&gt;
      for (i=0; i&amp;lt;light_count;i++){&lt;br /&gt;
        vec3 L = normalize(vec3(gl_LightSource[i].position));&lt;br /&gt;
        vec3 H = normalize(vec3(gl_LightSource[i].halfVector.xyz));&lt;br /&gt;
        vec4 ambient = gl_LightSource[i].ambient;&lt;br /&gt;
        vec4 diffuse = gl_LightSource[i].diffuse;&lt;br /&gt;
        float spec = 0., shine = 0.;&lt;br /&gt;
        if (i==0){&lt;br /&gt;
          spec = spec_value_0;&lt;br /&gt;
          shine = shininess_0;&lt;br /&gt;
        } else if (spec_count &amp;gt;= i){&lt;br /&gt;
          spec = spec_value;&lt;br /&gt;
          shine = shininess;&lt;br /&gt;
        }&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled, L, H, ambient, diffuse, spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
*/&lt;br /&gt;
  } else {&lt;br /&gt;
    final_color = COLOR;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  float cfog = mix(1.0, clamp(fog, 0.0, 1.0), fog_enabled);&lt;br /&gt;
&lt;br /&gt;
  vec4 f = vec4(mix(vec3(fog_color), final_color.rgb, cfog), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
=== Cartoon Testing PyMOL Script ===&lt;br /&gt;
Now test out the sphere shader by saving the following PyMOL script as &amp;quot;test2.pml&amp;quot; and running it from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;br /&amp;gt;(If File &amp;gt; Run does not work for you, try typing in &amp;quot;@test2.pml&amp;quot; on the PyMOL command line. First make sure to &amp;quot;cd&amp;quot; on the PyMOL command line to the directory where you saved test2.pml)&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
hide all&lt;br /&gt;
show cartoon, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
color brown, 3V4K&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set cartoon_dumbbell_length, 0.85&lt;br /&gt;
set cartoon_dumbbell_radius, 0.15&lt;br /&gt;
set cartoon_dumbbell_width, 0.15&lt;br /&gt;
set cartoon_fancy_helices, on&lt;br /&gt;
&lt;br /&gt;
set cartoon_rect_length, 0.85&lt;br /&gt;
set cartoon_rect_width, 0.15&lt;br /&gt;
&lt;br /&gt;
set cartoon_loop_radius, 0.15&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.811935484,    0.547164500,   -0.203404382,\&lt;br /&gt;
     0.385375530,    0.240704626,   -0.890811384,\&lt;br /&gt;
    -0.438461006,   -0.801668167,   -0.406299770,\&lt;br /&gt;
     0.000018395,    0.000004439,  -80.686973572,\&lt;br /&gt;
   -14.601868629,   -7.145599365,   10.938076973,\&lt;br /&gt;
    26.767528534,  134.606826782,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',0)&lt;br /&gt;
cmd.set('spec_count',0)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[0.75, 0.75, 0.75])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Epilogue =&lt;br /&gt;
&lt;br /&gt;
The above is just a (very hackish) start. Feel free to modify, test and edit this Wiki page with the changes/improvements you make. Have fun!&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7374</id>
		<title>GLSL Shaders</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7374"/>
		<updated>2013-03-04T20:19:19Z</updated>

		<summary type="html">&lt;p&gt;Shiven: /* Cartoon Testing PyMOL Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
GLSL Shaders, shipped with PyMOL, may be modified to provide interesting and useful visual effects. The following modifications provide &amp;quot;Toon&amp;quot; shading effects, in some ways similar to the illustrations by David Goodsell as seen in the RCSB/PDB &amp;quot;Molecule of the Month&amp;quot; series [http://www.rcsb.org/pdb/101/motm.do?momID=150].&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
[[File:GLSLToonSperes.png|600px|thumb|center|GLSL Toon Spheres]]&lt;br /&gt;
[[File:GLSLToonCartoon.png|600px|thumb|center|GLSL Toon Cartoon]]&lt;br /&gt;
&lt;br /&gt;
= Instructions =&lt;br /&gt;
&lt;br /&gt;
The fragment shaders have been modified for [[Cartoon]] and [[Spheres]] only as of now.&lt;br /&gt;
The PyMOL shaders directory is located under:&lt;br /&gt;
* &amp;quot;/Applications/MacPyMOL.app/pymol/data/shaders&amp;quot; on Mac OSX&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Spheres ==&lt;br /&gt;
&lt;br /&gt;
=== Sphere Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;sphere.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;sphere.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;sphere.fs&amp;quot; (using a text editor) in the same directory:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
// Sphere impostor fragment shader&lt;br /&gt;
&lt;br /&gt;
// Sphere Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform float ortho;&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform vec3 fog_color_top;&lt;br /&gt;
uniform vec3 fog_color_bottom;&lt;br /&gt;
uniform float inv_height;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
varying vec4 COLOR;&lt;br /&gt;
varying vec3 sphere_center;&lt;br /&gt;
varying float radius2;&lt;br /&gt;
varying vec3 point;&lt;br /&gt;
// varying fog;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(vec3 N, vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  //&lt;br /&gt;
  // Begin code for calculating the Sphere Outline&lt;br /&gt;
  //&lt;br /&gt;
  float spheredge = dot(N,L);&lt;br /&gt;
  float edgeweight = 1.025;&lt;br /&gt;
  float edgegain = 16.0;&lt;br /&gt;
  spheredge = edgeweight - (spheredge * spheredge);&lt;br /&gt;
  spheredge = 1.0 - pow(spheredge, shine * edgegain);&lt;br /&gt;
  diffuse = mix(diffuse, diffuse * spheredge, shine);&lt;br /&gt;
&lt;br /&gt;
  ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
  NdotL = dot(N, L);&lt;br /&gt;
  if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
    ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
    NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
    ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
  }&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main(void)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_origin = mix(vec3(0.,0.,0.), point, ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_direction = mix(normalize(point), vec3(0., 0., 1.), ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 sphere_direction = mix(sphere_center, ray_origin - sphere_center, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate sphere-ray intersection&lt;br /&gt;
    float b = dot(sphere_direction, ray_direction);&lt;br /&gt;
&lt;br /&gt;
    float position = b * b + radius2 - dot(sphere_direction, sphere_direction);&lt;br /&gt;
&lt;br /&gt;
    // Check if the ray missed the sphere&lt;br /&gt;
    if (position &amp;lt; 0.0)&lt;br /&gt;
       discard;&lt;br /&gt;
&lt;br /&gt;
    // Calculate nearest point of intersection&lt;br /&gt;
    float nearest = mix(b - sqrt(position), sqrt(position) - b, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate intersection point on the sphere surface.  The ray&lt;br /&gt;
    // origin is at the quad (center point), so we need to project&lt;br /&gt;
    // back towards the user to get the front face.&lt;br /&gt;
    vec3 ipoint = nearest * ray_direction + ray_origin;&lt;br /&gt;
&lt;br /&gt;
    // Calculate normal at the intersection point&lt;br /&gt;
    vec3 N = normalize(ipoint - sphere_center);&lt;br /&gt;
&lt;br /&gt;
    // Calculate depth in clipping space&lt;br /&gt;
    vec2 clipZW = ipoint.z * gl_ProjectionMatrix[2].zw +&lt;br /&gt;
        gl_ProjectionMatrix[3].zw;&lt;br /&gt;
&lt;br /&gt;
    float depth = 0.5 + 0.5 * clipZW.x / clipZW.y;&lt;br /&gt;
&lt;br /&gt;
    // this is a workaround necessary for Mac&lt;br /&gt;
    // otherwise the modified fragment wont clip properly&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;lt;= 0.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;gt;= 1.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (COLOR.a &amp;lt;= 1.0)&lt;br /&gt;
      gl_FragDepth = depth;&lt;br /&gt;
    else&lt;br /&gt;
      gl_FragDepth = 1.0;&lt;br /&gt;
&lt;br /&gt;
    vec4 color;&lt;br /&gt;
&lt;br /&gt;
    vec3 L0 = normalize(vec3(gl_LightSource[0].position) - ipoint);&lt;br /&gt;
&lt;br /&gt;
    float NdotL = max(dot(N, L0), 0.0);&lt;br /&gt;
&lt;br /&gt;
    float NdotH;&lt;br /&gt;
&lt;br /&gt;
    vec4 final_color = gl_LightModel.ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
    if (light_count&amp;gt;0){&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[0].ambient,&lt;br /&gt;
                                          gl_LightSource[0].diffuse,&lt;br /&gt;
                                          spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
    }}}}}}}}&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    int i;&lt;br /&gt;
    for (i=0; i&amp;lt;light_count; i++){&lt;br /&gt;
      vec3 L = normalize(gl_LightSource[i].position.xyz);&lt;br /&gt;
      vec3 H = normalize(gl_LightSource[i].halfVector.xyz);&lt;br /&gt;
      float spec = 0., shine = 0.;&lt;br /&gt;
      if (i==0){&lt;br /&gt;
        spec = spec_value_0;&lt;br /&gt;
        shine = shininess_0;&lt;br /&gt;
      } else if (spec_count &amp;gt;= i){&lt;br /&gt;
        spec = spec_value;&lt;br /&gt;
        shine = shininess;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      //      final_color += gl_LightSource[i].ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                          gl_LightSource[i].diffuse * COLOR,&lt;br /&gt;
                                          spec, shine);&lt;br /&gt;
&lt;br /&gt;
      NdotL = dot(N, L);&lt;br /&gt;
&lt;br /&gt;
      if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
&lt;br /&gt;
        //    final_color += gl_LightSource[i].diffuse * NdotL * COLOR;&lt;br /&gt;
&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                            gl_LightSource[i].diffuse * COLOR * NdotL * 0.333,&lt;br /&gt;
                                            spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
        NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
        final_color += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    float fog = clamp((gl_Fog.end + ipoint.z) * gl_Fog.scale, 0.0, 1.0);&lt;br /&gt;
    fog = mix(1.0, fog, fog_enabled);&lt;br /&gt;
    vec3 fog_color;&lt;br /&gt;
&lt;br /&gt;
    if (bg_gradient){&lt;br /&gt;
      fog_color = mix(fog_color_bottom, fog_color_top, gl_FragCoord.y * inv_height);&lt;br /&gt;
    } else {&lt;br /&gt;
      fog_color = fog_color_top;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    final_color.rgb = mix(fog_color, final_color.rgb, fog);&lt;br /&gt;
&lt;br /&gt;
    vec4 f = vec4(final_color.rgb, COLOR.a);&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Fake shadows based on depth&lt;br /&gt;
    //&lt;br /&gt;
    // vec4 f = vec4(final_color.rgb * ( 1.05 - gl_FragDepth), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sphere Testing PyMOL Script ===&lt;br /&gt;
Now test out the sphere shader by saving the following PyMOL script as &amp;quot;test1.pml&amp;quot; and running it from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;br /&amp;gt;(If File &amp;gt; Run does not work for you, try typing in &amp;quot;@test1.pml&amp;quot; on the PyMOL command line. First make sure to &amp;quot;cd&amp;quot; on the PyMOL command line to the directory where you saved test1.pml)&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
show sphere, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set sphere_mode, 9&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
set_color carbons, [100, 225,90]&lt;br /&gt;
set_color others, [75, 100, 230]&lt;br /&gt;
util.cbaw 3V4K&lt;br /&gt;
set sphere_scale, 1.05&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.327029049,   -0.944887519,    0.015455140,\&lt;br /&gt;
     0.943798959,   -0.327394068,   -0.045230716,\&lt;br /&gt;
     0.047797613,   -0.000204348,    0.998857021,\&lt;br /&gt;
     0.000143192,   -0.000024423, -184.973327637,\&lt;br /&gt;
   -14.873787880,  -17.664234161,   35.063804626,\&lt;br /&gt;
   136.028396606,  233.926559448,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[-0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[-0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[-0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[ 0.0, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[ 0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[ 0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[ 0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',10)&lt;br /&gt;
cmd.set('spec_count',-1)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[1.0, 1.0, 1.0])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Cartoons ==&lt;br /&gt;
&lt;br /&gt;
=== Cartoon Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;default_es2.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;default_es2.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;default_es2.fs&amp;quot; (using a text editor) in the same directory: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
// Cartoon Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
varying vec3 packed_data_0 ;&lt;br /&gt;
varying vec4 packed_data_1 ;&lt;br /&gt;
varying vec4 packed_data_2 ;&lt;br /&gt;
varying vec4 packed_data_3 ;&lt;br /&gt;
varying vec4 packed_data_4 ;&lt;br /&gt;
&lt;br /&gt;
//varying vec3 N;&lt;br /&gt;
#define NORMAL packed_data_0.xyz&lt;br /&gt;
#define COLOR packed_data_3&lt;br /&gt;
#define fog (packed_data_1.w )&lt;br /&gt;
#define fog_color packed_data_1.x, packed_data_1.y, packed_data_1.z&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
uniform bool two_sided_lighting_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform vec4 interior_color;&lt;br /&gt;
uniform float interior_color_threshold;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform bool use_interior_color_threshold;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(bool is_interior, bool two_sided_lighting_enabled,&lt;br /&gt;
                          vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (!is_interior){&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  if (two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(-NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(-NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
  vec4 final_color = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (lighting_enabled){&lt;br /&gt;
    bool is_interior = false;&lt;br /&gt;
    if (use_interior_color_threshold){&lt;br /&gt;
      vec3 viewV = vec3(0.,0.,-1.);&lt;br /&gt;
      float dotp = dot(NORMAL, viewV);&lt;br /&gt;
      is_interior = ( dotp &amp;gt; interior_color_threshold );&lt;br /&gt;
    }&lt;br /&gt;
    if (!two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
      final_color = interior_color;&lt;br /&gt;
    } else {&lt;br /&gt;
      final_color = (gl_LightModel.ambient) * COLOR;&lt;br /&gt;
&lt;br /&gt;
      if (light_count&amp;gt;0){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[0].ambient,&lt;br /&gt;
                                            gl_LightSource[0].diffuse,&lt;br /&gt;
                                            spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      }}}}}}}}&lt;br /&gt;
    }&lt;br /&gt;
/*&lt;br /&gt;
      for (i=0; i&amp;lt;light_count;i++){&lt;br /&gt;
        vec3 L = normalize(vec3(gl_LightSource[i].position));&lt;br /&gt;
        vec3 H = normalize(vec3(gl_LightSource[i].halfVector.xyz));&lt;br /&gt;
        vec4 ambient = gl_LightSource[i].ambient;&lt;br /&gt;
        vec4 diffuse = gl_LightSource[i].diffuse;&lt;br /&gt;
        float spec = 0., shine = 0.;&lt;br /&gt;
        if (i==0){&lt;br /&gt;
          spec = spec_value_0;&lt;br /&gt;
          shine = shininess_0;&lt;br /&gt;
        } else if (spec_count &amp;gt;= i){&lt;br /&gt;
          spec = spec_value;&lt;br /&gt;
          shine = shininess;&lt;br /&gt;
        }&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled, L, H, ambient, diffuse, spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
*/&lt;br /&gt;
  } else {&lt;br /&gt;
    final_color = COLOR;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  float cfog = mix(1.0, clamp(fog, 0.0, 1.0), fog_enabled);&lt;br /&gt;
&lt;br /&gt;
  vec4 f = vec4(mix(vec3(fog_color), final_color.rgb, cfog), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
=== Cartoon Testing PyMOL Script ===&lt;br /&gt;
Now test out the sphere shader by saving the following PyMOL script as &amp;quot;test2.pml&amp;quot; and running it from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;br /&amp;gt;(If File &amp;gt; Run does not work for you, try typing in &amp;quot;@test2.pml&amp;quot; on the PyMOL command line. First make sure to &amp;quot;cd&amp;quot; on the PyMOL command line to the directory where you saved test2.pml)&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
hide all&lt;br /&gt;
show cartoon, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
color brown, 3V4K&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set cartoon_dumbbell_length, 0.85&lt;br /&gt;
set cartoon_dumbbell_radius, 0.15&lt;br /&gt;
set cartoon_dumbbell_width, 0.15&lt;br /&gt;
set cartoon_fancy_helices, on&lt;br /&gt;
&lt;br /&gt;
set cartoon_rect_length, 0.85&lt;br /&gt;
set cartoon_rect_width, 0.15&lt;br /&gt;
&lt;br /&gt;
set cartoon_loop_radius, 0.15&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.811935484,    0.547164500,   -0.203404382,\&lt;br /&gt;
     0.385375530,    0.240704626,   -0.890811384,\&lt;br /&gt;
    -0.438461006,   -0.801668167,   -0.406299770,\&lt;br /&gt;
     0.000018395,    0.000004439,  -80.686973572,\&lt;br /&gt;
   -14.601868629,   -7.145599365,   10.938076973,\&lt;br /&gt;
    26.767528534,  134.606826782,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',0)&lt;br /&gt;
cmd.set('spec_count',0)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[0.75, 0.75, 0.75])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Epilogue =&lt;br /&gt;
&lt;br /&gt;
The above is just a (very hackish) start. Feel free to modify, test and report back the changes/improvements you make. Have fun!&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7373</id>
		<title>GLSL Shaders</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7373"/>
		<updated>2013-03-04T20:18:43Z</updated>

		<summary type="html">&lt;p&gt;Shiven: /* Sphere Testing PyMOL Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
GLSL Shaders, shipped with PyMOL, may be modified to provide interesting and useful visual effects. The following modifications provide &amp;quot;Toon&amp;quot; shading effects, in some ways similar to the illustrations by David Goodsell as seen in the RCSB/PDB &amp;quot;Molecule of the Month&amp;quot; series [http://www.rcsb.org/pdb/101/motm.do?momID=150].&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
[[File:GLSLToonSperes.png|600px|thumb|center|GLSL Toon Spheres]]&lt;br /&gt;
[[File:GLSLToonCartoon.png|600px|thumb|center|GLSL Toon Cartoon]]&lt;br /&gt;
&lt;br /&gt;
= Instructions =&lt;br /&gt;
&lt;br /&gt;
The fragment shaders have been modified for [[Cartoon]] and [[Spheres]] only as of now.&lt;br /&gt;
The PyMOL shaders directory is located under:&lt;br /&gt;
* &amp;quot;/Applications/MacPyMOL.app/pymol/data/shaders&amp;quot; on Mac OSX&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Spheres ==&lt;br /&gt;
&lt;br /&gt;
=== Sphere Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;sphere.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;sphere.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;sphere.fs&amp;quot; (using a text editor) in the same directory:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
// Sphere impostor fragment shader&lt;br /&gt;
&lt;br /&gt;
// Sphere Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform float ortho;&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform vec3 fog_color_top;&lt;br /&gt;
uniform vec3 fog_color_bottom;&lt;br /&gt;
uniform float inv_height;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
varying vec4 COLOR;&lt;br /&gt;
varying vec3 sphere_center;&lt;br /&gt;
varying float radius2;&lt;br /&gt;
varying vec3 point;&lt;br /&gt;
// varying fog;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(vec3 N, vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  //&lt;br /&gt;
  // Begin code for calculating the Sphere Outline&lt;br /&gt;
  //&lt;br /&gt;
  float spheredge = dot(N,L);&lt;br /&gt;
  float edgeweight = 1.025;&lt;br /&gt;
  float edgegain = 16.0;&lt;br /&gt;
  spheredge = edgeweight - (spheredge * spheredge);&lt;br /&gt;
  spheredge = 1.0 - pow(spheredge, shine * edgegain);&lt;br /&gt;
  diffuse = mix(diffuse, diffuse * spheredge, shine);&lt;br /&gt;
&lt;br /&gt;
  ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
  NdotL = dot(N, L);&lt;br /&gt;
  if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
    ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
    NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
    ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
  }&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main(void)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_origin = mix(vec3(0.,0.,0.), point, ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_direction = mix(normalize(point), vec3(0., 0., 1.), ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 sphere_direction = mix(sphere_center, ray_origin - sphere_center, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate sphere-ray intersection&lt;br /&gt;
    float b = dot(sphere_direction, ray_direction);&lt;br /&gt;
&lt;br /&gt;
    float position = b * b + radius2 - dot(sphere_direction, sphere_direction);&lt;br /&gt;
&lt;br /&gt;
    // Check if the ray missed the sphere&lt;br /&gt;
    if (position &amp;lt; 0.0)&lt;br /&gt;
       discard;&lt;br /&gt;
&lt;br /&gt;
    // Calculate nearest point of intersection&lt;br /&gt;
    float nearest = mix(b - sqrt(position), sqrt(position) - b, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate intersection point on the sphere surface.  The ray&lt;br /&gt;
    // origin is at the quad (center point), so we need to project&lt;br /&gt;
    // back towards the user to get the front face.&lt;br /&gt;
    vec3 ipoint = nearest * ray_direction + ray_origin;&lt;br /&gt;
&lt;br /&gt;
    // Calculate normal at the intersection point&lt;br /&gt;
    vec3 N = normalize(ipoint - sphere_center);&lt;br /&gt;
&lt;br /&gt;
    // Calculate depth in clipping space&lt;br /&gt;
    vec2 clipZW = ipoint.z * gl_ProjectionMatrix[2].zw +&lt;br /&gt;
        gl_ProjectionMatrix[3].zw;&lt;br /&gt;
&lt;br /&gt;
    float depth = 0.5 + 0.5 * clipZW.x / clipZW.y;&lt;br /&gt;
&lt;br /&gt;
    // this is a workaround necessary for Mac&lt;br /&gt;
    // otherwise the modified fragment wont clip properly&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;lt;= 0.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;gt;= 1.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (COLOR.a &amp;lt;= 1.0)&lt;br /&gt;
      gl_FragDepth = depth;&lt;br /&gt;
    else&lt;br /&gt;
      gl_FragDepth = 1.0;&lt;br /&gt;
&lt;br /&gt;
    vec4 color;&lt;br /&gt;
&lt;br /&gt;
    vec3 L0 = normalize(vec3(gl_LightSource[0].position) - ipoint);&lt;br /&gt;
&lt;br /&gt;
    float NdotL = max(dot(N, L0), 0.0);&lt;br /&gt;
&lt;br /&gt;
    float NdotH;&lt;br /&gt;
&lt;br /&gt;
    vec4 final_color = gl_LightModel.ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
    if (light_count&amp;gt;0){&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[0].ambient,&lt;br /&gt;
                                          gl_LightSource[0].diffuse,&lt;br /&gt;
                                          spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
    }}}}}}}}&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    int i;&lt;br /&gt;
    for (i=0; i&amp;lt;light_count; i++){&lt;br /&gt;
      vec3 L = normalize(gl_LightSource[i].position.xyz);&lt;br /&gt;
      vec3 H = normalize(gl_LightSource[i].halfVector.xyz);&lt;br /&gt;
      float spec = 0., shine = 0.;&lt;br /&gt;
      if (i==0){&lt;br /&gt;
        spec = spec_value_0;&lt;br /&gt;
        shine = shininess_0;&lt;br /&gt;
      } else if (spec_count &amp;gt;= i){&lt;br /&gt;
        spec = spec_value;&lt;br /&gt;
        shine = shininess;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      //      final_color += gl_LightSource[i].ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                          gl_LightSource[i].diffuse * COLOR,&lt;br /&gt;
                                          spec, shine);&lt;br /&gt;
&lt;br /&gt;
      NdotL = dot(N, L);&lt;br /&gt;
&lt;br /&gt;
      if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
&lt;br /&gt;
        //    final_color += gl_LightSource[i].diffuse * NdotL * COLOR;&lt;br /&gt;
&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                            gl_LightSource[i].diffuse * COLOR * NdotL * 0.333,&lt;br /&gt;
                                            spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
        NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
        final_color += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    float fog = clamp((gl_Fog.end + ipoint.z) * gl_Fog.scale, 0.0, 1.0);&lt;br /&gt;
    fog = mix(1.0, fog, fog_enabled);&lt;br /&gt;
    vec3 fog_color;&lt;br /&gt;
&lt;br /&gt;
    if (bg_gradient){&lt;br /&gt;
      fog_color = mix(fog_color_bottom, fog_color_top, gl_FragCoord.y * inv_height);&lt;br /&gt;
    } else {&lt;br /&gt;
      fog_color = fog_color_top;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    final_color.rgb = mix(fog_color, final_color.rgb, fog);&lt;br /&gt;
&lt;br /&gt;
    vec4 f = vec4(final_color.rgb, COLOR.a);&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Fake shadows based on depth&lt;br /&gt;
    //&lt;br /&gt;
    // vec4 f = vec4(final_color.rgb * ( 1.05 - gl_FragDepth), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sphere Testing PyMOL Script ===&lt;br /&gt;
Now test out the sphere shader by saving the following PyMOL script as &amp;quot;test1.pml&amp;quot; and running it from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;br /&amp;gt;(If File &amp;gt; Run does not work for you, try typing in &amp;quot;@test1.pml&amp;quot; on the PyMOL command line. First make sure to &amp;quot;cd&amp;quot; on the PyMOL command line to the directory where you saved test1.pml)&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
show sphere, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set sphere_mode, 9&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
set_color carbons, [100, 225,90]&lt;br /&gt;
set_color others, [75, 100, 230]&lt;br /&gt;
util.cbaw 3V4K&lt;br /&gt;
set sphere_scale, 1.05&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.327029049,   -0.944887519,    0.015455140,\&lt;br /&gt;
     0.943798959,   -0.327394068,   -0.045230716,\&lt;br /&gt;
     0.047797613,   -0.000204348,    0.998857021,\&lt;br /&gt;
     0.000143192,   -0.000024423, -184.973327637,\&lt;br /&gt;
   -14.873787880,  -17.664234161,   35.063804626,\&lt;br /&gt;
   136.028396606,  233.926559448,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[-0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[-0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[-0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[ 0.0, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[ 0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[ 0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[ 0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',10)&lt;br /&gt;
cmd.set('spec_count',-1)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[1.0, 1.0, 1.0])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Cartoons ==&lt;br /&gt;
&lt;br /&gt;
=== Cartoon Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;default_es2.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;default_es2.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;default_es2.fs&amp;quot; (using a text editor) in the same directory: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
// Cartoon Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
varying vec3 packed_data_0 ;&lt;br /&gt;
varying vec4 packed_data_1 ;&lt;br /&gt;
varying vec4 packed_data_2 ;&lt;br /&gt;
varying vec4 packed_data_3 ;&lt;br /&gt;
varying vec4 packed_data_4 ;&lt;br /&gt;
&lt;br /&gt;
//varying vec3 N;&lt;br /&gt;
#define NORMAL packed_data_0.xyz&lt;br /&gt;
#define COLOR packed_data_3&lt;br /&gt;
#define fog (packed_data_1.w )&lt;br /&gt;
#define fog_color packed_data_1.x, packed_data_1.y, packed_data_1.z&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
uniform bool two_sided_lighting_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform vec4 interior_color;&lt;br /&gt;
uniform float interior_color_threshold;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform bool use_interior_color_threshold;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(bool is_interior, bool two_sided_lighting_enabled,&lt;br /&gt;
                          vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (!is_interior){&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  if (two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(-NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(-NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
  vec4 final_color = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (lighting_enabled){&lt;br /&gt;
    bool is_interior = false;&lt;br /&gt;
    if (use_interior_color_threshold){&lt;br /&gt;
      vec3 viewV = vec3(0.,0.,-1.);&lt;br /&gt;
      float dotp = dot(NORMAL, viewV);&lt;br /&gt;
      is_interior = ( dotp &amp;gt; interior_color_threshold );&lt;br /&gt;
    }&lt;br /&gt;
    if (!two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
      final_color = interior_color;&lt;br /&gt;
    } else {&lt;br /&gt;
      final_color = (gl_LightModel.ambient) * COLOR;&lt;br /&gt;
&lt;br /&gt;
      if (light_count&amp;gt;0){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[0].ambient,&lt;br /&gt;
                                            gl_LightSource[0].diffuse,&lt;br /&gt;
                                            spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      }}}}}}}}&lt;br /&gt;
    }&lt;br /&gt;
/*&lt;br /&gt;
      for (i=0; i&amp;lt;light_count;i++){&lt;br /&gt;
        vec3 L = normalize(vec3(gl_LightSource[i].position));&lt;br /&gt;
        vec3 H = normalize(vec3(gl_LightSource[i].halfVector.xyz));&lt;br /&gt;
        vec4 ambient = gl_LightSource[i].ambient;&lt;br /&gt;
        vec4 diffuse = gl_LightSource[i].diffuse;&lt;br /&gt;
        float spec = 0., shine = 0.;&lt;br /&gt;
        if (i==0){&lt;br /&gt;
          spec = spec_value_0;&lt;br /&gt;
          shine = shininess_0;&lt;br /&gt;
        } else if (spec_count &amp;gt;= i){&lt;br /&gt;
          spec = spec_value;&lt;br /&gt;
          shine = shininess;&lt;br /&gt;
        }&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled, L, H, ambient, diffuse, spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
*/&lt;br /&gt;
  } else {&lt;br /&gt;
    final_color = COLOR;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  float cfog = mix(1.0, clamp(fog, 0.0, 1.0), fog_enabled);&lt;br /&gt;
&lt;br /&gt;
  vec4 f = vec4(mix(vec3(fog_color), final_color.rgb, cfog), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
=== Cartoon Testing PyMOL Script ===&lt;br /&gt;
Now test out the cartoon shader by saving and running the following PyMOL script from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
hide all&lt;br /&gt;
show cartoon, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
color brown, 3V4K&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set cartoon_dumbbell_length, 0.85&lt;br /&gt;
set cartoon_dumbbell_radius, 0.15&lt;br /&gt;
set cartoon_dumbbell_width, 0.15&lt;br /&gt;
set cartoon_fancy_helices, on&lt;br /&gt;
&lt;br /&gt;
set cartoon_rect_length, 0.85&lt;br /&gt;
set cartoon_rect_width, 0.15&lt;br /&gt;
&lt;br /&gt;
set cartoon_loop_radius, 0.15&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.811935484,    0.547164500,   -0.203404382,\&lt;br /&gt;
     0.385375530,    0.240704626,   -0.890811384,\&lt;br /&gt;
    -0.438461006,   -0.801668167,   -0.406299770,\&lt;br /&gt;
     0.000018395,    0.000004439,  -80.686973572,\&lt;br /&gt;
   -14.601868629,   -7.145599365,   10.938076973,\&lt;br /&gt;
    26.767528534,  134.606826782,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',0)&lt;br /&gt;
cmd.set('spec_count',0)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[0.75, 0.75, 0.75])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Epilogue =&lt;br /&gt;
&lt;br /&gt;
The above is just a (very hackish) start. Feel free to modify, test and report back the changes/improvements you make. Have fun!&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Talk:GLSL_Shaders&amp;diff=206</id>
		<title>Talk:GLSL Shaders</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Talk:GLSL_Shaders&amp;diff=206"/>
		<updated>2013-03-04T20:14:15Z</updated>

		<summary type="html">&lt;p&gt;Shiven: /* Thanks! */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I believe the test script for e.g. sphere is a PyMOL script, not a Python script. So the way to do the tst is to save the script as a file named e.g. &amp;quot;test-sphere.pml&amp;quot; and then in PyMOL command line, type &amp;quot;@test-sphere.pml&amp;quot; to run this automated test. Saving it as a Python script and use FILE-&amp;gt;RUN won't work.&lt;br /&gt;
&lt;br /&gt;
==== Thanks! ====&lt;br /&gt;
&lt;br /&gt;
Thanks for the feedback, I'll update the page to reflect this. FILE-&amp;gt;RUN works with MacPyMOL and PyMOLX11Hybrid; both are commercial versions of PyMOL for Apple OS X.&lt;br /&gt;
Just tested this on OS X Lion.&lt;br /&gt;
&lt;br /&gt;
== Can't get sphere to work ==&lt;br /&gt;
&lt;br /&gt;
Tried it with PyMOL 1.5.0.3 with Python 2.6.6 or 2.7.3, on a Sony VAIO running Vista Business with nVidia GeForce 8400M GS. Caused a crash at the final draw command complaining something about the graphics driver, and thus a runtime error.&lt;br /&gt;
&lt;br /&gt;
==== Driver Hell? ====&lt;br /&gt;
&lt;br /&gt;
Since you are having this problem on a Microsoft Windows platform, my first guess would be that the nVidia graphics drivers need updating as they may not be supporting the advanced OpenGL features required for this to work. Give it another shot on a different platform perhaps? :-)&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Talk:GLSL_Shaders&amp;diff=205</id>
		<title>Talk:GLSL Shaders</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Talk:GLSL_Shaders&amp;diff=205"/>
		<updated>2013-03-04T20:13:51Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I believe the test script for e.g. sphere is a PyMOL script, not a Python script. So the way to do the tst is to save the script as a file named e.g. &amp;quot;test-sphere.pml&amp;quot; and then in PyMOL command line, type &amp;quot;@test-sphere.pml&amp;quot; to run this automated test. Saving it as a Python script and use FILE-&amp;gt;RUN won't work.&lt;br /&gt;
&lt;br /&gt;
==== Thanks! ====&lt;br /&gt;
&lt;br /&gt;
Thanks for the feedback, I'll update the page to reflect this. FILE-&amp;gt;RUN works with MacPyMOL and PyMOLX11Hybrid; both are commercial versions of PyMOL for Apple OS X. Just tested on OS X Lion.&lt;br /&gt;
&lt;br /&gt;
== Can't get sphere to work ==&lt;br /&gt;
&lt;br /&gt;
Tried it with PyMOL 1.5.0.3 with Python 2.6.6 or 2.7.3, on a Sony VAIO running Vista Business with nVidia GeForce 8400M GS. Caused a crash at the final draw command complaining something about the graphics driver, and thus a runtime error.&lt;br /&gt;
&lt;br /&gt;
==== Driver Hell? ====&lt;br /&gt;
&lt;br /&gt;
Since you are having this problem on a Microsoft Windows platform, my first guess would be that the nVidia graphics drivers need updating as they may not be supporting the advanced OpenGL features required for this to work. Give it another shot on a different platform perhaps? :-)&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Talk:GLSL_Shaders&amp;diff=204</id>
		<title>Talk:GLSL Shaders</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Talk:GLSL_Shaders&amp;diff=204"/>
		<updated>2013-03-04T20:13:16Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I believe the test script for e.g. sphere is a PyMOL script, not a Python script. So the way to do the tst is to save the script as a file named e.g. &amp;quot;test-sphere.pml&amp;quot; and then in PyMOL command line, type &amp;quot;@test-sphere.pml&amp;quot; to run this automated test. Saving it as a Python script and use FILE-&amp;gt;RUN won't work.&lt;br /&gt;
&lt;br /&gt;
=== Thanks! ===&lt;br /&gt;
&lt;br /&gt;
Thanks for the feedback, I'll update the page to reflect this. FILE-&amp;gt;RUN works with MacPyMOL and PyMOLX11Hybrid; both are commercial versions of PyMOL for Apple OS X. Just tested on OS X Lion.&lt;br /&gt;
&lt;br /&gt;
== Can't get sphere to work ==&lt;br /&gt;
&lt;br /&gt;
Tried it with PyMOL 1.5.0.3 with Python 2.6.6 or 2.7.3, on a Sony VAIO running Vista Business with nVidia GeForce 8400M GS. Caused a crash at the final draw command complaining something about the graphics driver, and thus a runtime error.&lt;br /&gt;
&lt;br /&gt;
=== Driver Hell? ===&lt;br /&gt;
&lt;br /&gt;
Since you are having this problem on a Microsoft Windows platform, my first guess would be that the nVidia graphics drivers need updating as they may not be supporting the advanced OpenGL features required for this to work. Give it another shot on a different platform perhaps? :-)&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3190</id>
		<title>User:Shiven</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3190"/>
		<updated>2012-11-27T22:35:37Z</updated>

		<summary type="html">&lt;p&gt;Shiven: /* Primary contributions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== About ===&lt;br /&gt;
&lt;br /&gt;
http://users.umassmed.edu/shivender.shandilya/&lt;br /&gt;
&lt;br /&gt;
http://proteinz.blogspot.com/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Primary contributions ===&lt;br /&gt;
&lt;br /&gt;
* [[GLSL Shaders]]&lt;br /&gt;
* [[ColorByRMSD]]&lt;br /&gt;
* [[Blender]]&lt;br /&gt;
* ...&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3189</id>
		<title>User:Shiven</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3189"/>
		<updated>2012-11-27T18:56:17Z</updated>

		<summary type="html">&lt;p&gt;Shiven: /* Primary contributions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== About ===&lt;br /&gt;
&lt;br /&gt;
http://users.umassmed.edu/shivender.shandilya/&lt;br /&gt;
&lt;br /&gt;
http://proteinz.blogspot.com/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Primary contributions ===&lt;br /&gt;
&lt;br /&gt;
* [[GLSL Shaders]]&lt;br /&gt;
* [[Cealign]]&lt;br /&gt;
* [[Blender]]&lt;br /&gt;
* ...&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3188</id>
		<title>User:Shiven</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3188"/>
		<updated>2012-09-11T23:29:05Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== About ===&lt;br /&gt;
&lt;br /&gt;
http://users.umassmed.edu/shivender.shandilya/&lt;br /&gt;
&lt;br /&gt;
http://proteinz.blogspot.com/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Primary contributions ===&lt;br /&gt;
&lt;br /&gt;
* [[GLSL Shaders]]&lt;br /&gt;
* [[Blender]]&lt;br /&gt;
* [[Cealign]]&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3187</id>
		<title>User:Shiven</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3187"/>
		<updated>2012-09-11T23:26:03Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== About ===&lt;br /&gt;
&lt;br /&gt;
http://users.umassmed.edu/shivender.shandilya/&lt;br /&gt;
&lt;br /&gt;
http://proteinz.blogspot.com/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Primary contributions ===&lt;br /&gt;
&lt;br /&gt;
* [[GLSL Shaders]]&lt;br /&gt;
* [[Blender]]&lt;br /&gt;
* [[Cealign]]&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3186</id>
		<title>User:Shiven</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3186"/>
		<updated>2012-09-11T23:25:44Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== About ===&lt;br /&gt;
&lt;br /&gt;
http://users.umassmed.edu/shivender.shandilya/&lt;br /&gt;
&lt;br /&gt;
http://proteinz.blogspot.com/&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Primary contributions ===&lt;br /&gt;
&lt;br /&gt;
* [[GLSL Shaders]]&lt;br /&gt;
* [[Blender]]&lt;br /&gt;
* [[Cealign]]&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3185</id>
		<title>User:Shiven</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=User:Shiven&amp;diff=3185"/>
		<updated>2012-09-11T23:25:28Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[TOC]&lt;br /&gt;
&lt;br /&gt;
=== About ===&lt;br /&gt;
&lt;br /&gt;
http://users.umassmed.edu/shivender.shandilya/&lt;br /&gt;
&lt;br /&gt;
http://proteinz.blogspot.com/&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
=== Primary contributions ===&lt;br /&gt;
&lt;br /&gt;
* [[GLSL Shaders]]&lt;br /&gt;
* [[Blender]]&lt;br /&gt;
* [[Cealign]]&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7371</id>
		<title>GLSL Shaders</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7371"/>
		<updated>2012-06-12T20:28:03Z</updated>

		<summary type="html">&lt;p&gt;Shiven: /* Gallery */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
GLSL Shaders, shipped with PyMOL, may be modified to provide interesting and useful visual effects. The following modifications provide &amp;quot;Toon&amp;quot; shading effects, in some ways similar to the illustrations by David Goodsell as seen in the RCSB/PDB &amp;quot;Molecule of the Month&amp;quot; series [http://www.rcsb.org/pdb/101/motm.do?momID=150].&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
[[File:GLSLToonSperes.png|600px|thumb|center|GLSL Toon Spheres]]&lt;br /&gt;
[[File:GLSLToonCartoon.png|600px|thumb|center|GLSL Toon Cartoon]]&lt;br /&gt;
&lt;br /&gt;
= Instructions =&lt;br /&gt;
&lt;br /&gt;
The fragment shaders have been modified for [[Cartoon]] and [[Spheres]] only as of now.&lt;br /&gt;
The PyMOL shaders directory is located under:&lt;br /&gt;
* &amp;quot;/Applications/MacPyMOL.app/pymol/data/shaders&amp;quot; on Mac OSX&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Spheres ==&lt;br /&gt;
&lt;br /&gt;
=== Sphere Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;sphere.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;shaders.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;shaders.fs&amp;quot; (using a text editor) in the same directory:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
// Sphere impostor fragment shader&lt;br /&gt;
&lt;br /&gt;
// Sphere Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform float ortho;&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform vec3 fog_color_top;&lt;br /&gt;
uniform vec3 fog_color_bottom;&lt;br /&gt;
uniform float inv_height;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
varying vec4 COLOR;&lt;br /&gt;
varying vec3 sphere_center;&lt;br /&gt;
varying float radius2;&lt;br /&gt;
varying vec3 point;&lt;br /&gt;
// varying fog;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(vec3 N, vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  //&lt;br /&gt;
  // Begin code for calculating the Sphere Outline&lt;br /&gt;
  //&lt;br /&gt;
  float spheredge = dot(N,L);&lt;br /&gt;
  float edgeweight = 1.025;&lt;br /&gt;
  float edgegain = 16.0;&lt;br /&gt;
  spheredge = edgeweight - (spheredge * spheredge);&lt;br /&gt;
  spheredge = 1.0 - pow(spheredge, shine * edgegain);&lt;br /&gt;
  diffuse = mix(diffuse, diffuse * spheredge, shine);&lt;br /&gt;
&lt;br /&gt;
  ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
  NdotL = dot(N, L);&lt;br /&gt;
  if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
    ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
    NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
    ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
  }&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main(void)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_origin = mix(vec3(0.,0.,0.), point, ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_direction = mix(normalize(point), vec3(0., 0., 1.), ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 sphere_direction = mix(sphere_center, ray_origin - sphere_center, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate sphere-ray intersection&lt;br /&gt;
    float b = dot(sphere_direction, ray_direction);&lt;br /&gt;
&lt;br /&gt;
    float position = b * b + radius2 - dot(sphere_direction, sphere_direction);&lt;br /&gt;
&lt;br /&gt;
    // Check if the ray missed the sphere&lt;br /&gt;
    if (position &amp;lt; 0.0)&lt;br /&gt;
       discard;&lt;br /&gt;
&lt;br /&gt;
    // Calculate nearest point of intersection&lt;br /&gt;
    float nearest = mix(b - sqrt(position), sqrt(position) - b, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate intersection point on the sphere surface.  The ray&lt;br /&gt;
    // origin is at the quad (center point), so we need to project&lt;br /&gt;
    // back towards the user to get the front face.&lt;br /&gt;
    vec3 ipoint = nearest * ray_direction + ray_origin;&lt;br /&gt;
&lt;br /&gt;
    // Calculate normal at the intersection point&lt;br /&gt;
    vec3 N = normalize(ipoint - sphere_center);&lt;br /&gt;
&lt;br /&gt;
    // Calculate depth in clipping space&lt;br /&gt;
    vec2 clipZW = ipoint.z * gl_ProjectionMatrix[2].zw +&lt;br /&gt;
        gl_ProjectionMatrix[3].zw;&lt;br /&gt;
&lt;br /&gt;
    float depth = 0.5 + 0.5 * clipZW.x / clipZW.y;&lt;br /&gt;
&lt;br /&gt;
    // this is a workaround necessary for Mac&lt;br /&gt;
    // otherwise the modified fragment wont clip properly&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;lt;= 0.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;gt;= 1.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (COLOR.a &amp;lt;= 1.0)&lt;br /&gt;
      gl_FragDepth = depth;&lt;br /&gt;
    else&lt;br /&gt;
      gl_FragDepth = 1.0;&lt;br /&gt;
&lt;br /&gt;
    vec4 color;&lt;br /&gt;
&lt;br /&gt;
    vec3 L0 = normalize(vec3(gl_LightSource[0].position) - ipoint);&lt;br /&gt;
&lt;br /&gt;
    float NdotL = max(dot(N, L0), 0.0);&lt;br /&gt;
&lt;br /&gt;
    float NdotH;&lt;br /&gt;
&lt;br /&gt;
    vec4 final_color = gl_LightModel.ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
    if (light_count&amp;gt;0){&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[0].ambient,&lt;br /&gt;
                                          gl_LightSource[0].diffuse,&lt;br /&gt;
                                          spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
    }}}}}}}}&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    int i;&lt;br /&gt;
    for (i=0; i&amp;lt;light_count; i++){&lt;br /&gt;
      vec3 L = normalize(gl_LightSource[i].position.xyz);&lt;br /&gt;
      vec3 H = normalize(gl_LightSource[i].halfVector.xyz);&lt;br /&gt;
      float spec = 0., shine = 0.;&lt;br /&gt;
      if (i==0){&lt;br /&gt;
        spec = spec_value_0;&lt;br /&gt;
        shine = shininess_0;&lt;br /&gt;
      } else if (spec_count &amp;gt;= i){&lt;br /&gt;
        spec = spec_value;&lt;br /&gt;
        shine = shininess;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      //      final_color += gl_LightSource[i].ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                          gl_LightSource[i].diffuse * COLOR,&lt;br /&gt;
                                          spec, shine);&lt;br /&gt;
&lt;br /&gt;
      NdotL = dot(N, L);&lt;br /&gt;
&lt;br /&gt;
      if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
&lt;br /&gt;
        //    final_color += gl_LightSource[i].diffuse * NdotL * COLOR;&lt;br /&gt;
&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                            gl_LightSource[i].diffuse * COLOR * NdotL * 0.333,&lt;br /&gt;
                                            spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
        NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
        final_color += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    float fog = clamp((gl_Fog.end + ipoint.z) * gl_Fog.scale, 0.0, 1.0);&lt;br /&gt;
    fog = mix(1.0, fog, fog_enabled);&lt;br /&gt;
    vec3 fog_color;&lt;br /&gt;
&lt;br /&gt;
    if (bg_gradient){&lt;br /&gt;
      fog_color = mix(fog_color_bottom, fog_color_top, gl_FragCoord.y * inv_height);&lt;br /&gt;
    } else {&lt;br /&gt;
      fog_color = fog_color_top;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    final_color.rgb = mix(fog_color, final_color.rgb, fog);&lt;br /&gt;
&lt;br /&gt;
    vec4 f = vec4(final_color.rgb, COLOR.a);&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Fake shadows based on depth&lt;br /&gt;
    //&lt;br /&gt;
    // vec4 f = vec4(final_color.rgb * ( 1.05 - gl_FragDepth), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sphere Testing PyMOL Script ===&lt;br /&gt;
Now test out the sphere shader by saving and running the following PyMOL script from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
show sphere, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set sphere_mode, 9&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
set_color carbons, [100, 225,90]&lt;br /&gt;
set_color others, [75, 100, 230]&lt;br /&gt;
util.cbaw 3V4K&lt;br /&gt;
set sphere_scale, 1.05&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.327029049,   -0.944887519,    0.015455140,\&lt;br /&gt;
     0.943798959,   -0.327394068,   -0.045230716,\&lt;br /&gt;
     0.047797613,   -0.000204348,    0.998857021,\&lt;br /&gt;
     0.000143192,   -0.000024423, -184.973327637,\&lt;br /&gt;
   -14.873787880,  -17.664234161,   35.063804626,\&lt;br /&gt;
   136.028396606,  233.926559448,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[-0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[-0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[-0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[ 0.0, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[ 0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[ 0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[ 0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',10)&lt;br /&gt;
cmd.set('spec_count',-1)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[1.0, 1.0, 1.0])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Cartoons ==&lt;br /&gt;
&lt;br /&gt;
=== Cartoon Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;default_es2.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;default_es2.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;default_es2.fs&amp;quot; (using a text editor) in the same directory: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
// Cartoon Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
varying vec3 packed_data_0 ;&lt;br /&gt;
varying vec4 packed_data_1 ;&lt;br /&gt;
varying vec4 packed_data_2 ;&lt;br /&gt;
varying vec4 packed_data_3 ;&lt;br /&gt;
varying vec4 packed_data_4 ;&lt;br /&gt;
&lt;br /&gt;
//varying vec3 N;&lt;br /&gt;
#define NORMAL packed_data_0.xyz&lt;br /&gt;
#define COLOR packed_data_3&lt;br /&gt;
#define fog (packed_data_1.w )&lt;br /&gt;
#define fog_color packed_data_1.x, packed_data_1.y, packed_data_1.z&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
uniform bool two_sided_lighting_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform vec4 interior_color;&lt;br /&gt;
uniform float interior_color_threshold;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform bool use_interior_color_threshold;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(bool is_interior, bool two_sided_lighting_enabled,&lt;br /&gt;
                          vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (!is_interior){&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  if (two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(-NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(-NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
  vec4 final_color = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (lighting_enabled){&lt;br /&gt;
    bool is_interior = false;&lt;br /&gt;
    if (use_interior_color_threshold){&lt;br /&gt;
      vec3 viewV = vec3(0.,0.,-1.);&lt;br /&gt;
      float dotp = dot(NORMAL, viewV);&lt;br /&gt;
      is_interior = ( dotp &amp;gt; interior_color_threshold );&lt;br /&gt;
    }&lt;br /&gt;
    if (!two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
      final_color = interior_color;&lt;br /&gt;
    } else {&lt;br /&gt;
      final_color = (gl_LightModel.ambient) * COLOR;&lt;br /&gt;
&lt;br /&gt;
      if (light_count&amp;gt;0){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[0].ambient,&lt;br /&gt;
                                            gl_LightSource[0].diffuse,&lt;br /&gt;
                                            spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      }}}}}}}}&lt;br /&gt;
    }&lt;br /&gt;
/*&lt;br /&gt;
      for (i=0; i&amp;lt;light_count;i++){&lt;br /&gt;
        vec3 L = normalize(vec3(gl_LightSource[i].position));&lt;br /&gt;
        vec3 H = normalize(vec3(gl_LightSource[i].halfVector.xyz));&lt;br /&gt;
        vec4 ambient = gl_LightSource[i].ambient;&lt;br /&gt;
        vec4 diffuse = gl_LightSource[i].diffuse;&lt;br /&gt;
        float spec = 0., shine = 0.;&lt;br /&gt;
        if (i==0){&lt;br /&gt;
          spec = spec_value_0;&lt;br /&gt;
          shine = shininess_0;&lt;br /&gt;
        } else if (spec_count &amp;gt;= i){&lt;br /&gt;
          spec = spec_value;&lt;br /&gt;
          shine = shininess;&lt;br /&gt;
        }&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled, L, H, ambient, diffuse, spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
*/&lt;br /&gt;
  } else {&lt;br /&gt;
    final_color = COLOR;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  float cfog = mix(1.0, clamp(fog, 0.0, 1.0), fog_enabled);&lt;br /&gt;
&lt;br /&gt;
  vec4 f = vec4(mix(vec3(fog_color), final_color.rgb, cfog), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
=== Cartoon Testing PyMOL Script ===&lt;br /&gt;
Now test out the cartoon shader by saving and running the following PyMOL script from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
hide all&lt;br /&gt;
show cartoon, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
color brown, 3V4K&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set cartoon_dumbbell_length, 0.85&lt;br /&gt;
set cartoon_dumbbell_radius, 0.15&lt;br /&gt;
set cartoon_dumbbell_width, 0.15&lt;br /&gt;
set cartoon_fancy_helices, on&lt;br /&gt;
&lt;br /&gt;
set cartoon_rect_length, 0.85&lt;br /&gt;
set cartoon_rect_width, 0.15&lt;br /&gt;
&lt;br /&gt;
set cartoon_loop_radius, 0.15&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.811935484,    0.547164500,   -0.203404382,\&lt;br /&gt;
     0.385375530,    0.240704626,   -0.890811384,\&lt;br /&gt;
    -0.438461006,   -0.801668167,   -0.406299770,\&lt;br /&gt;
     0.000018395,    0.000004439,  -80.686973572,\&lt;br /&gt;
   -14.601868629,   -7.145599365,   10.938076973,\&lt;br /&gt;
    26.767528534,  134.606826782,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',0)&lt;br /&gt;
cmd.set('spec_count',0)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[0.75, 0.75, 0.75])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Epilogue =&lt;br /&gt;
&lt;br /&gt;
The above is just a (very hackish) start. Feel free to modify, test and report back the changes/improvements you make. Have fun!&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:GLSLToonCartoon.png&amp;diff=2318</id>
		<title>File:GLSLToonCartoon.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:GLSLToonCartoon.png&amp;diff=2318"/>
		<updated>2012-06-12T20:22:54Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:GLSLToonSperes.png&amp;diff=1820</id>
		<title>File:GLSLToonSperes.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:GLSLToonSperes.png&amp;diff=1820"/>
		<updated>2012-06-12T20:22:29Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7370</id>
		<title>GLSL Shaders</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7370"/>
		<updated>2012-06-12T20:22:07Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
GLSL Shaders, shipped with PyMOL, may be modified to provide interesting and useful visual effects. The following modifications provide &amp;quot;Toon&amp;quot; shading effects, in some ways similar to the illustrations by David Goodsell as seen in the RCSB/PDB &amp;quot;Molecule of the Month&amp;quot; series [http://www.rcsb.org/pdb/101/motm.do?momID=150].&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
[[File:GLSLToonSperes.png]]&lt;br /&gt;
[[File:GLSLToonCartoon.png]]&lt;br /&gt;
&lt;br /&gt;
= Instructions =&lt;br /&gt;
&lt;br /&gt;
The fragment shaders have been modified for [[Cartoon]] and [[Spheres]] only as of now.&lt;br /&gt;
The PyMOL shaders directory is located under:&lt;br /&gt;
* &amp;quot;/Applications/MacPyMOL.app/pymol/data/shaders&amp;quot; on Mac OSX&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Spheres ==&lt;br /&gt;
&lt;br /&gt;
=== Sphere Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;sphere.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;shaders.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;shaders.fs&amp;quot; (using a text editor) in the same directory:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
// Sphere impostor fragment shader&lt;br /&gt;
&lt;br /&gt;
// Sphere Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform float ortho;&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform vec3 fog_color_top;&lt;br /&gt;
uniform vec3 fog_color_bottom;&lt;br /&gt;
uniform float inv_height;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
varying vec4 COLOR;&lt;br /&gt;
varying vec3 sphere_center;&lt;br /&gt;
varying float radius2;&lt;br /&gt;
varying vec3 point;&lt;br /&gt;
// varying fog;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(vec3 N, vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  //&lt;br /&gt;
  // Begin code for calculating the Sphere Outline&lt;br /&gt;
  //&lt;br /&gt;
  float spheredge = dot(N,L);&lt;br /&gt;
  float edgeweight = 1.025;&lt;br /&gt;
  float edgegain = 16.0;&lt;br /&gt;
  spheredge = edgeweight - (spheredge * spheredge);&lt;br /&gt;
  spheredge = 1.0 - pow(spheredge, shine * edgegain);&lt;br /&gt;
  diffuse = mix(diffuse, diffuse * spheredge, shine);&lt;br /&gt;
&lt;br /&gt;
  ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
  NdotL = dot(N, L);&lt;br /&gt;
  if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
    ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
    NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
    ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
  }&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main(void)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_origin = mix(vec3(0.,0.,0.), point, ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_direction = mix(normalize(point), vec3(0., 0., 1.), ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 sphere_direction = mix(sphere_center, ray_origin - sphere_center, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate sphere-ray intersection&lt;br /&gt;
    float b = dot(sphere_direction, ray_direction);&lt;br /&gt;
&lt;br /&gt;
    float position = b * b + radius2 - dot(sphere_direction, sphere_direction);&lt;br /&gt;
&lt;br /&gt;
    // Check if the ray missed the sphere&lt;br /&gt;
    if (position &amp;lt; 0.0)&lt;br /&gt;
       discard;&lt;br /&gt;
&lt;br /&gt;
    // Calculate nearest point of intersection&lt;br /&gt;
    float nearest = mix(b - sqrt(position), sqrt(position) - b, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate intersection point on the sphere surface.  The ray&lt;br /&gt;
    // origin is at the quad (center point), so we need to project&lt;br /&gt;
    // back towards the user to get the front face.&lt;br /&gt;
    vec3 ipoint = nearest * ray_direction + ray_origin;&lt;br /&gt;
&lt;br /&gt;
    // Calculate normal at the intersection point&lt;br /&gt;
    vec3 N = normalize(ipoint - sphere_center);&lt;br /&gt;
&lt;br /&gt;
    // Calculate depth in clipping space&lt;br /&gt;
    vec2 clipZW = ipoint.z * gl_ProjectionMatrix[2].zw +&lt;br /&gt;
        gl_ProjectionMatrix[3].zw;&lt;br /&gt;
&lt;br /&gt;
    float depth = 0.5 + 0.5 * clipZW.x / clipZW.y;&lt;br /&gt;
&lt;br /&gt;
    // this is a workaround necessary for Mac&lt;br /&gt;
    // otherwise the modified fragment wont clip properly&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;lt;= 0.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;gt;= 1.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (COLOR.a &amp;lt;= 1.0)&lt;br /&gt;
      gl_FragDepth = depth;&lt;br /&gt;
    else&lt;br /&gt;
      gl_FragDepth = 1.0;&lt;br /&gt;
&lt;br /&gt;
    vec4 color;&lt;br /&gt;
&lt;br /&gt;
    vec3 L0 = normalize(vec3(gl_LightSource[0].position) - ipoint);&lt;br /&gt;
&lt;br /&gt;
    float NdotL = max(dot(N, L0), 0.0);&lt;br /&gt;
&lt;br /&gt;
    float NdotH;&lt;br /&gt;
&lt;br /&gt;
    vec4 final_color = gl_LightModel.ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
    if (light_count&amp;gt;0){&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[0].ambient,&lt;br /&gt;
                                          gl_LightSource[0].diffuse,&lt;br /&gt;
                                          spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
    }}}}}}}}&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    int i;&lt;br /&gt;
    for (i=0; i&amp;lt;light_count; i++){&lt;br /&gt;
      vec3 L = normalize(gl_LightSource[i].position.xyz);&lt;br /&gt;
      vec3 H = normalize(gl_LightSource[i].halfVector.xyz);&lt;br /&gt;
      float spec = 0., shine = 0.;&lt;br /&gt;
      if (i==0){&lt;br /&gt;
        spec = spec_value_0;&lt;br /&gt;
        shine = shininess_0;&lt;br /&gt;
      } else if (spec_count &amp;gt;= i){&lt;br /&gt;
        spec = spec_value;&lt;br /&gt;
        shine = shininess;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      //      final_color += gl_LightSource[i].ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                          gl_LightSource[i].diffuse * COLOR,&lt;br /&gt;
                                          spec, shine);&lt;br /&gt;
&lt;br /&gt;
      NdotL = dot(N, L);&lt;br /&gt;
&lt;br /&gt;
      if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
&lt;br /&gt;
        //    final_color += gl_LightSource[i].diffuse * NdotL * COLOR;&lt;br /&gt;
&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                            gl_LightSource[i].diffuse * COLOR * NdotL * 0.333,&lt;br /&gt;
                                            spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
        NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
        final_color += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    float fog = clamp((gl_Fog.end + ipoint.z) * gl_Fog.scale, 0.0, 1.0);&lt;br /&gt;
    fog = mix(1.0, fog, fog_enabled);&lt;br /&gt;
    vec3 fog_color;&lt;br /&gt;
&lt;br /&gt;
    if (bg_gradient){&lt;br /&gt;
      fog_color = mix(fog_color_bottom, fog_color_top, gl_FragCoord.y * inv_height);&lt;br /&gt;
    } else {&lt;br /&gt;
      fog_color = fog_color_top;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    final_color.rgb = mix(fog_color, final_color.rgb, fog);&lt;br /&gt;
&lt;br /&gt;
    vec4 f = vec4(final_color.rgb, COLOR.a);&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Fake shadows based on depth&lt;br /&gt;
    //&lt;br /&gt;
    // vec4 f = vec4(final_color.rgb * ( 1.05 - gl_FragDepth), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sphere Testing PyMOL Script ===&lt;br /&gt;
Now test out the sphere shader by saving and running the following PyMOL script from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
show sphere, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set sphere_mode, 9&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
set_color carbons, [100, 225,90]&lt;br /&gt;
set_color others, [75, 100, 230]&lt;br /&gt;
util.cbaw 3V4K&lt;br /&gt;
set sphere_scale, 1.05&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.327029049,   -0.944887519,    0.015455140,\&lt;br /&gt;
     0.943798959,   -0.327394068,   -0.045230716,\&lt;br /&gt;
     0.047797613,   -0.000204348,    0.998857021,\&lt;br /&gt;
     0.000143192,   -0.000024423, -184.973327637,\&lt;br /&gt;
   -14.873787880,  -17.664234161,   35.063804626,\&lt;br /&gt;
   136.028396606,  233.926559448,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[-0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[-0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[-0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[ 0.0, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[ 0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[ 0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[ 0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',10)&lt;br /&gt;
cmd.set('spec_count',-1)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[1.0, 1.0, 1.0])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Cartoons ==&lt;br /&gt;
&lt;br /&gt;
=== Cartoon Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;default_es2.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;default_es2.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;default_es2.fs&amp;quot; (using a text editor) in the same directory: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
// Cartoon Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
varying vec3 packed_data_0 ;&lt;br /&gt;
varying vec4 packed_data_1 ;&lt;br /&gt;
varying vec4 packed_data_2 ;&lt;br /&gt;
varying vec4 packed_data_3 ;&lt;br /&gt;
varying vec4 packed_data_4 ;&lt;br /&gt;
&lt;br /&gt;
//varying vec3 N;&lt;br /&gt;
#define NORMAL packed_data_0.xyz&lt;br /&gt;
#define COLOR packed_data_3&lt;br /&gt;
#define fog (packed_data_1.w )&lt;br /&gt;
#define fog_color packed_data_1.x, packed_data_1.y, packed_data_1.z&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
uniform bool two_sided_lighting_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform vec4 interior_color;&lt;br /&gt;
uniform float interior_color_threshold;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform bool use_interior_color_threshold;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(bool is_interior, bool two_sided_lighting_enabled,&lt;br /&gt;
                          vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (!is_interior){&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  if (two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(-NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(-NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
  vec4 final_color = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (lighting_enabled){&lt;br /&gt;
    bool is_interior = false;&lt;br /&gt;
    if (use_interior_color_threshold){&lt;br /&gt;
      vec3 viewV = vec3(0.,0.,-1.);&lt;br /&gt;
      float dotp = dot(NORMAL, viewV);&lt;br /&gt;
      is_interior = ( dotp &amp;gt; interior_color_threshold );&lt;br /&gt;
    }&lt;br /&gt;
    if (!two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
      final_color = interior_color;&lt;br /&gt;
    } else {&lt;br /&gt;
      final_color = (gl_LightModel.ambient) * COLOR;&lt;br /&gt;
&lt;br /&gt;
      if (light_count&amp;gt;0){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[0].ambient,&lt;br /&gt;
                                            gl_LightSource[0].diffuse,&lt;br /&gt;
                                            spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      }}}}}}}}&lt;br /&gt;
    }&lt;br /&gt;
/*&lt;br /&gt;
      for (i=0; i&amp;lt;light_count;i++){&lt;br /&gt;
        vec3 L = normalize(vec3(gl_LightSource[i].position));&lt;br /&gt;
        vec3 H = normalize(vec3(gl_LightSource[i].halfVector.xyz));&lt;br /&gt;
        vec4 ambient = gl_LightSource[i].ambient;&lt;br /&gt;
        vec4 diffuse = gl_LightSource[i].diffuse;&lt;br /&gt;
        float spec = 0., shine = 0.;&lt;br /&gt;
        if (i==0){&lt;br /&gt;
          spec = spec_value_0;&lt;br /&gt;
          shine = shininess_0;&lt;br /&gt;
        } else if (spec_count &amp;gt;= i){&lt;br /&gt;
          spec = spec_value;&lt;br /&gt;
          shine = shininess;&lt;br /&gt;
        }&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled, L, H, ambient, diffuse, spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
*/&lt;br /&gt;
  } else {&lt;br /&gt;
    final_color = COLOR;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  float cfog = mix(1.0, clamp(fog, 0.0, 1.0), fog_enabled);&lt;br /&gt;
&lt;br /&gt;
  vec4 f = vec4(mix(vec3(fog_color), final_color.rgb, cfog), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
=== Cartoon Testing PyMOL Script ===&lt;br /&gt;
Now test out the cartoon shader by saving and running the following PyMOL script from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
hide all&lt;br /&gt;
show cartoon, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
color brown, 3V4K&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set cartoon_dumbbell_length, 0.85&lt;br /&gt;
set cartoon_dumbbell_radius, 0.15&lt;br /&gt;
set cartoon_dumbbell_width, 0.15&lt;br /&gt;
set cartoon_fancy_helices, on&lt;br /&gt;
&lt;br /&gt;
set cartoon_rect_length, 0.85&lt;br /&gt;
set cartoon_rect_width, 0.15&lt;br /&gt;
&lt;br /&gt;
set cartoon_loop_radius, 0.15&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.811935484,    0.547164500,   -0.203404382,\&lt;br /&gt;
     0.385375530,    0.240704626,   -0.890811384,\&lt;br /&gt;
    -0.438461006,   -0.801668167,   -0.406299770,\&lt;br /&gt;
     0.000018395,    0.000004439,  -80.686973572,\&lt;br /&gt;
   -14.601868629,   -7.145599365,   10.938076973,\&lt;br /&gt;
    26.767528534,  134.606826782,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',0)&lt;br /&gt;
cmd.set('spec_count',0)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[0.75, 0.75, 0.75])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Epilogue =&lt;br /&gt;
&lt;br /&gt;
The above is just a (very hackish) start. Feel free to modify, test and report back the changes/improvements you make. Have fun!&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7369</id>
		<title>GLSL Shaders</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=GLSL_Shaders&amp;diff=7369"/>
		<updated>2012-06-12T20:18:34Z</updated>

		<summary type="html">&lt;p&gt;Shiven: Created page with &amp;quot;= Introduction =  GLSL Shaders, shipped with PyMOL, may be modified to provide interesting and useful visual effects. The following modifications provide &amp;quot;Toon&amp;quot; shading effects, ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
GLSL Shaders, shipped with PyMOL, may be modified to provide interesting and useful visual effects. The following modifications provide &amp;quot;Toon&amp;quot; shading effects, in some ways similar to the illustrations by David Goodsell as seen in the RCSB/PDB &amp;quot;Molecule of the Month&amp;quot; series [http://www.rcsb.org/pdb/101/motm.do?momID=150].&lt;br /&gt;
&lt;br /&gt;
== Gallery ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Instructions =&lt;br /&gt;
&lt;br /&gt;
The fragment shaders have been modified for [[Cartoon]] and [[Spheres]] only as of now.&lt;br /&gt;
The PyMOL shaders directory is located under:&lt;br /&gt;
* &amp;quot;/Applications/MacPyMOL.app/pymol/data/shaders&amp;quot; on Mac OSX&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Spheres ==&lt;br /&gt;
&lt;br /&gt;
=== Sphere Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;sphere.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;shaders.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;shaders.fs&amp;quot; (using a text editor) in the same directory:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
// Sphere impostor fragment shader&lt;br /&gt;
&lt;br /&gt;
// Sphere Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform float ortho;&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform vec3 fog_color_top;&lt;br /&gt;
uniform vec3 fog_color_bottom;&lt;br /&gt;
uniform float inv_height;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
varying vec4 COLOR;&lt;br /&gt;
varying vec3 sphere_center;&lt;br /&gt;
varying float radius2;&lt;br /&gt;
varying vec3 point;&lt;br /&gt;
// varying fog;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(vec3 N, vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  //&lt;br /&gt;
  // Begin code for calculating the Sphere Outline&lt;br /&gt;
  //&lt;br /&gt;
  float spheredge = dot(N,L);&lt;br /&gt;
  float edgeweight = 1.025;&lt;br /&gt;
  float edgegain = 16.0;&lt;br /&gt;
  spheredge = edgeweight - (spheredge * spheredge);&lt;br /&gt;
  spheredge = 1.0 - pow(spheredge, shine * edgegain);&lt;br /&gt;
  diffuse = mix(diffuse, diffuse * spheredge, shine);&lt;br /&gt;
&lt;br /&gt;
  ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
  NdotL = dot(N, L);&lt;br /&gt;
  if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
    ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
    NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
    ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
  }&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main(void)&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_origin = mix(vec3(0.,0.,0.), point, ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 ray_direction = mix(normalize(point), vec3(0., 0., 1.), ortho);&lt;br /&gt;
&lt;br /&gt;
    vec3 sphere_direction = mix(sphere_center, ray_origin - sphere_center, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate sphere-ray intersection&lt;br /&gt;
    float b = dot(sphere_direction, ray_direction);&lt;br /&gt;
&lt;br /&gt;
    float position = b * b + radius2 - dot(sphere_direction, sphere_direction);&lt;br /&gt;
&lt;br /&gt;
    // Check if the ray missed the sphere&lt;br /&gt;
    if (position &amp;lt; 0.0)&lt;br /&gt;
       discard;&lt;br /&gt;
&lt;br /&gt;
    // Calculate nearest point of intersection&lt;br /&gt;
    float nearest = mix(b - sqrt(position), sqrt(position) - b, ortho);&lt;br /&gt;
&lt;br /&gt;
    // Calculate intersection point on the sphere surface.  The ray&lt;br /&gt;
    // origin is at the quad (center point), so we need to project&lt;br /&gt;
    // back towards the user to get the front face.&lt;br /&gt;
    vec3 ipoint = nearest * ray_direction + ray_origin;&lt;br /&gt;
&lt;br /&gt;
    // Calculate normal at the intersection point&lt;br /&gt;
    vec3 N = normalize(ipoint - sphere_center);&lt;br /&gt;
&lt;br /&gt;
    // Calculate depth in clipping space&lt;br /&gt;
    vec2 clipZW = ipoint.z * gl_ProjectionMatrix[2].zw +&lt;br /&gt;
        gl_ProjectionMatrix[3].zw;&lt;br /&gt;
&lt;br /&gt;
    float depth = 0.5 + 0.5 * clipZW.x / clipZW.y;&lt;br /&gt;
&lt;br /&gt;
    // this is a workaround necessary for Mac&lt;br /&gt;
    // otherwise the modified fragment wont clip properly&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;lt;= 0.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (depth &amp;gt;= 1.0)&lt;br /&gt;
      discard;&lt;br /&gt;
&lt;br /&gt;
    if (COLOR.a &amp;lt;= 1.0)&lt;br /&gt;
      gl_FragDepth = depth;&lt;br /&gt;
    else&lt;br /&gt;
      gl_FragDepth = 1.0;&lt;br /&gt;
&lt;br /&gt;
    vec4 color;&lt;br /&gt;
&lt;br /&gt;
    vec3 L0 = normalize(vec3(gl_LightSource[0].position) - ipoint);&lt;br /&gt;
&lt;br /&gt;
    float NdotL = max(dot(N, L0), 0.0);&lt;br /&gt;
&lt;br /&gt;
    float NdotH;&lt;br /&gt;
&lt;br /&gt;
    vec4 final_color = gl_LightModel.ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
    if (light_count&amp;gt;0){&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[0].ambient,&lt;br /&gt;
                                          gl_LightSource[0].diffuse,&lt;br /&gt;
                                          spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
    }}}}}}}}&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    int i;&lt;br /&gt;
    for (i=0; i&amp;lt;light_count; i++){&lt;br /&gt;
      vec3 L = normalize(gl_LightSource[i].position.xyz);&lt;br /&gt;
      vec3 H = normalize(gl_LightSource[i].halfVector.xyz);&lt;br /&gt;
      float spec = 0., shine = 0.;&lt;br /&gt;
      if (i==0){&lt;br /&gt;
        spec = spec_value_0;&lt;br /&gt;
        shine = shininess_0;&lt;br /&gt;
      } else if (spec_count &amp;gt;= i){&lt;br /&gt;
        spec = spec_value;&lt;br /&gt;
        shine = shininess;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      //      final_color += gl_LightSource[i].ambient * COLOR;&lt;br /&gt;
&lt;br /&gt;
      final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                          normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                          gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                          gl_LightSource[i].diffuse * COLOR,&lt;br /&gt;
                                          spec, shine);&lt;br /&gt;
&lt;br /&gt;
      NdotL = dot(N, L);&lt;br /&gt;
&lt;br /&gt;
      if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
&lt;br /&gt;
        //    final_color += gl_LightSource[i].diffuse * NdotL * COLOR;&lt;br /&gt;
&lt;br /&gt;
        final_color += ComputeColorForLight(N, normalize(vec3(gl_LightSource[i].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[i].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[i].ambient * COLOR,&lt;br /&gt;
                                            gl_LightSource[i].diffuse * COLOR * NdotL * 0.333,&lt;br /&gt;
                                            spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
        NdotH = max(dot(N, H), 0.0);&lt;br /&gt;
        final_color += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    float fog = clamp((gl_Fog.end + ipoint.z) * gl_Fog.scale, 0.0, 1.0);&lt;br /&gt;
    fog = mix(1.0, fog, fog_enabled);&lt;br /&gt;
    vec3 fog_color;&lt;br /&gt;
&lt;br /&gt;
    if (bg_gradient){&lt;br /&gt;
      fog_color = mix(fog_color_bottom, fog_color_top, gl_FragCoord.y * inv_height);&lt;br /&gt;
    } else {&lt;br /&gt;
      fog_color = fog_color_top;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    final_color.rgb = mix(fog_color, final_color.rgb, fog);&lt;br /&gt;
&lt;br /&gt;
    vec4 f = vec4(final_color.rgb, COLOR.a);&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Fake shadows based on depth&lt;br /&gt;
    //&lt;br /&gt;
    // vec4 f = vec4(final_color.rgb * ( 1.05 - gl_FragDepth), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sphere Testing PyMOL Script ===&lt;br /&gt;
Now test out the sphere shader by saving and running the following PyMOL script from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
show sphere, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set sphere_mode, 9&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
set_color carbons, [100, 225,90]&lt;br /&gt;
set_color others, [75, 100, 230]&lt;br /&gt;
util.cbaw 3V4K&lt;br /&gt;
set sphere_scale, 1.05&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.327029049,   -0.944887519,    0.015455140,\&lt;br /&gt;
     0.943798959,   -0.327394068,   -0.045230716,\&lt;br /&gt;
     0.047797613,   -0.000204348,    0.998857021,\&lt;br /&gt;
     0.000143192,   -0.000024423, -184.973327637,\&lt;br /&gt;
   -14.873787880,  -17.664234161,   35.063804626,\&lt;br /&gt;
   136.028396606,  233.926559448,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[-0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[-0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[-0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[ 0.0, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[ 0.2, 0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[ 0.2, 0.0,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[ 0.2,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[ 0.0,-0.2,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',10)&lt;br /&gt;
cmd.set('spec_count',-1)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[1.0, 1.0, 1.0])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== GLSL Toon Cartoons ==&lt;br /&gt;
&lt;br /&gt;
=== Cartoon Fragment Shader Code ===&lt;br /&gt;
Rename the &amp;quot;default_es2.fs&amp;quot; file in your PyMOL shaders directory to &amp;quot;default_es2.fs.bak&amp;quot; then copy and save the following into a new file called &amp;quot;default_es2.fs&amp;quot; (using a text editor) in the same directory: &lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
// Cartoon Toon Shading code modifications by Shivender Shandilya, 2012&lt;br /&gt;
&lt;br /&gt;
varying vec3 packed_data_0 ;&lt;br /&gt;
varying vec4 packed_data_1 ;&lt;br /&gt;
varying vec4 packed_data_2 ;&lt;br /&gt;
varying vec4 packed_data_3 ;&lt;br /&gt;
varying vec4 packed_data_4 ;&lt;br /&gt;
&lt;br /&gt;
//varying vec3 N;&lt;br /&gt;
#define NORMAL packed_data_0.xyz&lt;br /&gt;
#define COLOR packed_data_3&lt;br /&gt;
#define fog (packed_data_1.w )&lt;br /&gt;
#define fog_color packed_data_1.x, packed_data_1.y, packed_data_1.z&lt;br /&gt;
&lt;br /&gt;
uniform float fog_enabled;&lt;br /&gt;
&lt;br /&gt;
uniform bool lighting_enabled;&lt;br /&gt;
uniform bool two_sided_lighting_enabled;&lt;br /&gt;
uniform bool bg_gradient;&lt;br /&gt;
uniform int light_count;&lt;br /&gt;
uniform vec4 interior_color;&lt;br /&gt;
uniform float interior_color_threshold;&lt;br /&gt;
uniform float shininess;&lt;br /&gt;
uniform float shininess_0;&lt;br /&gt;
uniform bool use_interior_color_threshold;&lt;br /&gt;
uniform int spec_count;&lt;br /&gt;
uniform float spec_value;&lt;br /&gt;
uniform float spec_value_0;&lt;br /&gt;
uniform int stereo_flag;&lt;br /&gt;
uniform mat3 matR;&lt;br /&gt;
uniform mat3 matL;&lt;br /&gt;
uniform float gamma;&lt;br /&gt;
&lt;br /&gt;
vec4 ComputeColorForLight(bool is_interior, bool two_sided_lighting_enabled,&lt;br /&gt;
                          vec3 L, vec3 H, vec4 ambient, vec4 diffuse, float spec, float shine){&lt;br /&gt;
  float NdotL, NdotH;&lt;br /&gt;
  vec4 ret_val = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (!is_interior){&lt;br /&gt;
&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  if (two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
    //&lt;br /&gt;
    // Begin code for calculating the Cartoon Outline&lt;br /&gt;
    //&lt;br /&gt;
    float cartedge = dot(NORMAL, L);&lt;br /&gt;
    float edgeweight = 1.15;&lt;br /&gt;
    float edgegain = 16.0;&lt;br /&gt;
    cartedge = edgeweight - (cartedge * cartedge);&lt;br /&gt;
    cartedge = 1.0 - pow(cartedge, shine * edgegain);&lt;br /&gt;
    diffuse = mix(diffuse, diffuse * cartedge, shine);&lt;br /&gt;
&lt;br /&gt;
    ret_val += diffuse * COLOR;&lt;br /&gt;
&lt;br /&gt;
    NdotL = dot(-NORMAL, L);&lt;br /&gt;
&lt;br /&gt;
    if (NdotL &amp;gt; 0.0) {&lt;br /&gt;
       ret_val += diffuse * NdotL * COLOR;&lt;br /&gt;
       NdotH = max(dot(-NORMAL, H), 0.0);&lt;br /&gt;
       ret_val += spec * pow(NdotH, shine);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  return ret_val;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
  vec4 final_color = vec4(0.);&lt;br /&gt;
&lt;br /&gt;
  if (lighting_enabled){&lt;br /&gt;
    bool is_interior = false;&lt;br /&gt;
    if (use_interior_color_threshold){&lt;br /&gt;
      vec3 viewV = vec3(0.,0.,-1.);&lt;br /&gt;
      float dotp = dot(NORMAL, viewV);&lt;br /&gt;
      is_interior = ( dotp &amp;gt; interior_color_threshold );&lt;br /&gt;
    }&lt;br /&gt;
    if (!two_sided_lighting_enabled &amp;amp;&amp;amp; is_interior){&lt;br /&gt;
      final_color = interior_color;&lt;br /&gt;
    } else {&lt;br /&gt;
      final_color = (gl_LightModel.ambient) * COLOR;&lt;br /&gt;
&lt;br /&gt;
      if (light_count&amp;gt;0){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[0].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[0].ambient,&lt;br /&gt;
                                            gl_LightSource[0].diffuse,&lt;br /&gt;
                                            spec_value_0, shininess_0);&lt;br /&gt;
      if (light_count&amp;gt;1){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[1].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[1].ambient,&lt;br /&gt;
                                            gl_LightSource[1].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;2){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[2].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[2].ambient,&lt;br /&gt;
                                            gl_LightSource[2].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;3){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[3].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[3].ambient,&lt;br /&gt;
                                            gl_LightSource[3].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;4){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[4].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[4].ambient,&lt;br /&gt;
                                            gl_LightSource[4].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;5){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[5].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[5].ambient,&lt;br /&gt;
                                            gl_LightSource[5].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;6){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[6].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[6].ambient,&lt;br /&gt;
                                            gl_LightSource[6].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      if (light_count&amp;gt;7){&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled,&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].position)),&lt;br /&gt;
                                            normalize(vec3(gl_LightSource[7].halfVector.xyz)),&lt;br /&gt;
                                            gl_LightSource[7].ambient,&lt;br /&gt;
                                            gl_LightSource[7].diffuse,&lt;br /&gt;
                                            spec_value, shininess);&lt;br /&gt;
      }}}}}}}}&lt;br /&gt;
    }&lt;br /&gt;
/*&lt;br /&gt;
      for (i=0; i&amp;lt;light_count;i++){&lt;br /&gt;
        vec3 L = normalize(vec3(gl_LightSource[i].position));&lt;br /&gt;
        vec3 H = normalize(vec3(gl_LightSource[i].halfVector.xyz));&lt;br /&gt;
        vec4 ambient = gl_LightSource[i].ambient;&lt;br /&gt;
        vec4 diffuse = gl_LightSource[i].diffuse;&lt;br /&gt;
        float spec = 0., shine = 0.;&lt;br /&gt;
        if (i==0){&lt;br /&gt;
          spec = spec_value_0;&lt;br /&gt;
          shine = shininess_0;&lt;br /&gt;
        } else if (spec_count &amp;gt;= i){&lt;br /&gt;
          spec = spec_value;&lt;br /&gt;
          shine = shininess;&lt;br /&gt;
        }&lt;br /&gt;
        final_color += ComputeColorForLight(is_interior, two_sided_lighting_enabled, L, H, ambient, diffuse, spec, shine);&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
*/&lt;br /&gt;
  } else {&lt;br /&gt;
    final_color = COLOR;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  float cfog = mix(1.0, clamp(fog, 0.0, 1.0), fog_enabled);&lt;br /&gt;
&lt;br /&gt;
  vec4 f = vec4(mix(vec3(fog_color), final_color.rgb, cfog), COLOR.a);&lt;br /&gt;
&lt;br /&gt;
  if(stereo_flag==-1)&lt;br /&gt;
    gl_FragColor = vec4(matL * pow(f.rgb,vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
  else if (stereo_flag==0)&lt;br /&gt;
    gl_FragColor = f;&lt;br /&gt;
  else if (stereo_flag==1)&lt;br /&gt;
    gl_FragColor = vec4(matR * pow(f.rgb, vec3(gamma,gamma,gamma)), f.a);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
=== Cartoon Testing PyMOL Script ===&lt;br /&gt;
Now test out the cartoon shader by saving and running the following PyMOL script from the &amp;quot;File &amp;gt; Run&amp;quot; menu:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
fetch 3V4K, async=0&lt;br /&gt;
hide all&lt;br /&gt;
show cartoon, all&lt;br /&gt;
select solv, solvent&lt;br /&gt;
remove solv&lt;br /&gt;
delete solv&lt;br /&gt;
remove e. H&lt;br /&gt;
set ambient, 0.25&lt;br /&gt;
color brown, 3V4K&lt;br /&gt;
set orthoscopic, 1&lt;br /&gt;
&lt;br /&gt;
set cartoon_dumbbell_length, 0.85&lt;br /&gt;
set cartoon_dumbbell_radius, 0.15&lt;br /&gt;
set cartoon_dumbbell_width, 0.15&lt;br /&gt;
set cartoon_fancy_helices, on&lt;br /&gt;
&lt;br /&gt;
set cartoon_rect_length, 0.85&lt;br /&gt;
set cartoon_rect_width, 0.15&lt;br /&gt;
&lt;br /&gt;
set cartoon_loop_radius, 0.15&lt;br /&gt;
&lt;br /&gt;
set_view (\&lt;br /&gt;
    -0.811935484,    0.547164500,   -0.203404382,\&lt;br /&gt;
     0.385375530,    0.240704626,   -0.890811384,\&lt;br /&gt;
    -0.438461006,   -0.801668167,   -0.406299770,\&lt;br /&gt;
     0.000018395,    0.000004439,  -80.686973572,\&lt;br /&gt;
   -14.601868629,   -7.145599365,   10.938076973,\&lt;br /&gt;
    26.767528534,  134.606826782,   20.000000000 )&lt;br /&gt;
&lt;br /&gt;
cmd.set('light_count',9)&lt;br /&gt;
cmd.set(&amp;quot;light&amp;quot; ,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light2&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light3&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light4&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light5&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light6&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light7&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light8&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
cmd.set(&amp;quot;light9&amp;quot;,&amp;quot;[0.9,0.9,-1.0]&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.set('ambient',0.15)&lt;br /&gt;
cmd.set('direct',0.10)&lt;br /&gt;
cmd.set('reflect',0.80)&lt;br /&gt;
cmd.set('shininess',0)&lt;br /&gt;
cmd.set('spec_count',0)&lt;br /&gt;
cmd.set('power',1.0)&lt;br /&gt;
cmd.set('specular_intensity',0)&lt;br /&gt;
cmd.set('spec_direct',0.0)&lt;br /&gt;
cmd.set('ray_shadow_decay_factor',0.1)&lt;br /&gt;
cmd.set('ray_shadow_decay_range',5.0)&lt;br /&gt;
cmd.set('bg_rgb',[0.75, 0.75, 0.75])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
viewport 1024, 768&lt;br /&gt;
draw 1024, 768, 8&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Epilogue =&lt;br /&gt;
&lt;br /&gt;
The above is just a (very hackish) start. Feel free to modify, test and report back the changes/improvements you make. Have fun!&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Talk:ColorByDisplacement&amp;diff=40</id>
		<title>Talk:ColorByDisplacement</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Talk:ColorByDisplacement&amp;diff=40"/>
		<updated>2011-01-19T02:10:58Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This looks cool.  It seems you forgot to post the code for the functions:&lt;br /&gt;
:: * ColorByDisplacementCA&lt;br /&gt;
:: * ColorByDisplacementAll&lt;br /&gt;
&lt;br /&gt;
[[User:Inchoate|Tree]] 23:42, 4 January 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Great job Troels!&lt;br /&gt;
&lt;br /&gt;
[[User:Shiven|shiven]] 02:10, 19 January 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Talk:ColorByDisplacement&amp;diff=39</id>
		<title>Talk:ColorByDisplacement</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Talk:ColorByDisplacement&amp;diff=39"/>
		<updated>2011-01-19T02:10:26Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This looks cool.  It seems you forgot to post the code for the functions:&lt;br /&gt;
:: * ColorByDisplacementCA&lt;br /&gt;
:: * ColorByDisplacementAll&lt;br /&gt;
&lt;br /&gt;
[[User:Inchoate|Tree]] 23:42, 4 January 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Great job Troels!&lt;br /&gt;
&lt;br /&gt;
--[[User:Shiven|shiven]] 02:10, 19 January 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Ideas&amp;diff=11794</id>
		<title>Ideas</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Ideas&amp;diff=11794"/>
		<updated>2009-12-22T23:53:59Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Ideas for PyMOL Development ===&lt;br /&gt;
&lt;br /&gt;
This page was originally developed for the 2008 Google Summer of Code competition, but seeing as PyMOL wasn't selected, this page can instead serve as a resource for ongoing PyMOL development efforts.&lt;br /&gt;
&lt;br /&gt;
== Where to Start ==&lt;br /&gt;
&lt;br /&gt;
Always start with Python and only delve down into the C code when absolutely necessary.  Although PyMOL is mostly a C-based application, much of the that code is opaque, fragile, and unforgiving. Although C code refactoring is an important project goal, such work may not be ideal for GSoC-type efforts since once mistake could potentially to destabilize the entire platform. &lt;br /&gt;
&lt;br /&gt;
Fortunately, the Python interpreter and the PyMOL command and selection languages make it possible to extend PyMOL safely and quickly.  Even when performance is critical, Python should be the interface between external C, C++, and Java code and PyMOL's internal C data structures.&lt;br /&gt;
&lt;br /&gt;
== Choosing a Topic ==&lt;br /&gt;
&lt;br /&gt;
The best open-source code is usually written by an end-users attempting to meet their own pressing needs.  So if you have already have a specific need which relates to PyMOL, then we strongly encourage you to follow up on that first!&lt;br /&gt;
&lt;br /&gt;
If you are looking for ideas,  then try to seek out enhancements and/or integrations that will impact the largest potential user base.  For example, imagine what new things might be useful to virtually all medicinal chemists, all structural biologists, all movie-makers, all paper-writers, and so forth.&lt;br /&gt;
&lt;br /&gt;
The ideas below are organized by category.  Right now, integration with other open-source projects seems like the approach most likely to yield significant benefit, so those ideas are first.&lt;br /&gt;
&lt;br /&gt;
== Integration Ideas (Linking Out to Useful Open-Source Tools) ==&lt;br /&gt;
&lt;br /&gt;
In most cases, depending on the need, integration can be accomplished through standalone Python scripts, through new PyMOL commands, through PyMOL Wizards, or via Tkinter plugins.&lt;br /&gt;
&lt;br /&gt;
* APBS (electrostatics calculations):  Improve the existing plugin. Michael Lerner is currently leading this effort.  See [[APBS]]&lt;br /&gt;
* RDKit (cheminformatics, depiction, UFF cleanup, etc.):  Lots of potential here, however C++ coding may be necessary for more advanced integration tasks. [http://www.rdkit.org RDKit home]&lt;br /&gt;
* &amp;lt;strike&amp;gt;mengine (MMFF small molecule cleanup): work is in progress (Delsci).&amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;mpeg_encode (MPEG movie production on Linux, etc.):  work is in progress (Delsci).&amp;lt;/strike&amp;gt;&lt;br /&gt;
* GIMP (image manipulation):  Streamline &amp;amp; document the process of exporting images from PyMOL into GIMP and preparing them for submission to scientific Journals.&lt;br /&gt;
* &amp;lt;strike&amp;gt;Blender (general-purpose 3D modeling &amp;amp; animation): Streamline &amp;amp; document the process of getting molecular geometry out of PyMOL and into Blender.&amp;lt;/strike&amp;gt; http://pymolwiki.org/index.php/Blender&lt;br /&gt;
* Jmol (publishing visualizations inside of web pages): Liason between PyMOL &amp;amp; Jmol projects to develop a shared molecular visualization data model compatible with both applications.&lt;br /&gt;
* Firefox (plugin): Develop an PyMOL plugin compatible with Firefox.&lt;br /&gt;
* MMTK (molecular mechanics -- Python/flexible):  Develop the ability to round-trip molecular systems from PyMOL, into MMTK, and back.&lt;br /&gt;
* GROMACS (molecular mechanics -- C/fast) - Maybe some ideas can be shared with this guy. [http://www.kde-apps.org/content/show.php/Gromacs+GUI+?content=47665 Gromacs GUI]&lt;br /&gt;
* OpenOffice (escape Microsoft hegemony): Develop an PyMOL plugin.&lt;br /&gt;
* IPython integration (interactive shell): a robust alternative to the PyMOL command line?&lt;br /&gt;
* R (statistics): PyMOL a 3D viewer environment for visualizating &amp;amp; manipulating large statistical data sets?&lt;br /&gt;
&lt;br /&gt;
Are there other key open-source packages we might specifically target for integration with PyMOL, either through GSoC or beyond?&lt;br /&gt;
&lt;br /&gt;
== High-Level Enhancement Ideas (Mostly Python-oriented) ==&lt;br /&gt;
&lt;br /&gt;
* Work on [[#More Ideas (Please add your own!)| MolViz]]&lt;br /&gt;
* Develop new plugins which automate routine tasks.&lt;br /&gt;
* Improve the Python API documentation.&lt;br /&gt;
* Flesh out the new &amp;quot;from pymol2 import PyMOL&amp;quot; instance-based PyMOL API.&lt;br /&gt;
* Develop alternate Tkinter &amp;quot;skins&amp;quot; (for custom OEM-like applications).&lt;br /&gt;
* Develop a Tkinter/TOGL widget which holds a PyMOL viewer instance.&lt;br /&gt;
* Develop a PyQt widget which holds a PyMOL viewer instance.&lt;br /&gt;
* Create a plugin-manager GUI in the style of Firefox, Rythmbox, Gedit, Eclipse. A GUI where it is easy to turn off/on plugins, configure them and see help-contents for them. Maybe also some way to paste a url to install a new Plugin.&lt;br /&gt;
* Add a plugin for a GUI window with the same functionality as the &amp;quot;Control Panel&amp;quot; window in SwissPDB Viewer.&lt;br /&gt;
* Extend and modify the PyMOL command language so as to be compatible with existing RasMol and/or Jmol scripts.&lt;br /&gt;
* Enhance the Mutagenesis Wizard in order to support Nucleic acids and/or Sugars.&lt;br /&gt;
* Streamline the process of creating movies out of Scenes.&lt;br /&gt;
&lt;br /&gt;
== Low-Level Enhancement Ideas (Mostly C-oriented) ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strike&amp;gt;Provide a &amp;quot;split&amp;quot; view with multiple molecules each in their own pane (already partially implemented).&amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;Add a movie slider similar to that found in Maya, Cinema4D, 3DSMax.&amp;lt;/strike&amp;gt;&lt;br /&gt;
* Enable editing of displayed sequence alignments.&lt;br /&gt;
* Add multi-line textual annotations&lt;br /&gt;
* Support additional annotation object including: arrow, lines, and blobs.&lt;br /&gt;
* Add display of secondary structure into the sequence viewer.&lt;br /&gt;
* Enable per-object Z clipping (especially in the ray tracer)&lt;br /&gt;
* Hilite H-bonds, salt bridges, Pi-stacking, Pi-cations, etc.&lt;br /&gt;
* Build in a simple forcefield and energy minimizer suitable for use with Mutagenesis.&lt;br /&gt;
* &amp;lt;strike&amp;gt;Improve the ability to animate objects independently when creating movies.&amp;lt;/strike&amp;gt;&lt;br /&gt;
* Incorporate a suite of standard NMR visualizations (restraint violations, per-residue RMS, etc.)&lt;br /&gt;
* Enumeration and display of low-energy conformers.&lt;br /&gt;
* Automated structure grafting (poor-man's homology modeling).&lt;br /&gt;
* Import of alignment files.&lt;br /&gt;
* Implement IMD (Interactive Molecular Dynamics) Interface, see http://www.ks.uiuc.edu/Research/vmd/imd/&lt;br /&gt;
&lt;br /&gt;
== Difficult C-level Code Refactoring Ideas ==&lt;br /&gt;
&lt;br /&gt;
* Assemble a test suite which thoroughly exercises the existing code (a prerequisite to major refactoring).&lt;br /&gt;
* Catch &amp;amp; handle memory-allocation failures gracefully (instead of crashing).&lt;br /&gt;
* Replace PyMOL's memory management &amp;amp; custom containers with a simple runtime object model.&lt;br /&gt;
* Separate the View and the Controllers from the Model so that they can all run asynchronously (on multiple cores).&lt;br /&gt;
* Enable generalized undo of changes made to the Model.&lt;br /&gt;
* Clean up the internal matrix handling code.&lt;br /&gt;
&lt;br /&gt;
== Ideas Involving Proprietary APIs ==&lt;br /&gt;
&lt;br /&gt;
Since these involve closed-source APIs and infrastructure, they aren't suitable for open-source development efforts.  However, such requests are noted here for the sake of complete coverage.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strike&amp;gt;Build an ActiveX Control for PowerPoint and/or Internet Explorer (work is in progress - Delsci)&amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;Support direct export of Windows Media files (AVI movies).&amp;lt;/strike&amp;gt;&lt;br /&gt;
* Create a Windows port with &amp;quot;native&amp;quot; look &amp;amp; feel. &amp;lt;- Could this be done in PyQT or PyGTK?. Then it would look &amp;quot;native&amp;quot;, but be cross-platform and not proprietary.&lt;br /&gt;
* Integrate directly via Mathematica via MathLink.&lt;br /&gt;
* Further enhance JyMOL (Java-JNI/wrapped PyMOL)&lt;br /&gt;
* Integrate with Matlab.&lt;br /&gt;
&lt;br /&gt;
== More Ideas (Please add your own!) ==&lt;br /&gt;
* [http://molviz.cs.toronto.edu/molviz MolViz] is a project to incorporate head tracking input into [http://pymol.sourceforge.net/ PyMol]. This is accomplished through a [[ImmersiveViz]] script written in Python to control the molecule's position using the existing [http://www.pymolwiki.org/index.php/Category:Commands PyMol API]. Related projects would include:&lt;br /&gt;
** Improving the existing [[ImmersiveViz]] PyMol plugin for more precise control of the environment.&lt;br /&gt;
** Developing new input drivers for the Wiimote form of control. This would require some bluetooth hacking.&lt;br /&gt;
** Implementing some other forms of input for head tracking, such as fisheye head tracking, IR webcam tracking, etc (refer to the end of this [[http://www.youtube.com/watch?v=ncShaY4VSac video]] for a better description).&lt;br /&gt;
* Provide a 2D chemical depiction of the current 3D view.&lt;br /&gt;
* Spreadsheet view with additional information (e.g. IC50's).&lt;br /&gt;
* Create additional documentation, screen casts, &amp;amp; tutorials.&lt;br /&gt;
* Export 3D PDF images.&lt;br /&gt;
* &amp;lt;strike&amp;gt;Add extra &amp;quot;Single Word Selectors&amp;quot; like &amp;quot;nucleic&amp;quot;, &amp;quot;protein&amp;quot;, &amp;quot;water&amp;quot;, &amp;quot;ions&amp;quot;, &amp;quot;backbone&amp;quot; (for nucleic acids or proteins), &amp;quot;mainchain&amp;quot;, &amp;quot;sidechain&amp;quot;&amp;lt;/strike&amp;gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Category:FAQ&amp;diff=4025</id>
		<title>Category:FAQ</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Category:FAQ&amp;diff=4025"/>
		<updated>2009-12-22T23:51:58Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overview==&lt;br /&gt;
Please post your FAQs here.  I suggest you write a Q&amp;amp;A style list with a short answer.  More involved answers should link to its own page.  Just my suggestion.  Should we have topics?  Please note, not all AQ are FAQ.  Also, many answers to frequently recurring problems are probably best sought by searching for your terms in the Wiki.&lt;br /&gt;
&lt;br /&gt;
===Installation===&lt;br /&gt;
Q: I've installed PyMol_0_98, and recently my structures have stopped displaying. I've tried uninstalling PyMol_0_98 and installing PyMol_0_97, and yet i've ran into the same problem...my .pdb files no longer display, although it is evident that they are being loaded and I can edit them.&lt;br /&gt;
&lt;br /&gt;
Does anybody have any clue as to what might be the problem?&lt;br /&gt;
Thanks, shebsmehr&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
===Startup===&lt;br /&gt;
Q: I've installed PyMol_0_98 correctly but I can't open my files in .mol2 or .pdb format from the menubar. Instead I can open them with the program. I can't even save the images I create in PyMol and obviously the mivie too.&lt;br /&gt;
&lt;br /&gt;
Could you help me to solve these problems.&lt;br /&gt;
Thanks&lt;br /&gt;
Vittorio&lt;br /&gt;
&lt;br /&gt;
A1: Vittorio, if I understand you correctly, then you need to (a) make sure you have the PDB file on your machine, say Desktop (or home directory, for *nix), then in the GUI click on, &amp;quot;File&amp;quot;-&amp;gt;&amp;quot;Open&amp;quot; then use the dialog to find the file you want to load.  You can save time if you know where the file is by just using PyMol's &amp;quot;load&amp;quot; command&lt;br /&gt;
 load fileName, objectName&lt;br /&gt;
loads the fileName into a new object called objectName, for example,&lt;br /&gt;
 load /tmp/1ggz.pdb, 1ggz&lt;br /&gt;
&lt;br /&gt;
See [[Cmd load|load]], &lt;br /&gt;
&lt;br /&gt;
A2: To save images you have a couple options.  First, to save a quick raw screen dump type, &amp;quot;png fileName&amp;quot; to save a PNG image (IE and other programs can view these files).  Or, secondly, if you prefer a higher quality image with ray-traced shadows and textures you can do, &amp;quot;ray&amp;quot; then, the above &amp;quot;png&amp;quot; command.&lt;br /&gt;
&lt;br /&gt;
See [[Cmd ray|ray]], [[Cmd png|png]], [[:Category:Using_Pymol|Using PyMol]]&lt;br /&gt;
&lt;br /&gt;
Hope this helps.  If it didn't please restate your question to make it more clear.&lt;br /&gt;
----&lt;br /&gt;
Q: Hi I have a problem. For some reason PyMOl do not display certain areas (several loops) of my .pdb file (1DAN) when in cartoon. When I display the structure in &amp;quot;lines&amp;quot; or &amp;quot;sticks&amp;quot; everything is ok. Furthermore, other .pdb viewers dont have this problem. I have tried several things:&lt;br /&gt;
1. Upgraded to the newest version og PyMol.&lt;br /&gt;
2. Redefined secondary structure using the &amp;quot;alter command&amp;quot;.&lt;br /&gt;
3. Imported the .pdb file into SwissViewer, saved as the imported structure as a .pdb file, and then imported into PyMOl.&lt;br /&gt;
&lt;br /&gt;
None of these things have solved the problem. Help please! (I would hate to have to start using another pdb-viewer!!)&lt;br /&gt;
Cheers&lt;br /&gt;
Kasper&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Q: Can the startup settings be edited so that MacPyMol starts with a One-Button Mouse mode? Please advise.&lt;br /&gt;
A: echo &amp;quot;config_mouse one_button&amp;quot; &amp;gt;&amp;gt; ~/.pymolrc&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Q: What I should write into the .pymolrc (Mandriva Linux) to be able open PyMol with .pdb or .pml from shell? I was able to run pymol *.pdb with old 0.99rc6 version, but then I upgraded Mandriva Linux and this option is not working anymore.&lt;br /&gt;
&lt;br /&gt;
===Settings===&lt;br /&gt;
Q: I am wondering how to change the default settings for a color &amp;quot;spectrum&amp;quot;. I would like to color by b-factor but not with the default spectrum but from white-to-red.&lt;br /&gt;
&lt;br /&gt;
A: See [[Color#Color_by_Spectrum_Example]].&lt;br /&gt;
----&lt;br /&gt;
Q: I would like the distance labels generated with the 'distance' command to be single-digit only, e.g. 2.8 instead of 2.77. How can I do this? Thanks, MindFrog&lt;br /&gt;
&lt;br /&gt;
A: Setting startup settings and python commands can be done in a file: ~/.pymolrc&lt;br /&gt;
E.g. command in there: cmd.set('label_distance_digits',1)&lt;br /&gt;
On my windows machine this is in C:\Documents and Settings\jurgen.WHELK.000\.pymolrc&lt;br /&gt;
===Commands===&lt;br /&gt;
Q: I want to move one object while keeping another fixed. How do I do this?&lt;br /&gt;
&lt;br /&gt;
A: Load the proteins as separate objects, put the mouse into 3-button editing mode, then shift-middle click-and-drag on the molecule to translate and shift-left-click-and-drag to rotate. (Warren DeLano answer)&lt;br /&gt;
----&lt;br /&gt;
Q: I'd like to select residues that are in contact with a surface, or else be able to select buried/non-buried residues, is there any way to do this ? [[User:Xevi|Xevi]] 03:52, 16 Jun 2006 (CDT)&lt;br /&gt;
: I'm also looking for this (e.g. to see available lysines' -NH2 or cysteines' -SH on the surface), could one maybe cover the protein with an additional layer of new atoms, and then select all protein atoms close to these? Edit: there is now a simple solution for proteins displayed as non-transparent surfaces: [[Displaying_Biochemical_Properties#Residues_with_functional_groups]]  -- [[User:Moino|moino]] 19:35, 7 October 2008 (CDT)&lt;br /&gt;
----&lt;br /&gt;
Q: After using the usual mset command to rotate an object, states/frames are loaded into that object.  However, using the &amp;quot;frame&amp;quot; command has odd behaviour (in comparison to loading a molecular dynamics trajectory into the state in which the &amp;quot;frame&amp;quot; command behaves normally).  Can anyone explain this?&lt;br /&gt;
&lt;br /&gt;
See [[MovieSchool]] for more help.  There, frames, states and scenes are more clearly defined.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Q: How do I suppress the 'ExecutiveRMS' output while running cmd.pair_fit()?&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Q: How does cmd.rms() choose a mapping between atoms in the selections?  Exhaustive search over all possibilities?&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Q: How do I select (especially, iterate through a set of) bonds?  The existence of [http://www.pymolwiki.org/index.php/Cycle_Valence cycle valence] seems to imply that it can be done.  Is this possible via the API?&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Export/Import===&lt;br /&gt;
Q: Is there any way to export PyMol models onto CAD standards (autocad, archicad) or 3D modeling software (blender, 3DStudio, Maya)? Thanks a lot.&lt;br /&gt;
&lt;br /&gt;
A: Blender import is working. Please see: http://pymolwiki.org/index.php/Blender&lt;br /&gt;
----&lt;br /&gt;
Q: I am doing some MD simulations using CHARMM (not AMBER) and would like to visualize the .dcd files output by CHARMM.  I understand that PyMol can open .trj files from AMBER but is there a way to open up these .dcd files and if not, are there any plans to implement this?  Thank you for your time!&lt;br /&gt;
&lt;br /&gt;
A: Answering my own question here.  See: [[Load_Traj]]&lt;br /&gt;
&lt;br /&gt;
===Others===&lt;br /&gt;
Q: I was wondering what the percentage given under the mutengensis wizard means?   Thanks...&lt;br /&gt;
----&lt;br /&gt;
Q: Some of the bases in RNA helices are missing (not all in any given helix) when I am showing them in the CARTOON mode. How should I set it to get them shown? I tried the Secondary Structure Assignment commands, they did not work.&lt;br /&gt;
&lt;br /&gt;
A: See [[:Category:Nucleic_Acids]] for some ideas.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Q: Why does PyMol run version 2.3 of Python when I have Python 2.5 installed?  How do I tell it to switch?&lt;br /&gt;
&lt;br /&gt;
A: PyMOL runs on the older version of Python because it is known to work with the given feature set.  You can easily upgrade to Python2.4--Python2.6 with newer PYMOLs, or you can run any version of Python by compiling your own source.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Q: How do I cite PyMOL?&lt;br /&gt;
&lt;br /&gt;
A: DeLano, W.L. The PyMOL Molecular Graphics System. (2008) DeLano Scientific LLC, Palo Alto, CA, USA. http://www.pymol.org&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Q:  What is the status of the VMD plugin for Pymol?  How does one install it?  Is it installed by default?  Will it appear in the plugins list?  I compiled from source and changed several configuration files, but I cant't seem to be able to get the VMD plugins working properly.  Thanks!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Q: If I want to ask a question to the PyMol Wiki community, how do I do that?  Is there a page for PyMol usage questions?&lt;br /&gt;
&lt;br /&gt;
A: That's a very good question.  I will try to find a local 'forum' or page or something like that for discussion.&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Blender&amp;diff=6491</id>
		<title>Blender</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Blender&amp;diff=6491"/>
		<updated>2009-12-22T18:10:58Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table style=&amp;quot;border: 1px solid rgb(255, 204, 0); padding: 5px; background: rgb(255, 253, 223) none repeat scroll 0% 0%; text-align: center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 100%; margin-bottom: 0.2em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;HELP! : &amp;lt;/b&amp;gt; Fellow Blenderheads please help improve this page!!!&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.&lt;br /&gt;
&lt;br /&gt;
Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Representative examples. Please change/improve.&lt;br /&gt;
&lt;br /&gt;
=== 1. Translucent Surfaces ===&lt;br /&gt;
High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.&lt;br /&gt;
&lt;br /&gt;
* '''Step 1'''&lt;br /&gt;
Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to &amp;quot;3IQS_cartoon&amp;quot; and &amp;quot;3IQS_surface&amp;quot; as shown in the image below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr01.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 2'''&lt;br /&gt;
Turn off the display of &amp;quot;3IQS_surface&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr02.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 3'''&lt;br /&gt;
Save the displayed &amp;quot;3IQS_cartoon&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr03.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 4'''&lt;br /&gt;
Hide the &amp;quot;3IQS_cartoon&amp;quot; and display the &amp;quot;3IQS_surface&amp;quot;. Again, save the displayed &amp;quot;3IQS_surface&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr04.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 5'''&lt;br /&gt;
Start Blender (please see link in the Introduction to download and install). Assuming you are looking at the default scene and window layout, press '''7''' on '''numeric keypad''' and the view should change similar to the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr05.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Now select the '''cube''' in the center of the screen by '''right clicking''' on it and then press '''ctrl-x''' to delete it. This will give you a clean scene to import the protein structure you just exported from PyMOL as VRML 2 (.wrl).&lt;br /&gt;
&lt;br /&gt;
* '''Step 6'''&lt;br /&gt;
Now import the &amp;quot;3IQS_cartoon&amp;quot; into Blender by going to &amp;quot;File &amp;gt; Import &amp;gt; X3D &amp;amp; VRML97&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr06.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 7'''&lt;br /&gt;
Navigate to the folder where you exported the VRML 2 files from PyMOL and select the &amp;quot;3IQS_cartoon&amp;quot; file, thusly:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr07.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Import X3D/VRML97&amp;quot; button after selecting the correct file and just click &amp;quot;OK&amp;quot; on the dialog that comes up.&lt;br /&gt;
&lt;br /&gt;
* '''Step 8'''&lt;br /&gt;
Doing the above should result in a display such as the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr08.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 9'''&lt;br /&gt;
Now you need to select the just imported cartoon and just that only, so '''right click''' on it so that it is the only object selected in the view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr09.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 10'''&lt;br /&gt;
With the cartoon object selected, hit the '''Tab'' key on your keyboard to enter into &amp;quot;Edit mode&amp;quot; in Blender. All the vertices  that make up this object will be selected and colored yellow, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr10.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 11'''&lt;br /&gt;
Now click on &amp;quot;Mesh &amp;gt; Vertices &amp;gt; Remove Doubles&amp;quot; in Blender to get rid of duplicate vertices, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr11.png|center|350px]]&lt;br /&gt;
[[Image:Scr12.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 12'''&lt;br /&gt;
Now hit the '''Tab'' key again, to exit the &amp;quot;Edit mode&amp;quot; to see a nice smooth cartoon object:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr13.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 13'''&lt;br /&gt;
This cartoon is too big to be visible in the Blender's camera viewport while rendering, so we need to scale it down by hitting the &amp;quot;S&amp;quot; key once, then moving the mouse so that the object becomes smaller in size and then clicking the left mouse button to accept the new size:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr14.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
The final size should be small enough to completely fit in the &amp;quot;Camera view&amp;quot; in Blender. You can enter the &amp;quot;Camera view&amp;quot; by hitting the zero '''0''' key on the '''numeric keypad'''. Scale the object so that it fits within the camera boundaries:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr15.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 14'''&lt;br /&gt;
Now import the &amp;quot;3IQS_surface&amp;quot; VRML 2 file and process it the same way (steps 6 to 13):&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' You may hold off doing &amp;quot;Step 13&amp;quot;, the scaling, until you have imported and processed all objects that you exported from PyMOL. It is best to import and process all the objects and then scale them together to maintain the same scaling ratio for all. You can select multiple objects in blender by holding down the '''Shift''' key while right-clicking on individual objects.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr16.png|center|350px]]&lt;br /&gt;
[[Image:Scr17.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 15'''&lt;br /&gt;
In order to assign different colors (&amp;quot;materials&amp;quot; in Blender-speak) to each object, it is easier to go to camera view (num-pad 0), toggle into &amp;quot;wireframe view&amp;quot; ('''Z''' key) and select an object by right-clicking with the mouse. In the following image, the &amp;quot;3IQS_cartoon&amp;quot; is selected in the wireframe view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr18.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 16'''&lt;br /&gt;
Now select the &amp;quot;3IQS_surface&amp;quot; and toggle back into &amp;quot;solid view&amp;quot; mode ('''Z''' key). Make sure the two buttons with spherical icons are clicked in the bottom panel and the click on the color pad next to the &amp;quot;Col&amp;quot; button to bring up the color selector. You may select any color, in this example a greenish color is asigned.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr19.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 17'''&lt;br /&gt;
In order to make the surface translucent and have short rendering times, it is easiest to change the Z-transparency of the surface by clicking the '''Z-transp''' button on the panel, followed by changing the '''A''' (or alpha) value to below 1.0, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr20.png|center|350px]]&lt;br /&gt;
[[Image:Scr21.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 18'''&lt;br /&gt;
You may similarly select the just the cartoon object and assign it another &amp;quot;material&amp;quot;/color. To render the scene, hit the '''F12''' key on you keyboard, this will render the image in a new &amp;quot;render&amp;quot; window. You can then save the rendered image by hitting '''F3''' key in the render window and then specifying a location and filename.&lt;br /&gt;
&lt;br /&gt;
[[Image:3IQS_final.png|center|500px]]&lt;br /&gt;
&lt;br /&gt;
Play with other parameters and use the Blender manual/wiki to learn more about this awesome complement to PyMOL.&lt;br /&gt;
&lt;br /&gt;
To get you started, here is the final Blender (.blend) file: [[File:3IQS_example.blend.bz2]]&lt;br /&gt;
You'll need to use a program like bunzip2 (Linux) or 7-zip (Windows) to uncompress it first.&lt;br /&gt;
&lt;br /&gt;
== Why Blender? ==&lt;br /&gt;
&lt;br /&gt;
* Blender is FREE (as in beer)&lt;br /&gt;
* Blender is Open Source and therefore FREE (as in freedom)&lt;br /&gt;
* Blender is an extremely capable 3D graphics program and perhaps the only FOSS program capable of taking on similar commercial software head-to-head (Maya/Max/Modo etc.)&lt;br /&gt;
* To see some examples of what Blender can do check out:&lt;br /&gt;
** http://www.elephantsdream.org/&lt;br /&gt;
** http://www.bigbuckbunny.org/&lt;br /&gt;
** http://www.yofrankie.org/&lt;br /&gt;
&lt;br /&gt;
== Blender Help ==&lt;br /&gt;
Blender is a perfect complement to PyMOL for creating high quality images and animation, but has a pretty steep learning curve. The following are a few resources that may be of help along the way:&lt;br /&gt;
&lt;br /&gt;
* http://www.blender.org/education-help/&lt;br /&gt;
* http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Beginner_Tutorials&lt;br /&gt;
* http://forums.cgsociety.org/forumdisplay.php?f=91&lt;br /&gt;
* http://blenderartists.org/forum/&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Blender : http://www.blender.org/&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Blender&amp;diff=6490</id>
		<title>Blender</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Blender&amp;diff=6490"/>
		<updated>2009-12-22T18:09:33Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table style=&amp;quot;border: 1px solid rgb(255, 204, 0); padding: 5px; background: rgb(255, 253, 223) none repeat scroll 0% 0%; text-align: center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 100%; margin-bottom: 0.2em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;HELP! : &amp;lt;/b&amp;gt; Fellow Blenderheads please help improve this page!!!&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.&lt;br /&gt;
&lt;br /&gt;
Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Representative examples. Please change/improve.&lt;br /&gt;
&lt;br /&gt;
=== 1. Translucent Surfaces ===&lt;br /&gt;
High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.&lt;br /&gt;
&lt;br /&gt;
* '''Step 1'''&lt;br /&gt;
Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to &amp;quot;3IQS_cartoon&amp;quot; and &amp;quot;3IQS_surface&amp;quot; as shown in the image below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr01.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 2'''&lt;br /&gt;
Turn off the display of &amp;quot;3IQS_surface&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr02.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 3'''&lt;br /&gt;
Save the displayed &amp;quot;3IQS_cartoon&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr03.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 4'''&lt;br /&gt;
Hide the &amp;quot;3IQS_cartoon&amp;quot; and display the &amp;quot;3IQS_surface&amp;quot;. Again, save the displayed &amp;quot;3IQS_surface&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr04.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 5'''&lt;br /&gt;
Start Blender (please see link in the Introduction to download and install). Assuming you are looking at the default scene and window layout, press '''7''' on '''numeric keypad''' and the view should change similar to the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr05.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Now select the '''cube''' in the center of the screen by '''right clicking''' on it and then press '''ctrl-x''' to delete it. This will give you a clean scene to import the protein structure you just exported from PyMOL as VRML 2 (.wrl).&lt;br /&gt;
&lt;br /&gt;
* '''Step 6'''&lt;br /&gt;
Now import the &amp;quot;3IQS_cartoon&amp;quot; into Blender by going to &amp;quot;File &amp;gt; Import &amp;gt; X3D &amp;amp; VRML97&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr06.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 7'''&lt;br /&gt;
Navigate to the folder where you exported the VRML 2 files from PyMOL and select the &amp;quot;3IQS_cartoon&amp;quot; file, thusly:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr07.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Import X3D/VRML97&amp;quot; button after selecting the correct file and just click &amp;quot;OK&amp;quot; on the dialog that comes up.&lt;br /&gt;
&lt;br /&gt;
* '''Step 8'''&lt;br /&gt;
Doing the above should result in a display such as the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr08.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 9'''&lt;br /&gt;
Now you need to select the just imported cartoon and just that only, so '''right click''' on it so that it is the only object selected in the view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr09.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 10'''&lt;br /&gt;
With the cartoon object selected, hit the '''Tab'' key on your keyboard to enter into &amp;quot;Edit mode&amp;quot; in Blender. All the vertices  that make up this object will be selected and colored yellow, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr10.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 11'''&lt;br /&gt;
Now click on &amp;quot;Mesh &amp;gt; Vertices &amp;gt; Remove Doubles&amp;quot; in Blender to get rid of duplicate vertices, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr11.png|center|350px]]&lt;br /&gt;
[[Image:Scr12.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 12'''&lt;br /&gt;
Now hit the '''Tab'' key again, to exit the &amp;quot;Edit mode&amp;quot; to see a nice smooth cartoon object:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr13.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 13'''&lt;br /&gt;
This cartoon is too big to be visible in the Blender's camera viewport while rendering, so we need to scale it down by hitting the &amp;quot;S&amp;quot; key once, then moving the mouse so that the object becomes smaller in size and then clicking the left mouse button to accept the new size:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr14.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
The final size should be small enough to completely fit in the &amp;quot;Camera view&amp;quot; in Blender. You can enter the &amp;quot;Camera view&amp;quot; by hitting the zero '''0''' key on the '''numeric keypad'''. Scale the object so that it fits within the camera boundaries:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr15.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 14'''&lt;br /&gt;
Now import the &amp;quot;3IQS_surface&amp;quot; VRML 2 file and process it the same way (steps 6 to 13):&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' You may hold off doing &amp;quot;Step 13&amp;quot;, the scaling, until you have imported and processed all objects that you exported from PyMOL. It is best to import and process all the objects and then scale them together to maintain the same scaling ratio for all. You can select multiple objects in blender by holding down the '''Shift''' key while right-clicking on individual objects.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr16.png|center|350px]]&lt;br /&gt;
[[Image:Scr17.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 15'''&lt;br /&gt;
In order to assign different colors (&amp;quot;materials&amp;quot; in Blender-speak) to each object, it is easier to go to camera view (num-pad 0), toggle into &amp;quot;wireframe view&amp;quot; ('''Z''' key) and select an object by right-clicking with the mouse. In the following image, the &amp;quot;3IQS_cartoon&amp;quot; is selected in the wireframe view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr18.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 16'''&lt;br /&gt;
Now select the &amp;quot;3IQS_surface&amp;quot; and toggle back into &amp;quot;solid view&amp;quot; mode ('''Z''' key). Make sure the two buttons with spherical icons are clicked in the bottom panel and the click on the color pad next to the &amp;quot;Col&amp;quot; button to bring up the color selector. You may select any color, in this example a greenish color is asigned.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr19.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 17'''&lt;br /&gt;
In order to make the surface translucent and have short rendering times, it is easiest to change the Z-transparency of the surface by clicking the '''Z-transp''' button on the panel, followed by changing the '''A''' (or alpha) value to below 1.0, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr20.png|center|350px]]&lt;br /&gt;
[[Image:Scr21.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 18'''&lt;br /&gt;
You may similarly select the just the cartoon object and assign it another &amp;quot;material&amp;quot;/color. To render the scene, hit the '''F12''' key on you keyboard, this will render the image in a new &amp;quot;render&amp;quot; window. You can then save the rendered image by hitting '''F3''' key in the render window and then specifying a location and filename.&lt;br /&gt;
&lt;br /&gt;
[[Image:3IQS_final.png|center|500px]]&lt;br /&gt;
&lt;br /&gt;
Play with other parameters and use the Blender manual/wiki to learn more about this awesome complement to PyMOL.&lt;br /&gt;
&lt;br /&gt;
To get you started, here is the final Blender (.blend) file: [[File:3IQS_example.blend.bz2]]&lt;br /&gt;
&lt;br /&gt;
== Why Blender? ==&lt;br /&gt;
&lt;br /&gt;
* Blender is FREE (as in beer)&lt;br /&gt;
* Blender is Open Source and therefore FREE (as in freedom)&lt;br /&gt;
* Blender is an extremely capable 3D graphics program and perhaps the only FOSS program capable of taking on similar commercial software head-to-head (Maya/Max/Modo etc.)&lt;br /&gt;
* To see some examples of what Blender can do check out:&lt;br /&gt;
** http://www.elephantsdream.org/&lt;br /&gt;
** http://www.bigbuckbunny.org/&lt;br /&gt;
** http://www.yofrankie.org/&lt;br /&gt;
&lt;br /&gt;
== Blender Help ==&lt;br /&gt;
Blender is a perfect complement to PyMOL for creating high quality images and animation, but has a pretty steep learning curve. The following are a few resources that may be of help along the way:&lt;br /&gt;
&lt;br /&gt;
* http://www.blender.org/education-help/&lt;br /&gt;
* http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Beginner_Tutorials&lt;br /&gt;
* http://forums.cgsociety.org/forumdisplay.php?f=91&lt;br /&gt;
* http://blenderartists.org/forum/&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Blender : http://www.blender.org/&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:3IQS_example.blend.bz2&amp;diff=1352</id>
		<title>File:3IQS example.blend.bz2</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:3IQS_example.blend.bz2&amp;diff=1352"/>
		<updated>2009-12-22T18:08:46Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Blender&amp;diff=6489</id>
		<title>Blender</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Blender&amp;diff=6489"/>
		<updated>2009-12-22T18:06:26Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table style=&amp;quot;border: 1px solid rgb(255, 204, 0); padding: 5px; background: rgb(255, 253, 223) none repeat scroll 0% 0%; text-align: center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 100%; margin-bottom: 0.2em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;HELP! : &amp;lt;/b&amp;gt; Fellow Blenderheads please help improve this page!!!&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.&lt;br /&gt;
&lt;br /&gt;
Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Representative examples. Please change/improve.&lt;br /&gt;
&lt;br /&gt;
=== 1. Translucent Surfaces ===&lt;br /&gt;
High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.&lt;br /&gt;
&lt;br /&gt;
* '''Step 1'''&lt;br /&gt;
Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to &amp;quot;3IQS_cartoon&amp;quot; and &amp;quot;3IQS_surface&amp;quot; as shown in the image below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr01.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 2'''&lt;br /&gt;
Turn off the display of &amp;quot;3IQS_surface&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr02.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 3'''&lt;br /&gt;
Save the displayed &amp;quot;3IQS_cartoon&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr03.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 4'''&lt;br /&gt;
Hide the &amp;quot;3IQS_cartoon&amp;quot; and display the &amp;quot;3IQS_surface&amp;quot;. Again, save the displayed &amp;quot;3IQS_surface&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr04.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 5'''&lt;br /&gt;
Start Blender (please see link in the Introduction to download and install). Assuming you are looking at the default scene and window layout, press '''7''' on '''numeric keypad''' and the view should change similar to the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr05.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Now select the '''cube''' in the center of the screen by '''right clicking''' on it and then press '''ctrl-x''' to delete it. This will give you a clean scene to import the protein structure you just exported from PyMOL as VRML 2 (.wrl).&lt;br /&gt;
&lt;br /&gt;
* '''Step 6'''&lt;br /&gt;
Now import the &amp;quot;3IQS_cartoon&amp;quot; into Blender by going to &amp;quot;File &amp;gt; Import &amp;gt; X3D &amp;amp; VRML97&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr06.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 7'''&lt;br /&gt;
Navigate to the folder where you exported the VRML 2 files from PyMOL and select the &amp;quot;3IQS_cartoon&amp;quot; file, thusly:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr07.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Import X3D/VRML97&amp;quot; button after selecting the correct file and just click &amp;quot;OK&amp;quot; on the dialog that comes up.&lt;br /&gt;
&lt;br /&gt;
* '''Step 8'''&lt;br /&gt;
Doing the above should result in a display such as the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr08.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 9'''&lt;br /&gt;
Now you need to select the just imported cartoon and just that only, so '''right click''' on it so that it is the only object selected in the view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr09.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 10'''&lt;br /&gt;
With the cartoon object selected, hit the '''Tab'' key on your keyboard to enter into &amp;quot;Edit mode&amp;quot; in Blender. All the vertices  that make up this object will be selected and colored yellow, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr10.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 11'''&lt;br /&gt;
Now click on &amp;quot;Mesh &amp;gt; Vertices &amp;gt; Remove Doubles&amp;quot; in Blender to get rid of duplicate vertices, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr11.png|center|350px]]&lt;br /&gt;
[[Image:Scr12.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 12'''&lt;br /&gt;
Now hit the '''Tab'' key again, to exit the &amp;quot;Edit mode&amp;quot; to see a nice smooth cartoon object:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr13.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 13'''&lt;br /&gt;
This cartoon is too big to be visible in the Blender's camera viewport while rendering, so we need to scale it down by hitting the &amp;quot;S&amp;quot; key once, then moving the mouse so that the object becomes smaller in size and then clicking the left mouse button to accept the new size:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr14.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
The final size should be small enough to completely fit in the &amp;quot;Camera view&amp;quot; in Blender. You can enter the &amp;quot;Camera view&amp;quot; by hitting the zero '''0''' key on the '''numeric keypad'''. Scale the object so that it fits within the camera boundaries:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr15.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 14'''&lt;br /&gt;
Now import the &amp;quot;3IQS_surface&amp;quot; VRML 2 file and process it the same way (steps 6 to 13):&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' You may hold off doing &amp;quot;Step 13&amp;quot;, the scaling, until you have imported and processed all objects that you exported from PyMOL. It is best to import and process all the objects and then scale them together to maintain the same scaling ratio for all. You can select multiple objects in blender by holding down the '''Shift''' key while right-clicking on individual objects.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr16.png|center|350px]]&lt;br /&gt;
[[Image:Scr17.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 15'''&lt;br /&gt;
In order to assign different colors (&amp;quot;materials&amp;quot; in Blender-speak) to each object, it is easier to go to camera view (num-pad 0), toggle into &amp;quot;wireframe view&amp;quot; ('''Z''' key) and select an object by right-clicking with the mouse. In the following image, the &amp;quot;3IQS_cartoon&amp;quot; is selected in the wireframe view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr18.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 16'''&lt;br /&gt;
Now select the &amp;quot;3IQS_surface&amp;quot; and toggle back into &amp;quot;solid view&amp;quot; mode ('''Z''' key). Make sure the two buttons with spherical icons are clicked in the bottom panel and the click on the color pad next to the &amp;quot;Col&amp;quot; button to bring up the color selector. You may select any color, in this example a greenish color is asigned.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr19.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 17'''&lt;br /&gt;
In order to make the surface translucent and have short rendering times, it is easiest to change the Z-transparency of the surface by clicking the '''Z-transp''' button on the panel, followed by changing the '''A''' (or alpha) value to below 1.0, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr20.png|center|350px]]&lt;br /&gt;
[[Image:Scr21.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 18'''&lt;br /&gt;
You may similarly select the just the cartoon object and assign it another &amp;quot;material&amp;quot;/color. To render the scene, hit the '''F12''' key on you keyboard, this will render the image in a new &amp;quot;render&amp;quot; window. You can then save the rendered image by hitting '''F3''' key in the render window and then specifying a location and filename.&lt;br /&gt;
&lt;br /&gt;
[[Image:3IQS_final.png|center|500px]]&lt;br /&gt;
&lt;br /&gt;
Play with other parameters and use the Blender manual/wiki to learn more about this awesome complement to PyMOL.&lt;br /&gt;
&lt;br /&gt;
To get you started, here is the final Blender (.blend) file: [[File:3IQS_example.blend]]&lt;br /&gt;
&lt;br /&gt;
== Why Blender? ==&lt;br /&gt;
&lt;br /&gt;
* Blender is FREE (as in beer)&lt;br /&gt;
* Blender is Open Source and therefore FREE (as in freedom)&lt;br /&gt;
* Blender is an extremely capable 3D graphics program and perhaps the only FOSS program capable of taking on similar commercial software head-to-head (Maya/Max/Modo etc.)&lt;br /&gt;
* To see some examples of what Blender can do check out:&lt;br /&gt;
** http://www.elephantsdream.org/&lt;br /&gt;
** http://www.bigbuckbunny.org/&lt;br /&gt;
** http://www.yofrankie.org/&lt;br /&gt;
&lt;br /&gt;
== Blender Help ==&lt;br /&gt;
Blender is a perfect complement to PyMOL for creating high quality images and animation, but has a pretty steep learning curve. The following are a few resources that may be of help along the way:&lt;br /&gt;
&lt;br /&gt;
* http://www.blender.org/education-help/&lt;br /&gt;
* http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Beginner_Tutorials&lt;br /&gt;
* http://forums.cgsociety.org/forumdisplay.php?f=91&lt;br /&gt;
* http://blenderartists.org/forum/&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Blender : http://www.blender.org/&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Blender&amp;diff=6488</id>
		<title>Blender</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Blender&amp;diff=6488"/>
		<updated>2009-12-22T17:20:23Z</updated>

		<summary type="html">&lt;p&gt;Shiven: /* 1. Translucent Surfaces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table style=&amp;quot;border: 1px solid rgb(255, 204, 0); padding: 5px; background: rgb(255, 253, 223) none repeat scroll 0% 0%; text-align: center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 100%; margin-bottom: 0.2em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;HELP! : &amp;lt;/b&amp;gt; Fellow Blenderheads please help improve this page!!!&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.&lt;br /&gt;
&lt;br /&gt;
Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Representative examples. Please change/improve.&lt;br /&gt;
&lt;br /&gt;
=== 1. Translucent Surfaces ===&lt;br /&gt;
High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.&lt;br /&gt;
&lt;br /&gt;
* '''Step 1'''&lt;br /&gt;
Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to &amp;quot;3IQS_cartoon&amp;quot; and &amp;quot;3IQS_surface&amp;quot; as shown in the image below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr01.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 2'''&lt;br /&gt;
Turn off the display of &amp;quot;3IQS_surface&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr02.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 3'''&lt;br /&gt;
Save the displayed &amp;quot;3IQS_cartoon&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr03.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 4'''&lt;br /&gt;
Hide the &amp;quot;3IQS_cartoon&amp;quot; and display the &amp;quot;3IQS_surface&amp;quot;. Again, save the displayed &amp;quot;3IQS_surface&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr04.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 5'''&lt;br /&gt;
Start Blender (please see link in the Introduction to download and install). Assuming you are looking at the default scene and window layout, press '''7''' on '''numeric keypad''' and the view should change similar to the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr05.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Now select the '''cube''' in the center of the screen by '''right clicking''' on it and then press '''ctrl-x''' to delete it. This will give you a clean scene to import the protein structure you just exported from PyMOL as VRML 2 (.wrl).&lt;br /&gt;
&lt;br /&gt;
* '''Step 6'''&lt;br /&gt;
Now import the &amp;quot;3IQS_cartoon&amp;quot; into Blender by going to &amp;quot;File &amp;gt; Import &amp;gt; X3D &amp;amp; VRML97&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr06.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 7'''&lt;br /&gt;
Navigate to the folder where you exported the VRML 2 files from PyMOL and select the &amp;quot;3IQS_cartoon&amp;quot; file, thusly:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr07.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Import X3D/VRML97&amp;quot; button after selecting the correct file and just click &amp;quot;OK&amp;quot; on the dialog that comes up.&lt;br /&gt;
&lt;br /&gt;
* '''Step 8'''&lt;br /&gt;
Doing the above should result in a display such as the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr08.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 9'''&lt;br /&gt;
Now you need to select the just imported cartoon and just that only, so '''right click''' on it so that it is the only object selected in the view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr09.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 10'''&lt;br /&gt;
With the cartoon object selected, hit the '''Tab'' key on your keyboard to enter into &amp;quot;Edit mode&amp;quot; in Blender. All the vertices  that make up this object will be selected and colored yellow, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr10.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 11'''&lt;br /&gt;
Now click on &amp;quot;Mesh &amp;gt; Vertices &amp;gt; Remove Doubles&amp;quot; in Blender to get rid of duplicate vertices, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr11.png|center|350px]]&lt;br /&gt;
[[Image:Scr12.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 12'''&lt;br /&gt;
Now hit the '''Tab'' key again, to exit the &amp;quot;Edit mode&amp;quot; to see a nice smooth cartoon object:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr13.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 13'''&lt;br /&gt;
This cartoon is too big to be visible in the Blender's camera viewport while rendering, so we need to scale it down by hitting the &amp;quot;S&amp;quot; key once, then moving the mouse so that the object becomes smaller in size and then clicking the left mouse button to accept the new size:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr14.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
The final size should be small enough to completely fit in the &amp;quot;Camera view&amp;quot; in Blender. You can enter the &amp;quot;Camera view&amp;quot; by hitting the zero '''0''' key on the '''numeric keypad'''. Scale the object so that it fits within the camera boundaries:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr15.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 14'''&lt;br /&gt;
Now import the &amp;quot;3IQS_surface&amp;quot; VRML 2 file and process it the same way (steps 6 to 13):&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' You may hold off doing &amp;quot;Step 13&amp;quot;, the scaling, until you have imported and processed all objects that you exported from PyMOL. It is best to import and process all the objects and then scale them together to maintain the same scaling ratio for all. You can select multiple objects in blender by holding down the '''Shift''' key while right-clicking on individual objects.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr16.png|center|350px]]&lt;br /&gt;
[[Image:Scr17.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 15'''&lt;br /&gt;
In order to assign different colors (&amp;quot;materials&amp;quot; in Blender-speak) to each object, it is easier to go to camera view (num-pad 0), toggle into &amp;quot;wireframe view&amp;quot; ('''Z''' key) and select an object by right-clicking with the mouse. In the following image, the &amp;quot;3IQS_cartoon&amp;quot; is selected in the wireframe view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr18.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 16'''&lt;br /&gt;
Now select the &amp;quot;3IQS_surface&amp;quot; and toggle back into &amp;quot;solid view&amp;quot; mode ('''Z''' key). Make sure the two buttons with spherical icons are clicked in the bottom panel and the click on the color pad next to the &amp;quot;Col&amp;quot; button to bring up the color selector. You may select any color, in this example a greenish color is asigned.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr19.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 17'''&lt;br /&gt;
In order to make the surface translucent and have short rendering times, it is easiest to change the Z-transparency of the surface by clicking the '''Z-transp''' button on the panel, followed by changing the '''A''' (or alpha) value to below 1.0, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr20.png|center|350px]]&lt;br /&gt;
[[Image:Scr21.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 18'''&lt;br /&gt;
You may similarly select the just the cartoon object and assign it another &amp;quot;material&amp;quot;/color. To render the scene, hit the '''F12''' key on you keyboard, this will render the image in a new &amp;quot;render&amp;quot; window. You can then save the rendered image by hitting '''F3''' key in the render window and then specifying a location and filename.&lt;br /&gt;
&lt;br /&gt;
[[Image:3IQS_final.png|center|500px]]&lt;br /&gt;
&lt;br /&gt;
Play with other parameters and use the Blender manual/wiki to learn more about this awesome complement to PyMOL.&lt;br /&gt;
&lt;br /&gt;
To get you started, here is the final Blender (.blend) file:&lt;br /&gt;
&lt;br /&gt;
== Why Blender? ==&lt;br /&gt;
&lt;br /&gt;
* Blender is FREE (as in beer)&lt;br /&gt;
* Blender is Open Source and therefore FREE (as in freedom)&lt;br /&gt;
* Blender is an extremely capable 3D graphics program and perhaps the only FOSS program capable of taking on similar commercial software head-to-head (Maya/Max/Modo etc.)&lt;br /&gt;
* To see some examples of what Blender can do check out:&lt;br /&gt;
** http://www.elephantsdream.org/&lt;br /&gt;
** http://www.bigbuckbunny.org/&lt;br /&gt;
** http://www.yofrankie.org/&lt;br /&gt;
&lt;br /&gt;
== Blender Help ==&lt;br /&gt;
Blender is a perfect complement to PyMOL for creating high quality images and animation, but has a pretty steep learning curve. The following are a few resources that may be of help along the way:&lt;br /&gt;
&lt;br /&gt;
* http://www.blender.org/education-help/&lt;br /&gt;
* http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Beginner_Tutorials&lt;br /&gt;
* http://forums.cgsociety.org/forumdisplay.php?f=91&lt;br /&gt;
* http://blenderartists.org/forum/&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Blender : http://www.blender.org/&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Blender&amp;diff=6487</id>
		<title>Blender</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Blender&amp;diff=6487"/>
		<updated>2009-12-22T17:18:15Z</updated>

		<summary type="html">&lt;p&gt;Shiven: /* 1. Translucent Surfaces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table style=&amp;quot;border: 1px solid rgb(255, 204, 0); padding: 5px; background: rgb(255, 253, 223) none repeat scroll 0% 0%; text-align: center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 100%; margin-bottom: 0.2em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;HELP! : &amp;lt;/b&amp;gt; Fellow Blenderheads please help improve this page!!!&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.&lt;br /&gt;
&lt;br /&gt;
Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Representative examples. Please change/improve.&lt;br /&gt;
&lt;br /&gt;
=== 1. Translucent Surfaces ===&lt;br /&gt;
High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.&lt;br /&gt;
&lt;br /&gt;
* '''Step 1'''&lt;br /&gt;
Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to &amp;quot;3IQS_cartoon&amp;quot; and &amp;quot;3IQS_surface&amp;quot; as shown in the image below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr01.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 2'''&lt;br /&gt;
Turn off the display of &amp;quot;3IQS_surface&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr02.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 3'''&lt;br /&gt;
Save the displayed &amp;quot;3IQS_cartoon&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr03.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 4'''&lt;br /&gt;
Hide the &amp;quot;3IQS_cartoon&amp;quot; and display the &amp;quot;3IQS_surface&amp;quot;. Again, save the displayed &amp;quot;3IQS_surface&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr04.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 5'''&lt;br /&gt;
Start Blender (please see link in the Introduction to download and install). Assuming you are looking at the default scene and window layout, press '''7''' on '''numeric keypad''' and the view should change similar to the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr05.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Now select the '''cube''' in the center of the screen by '''right clicking''' on it and then press '''ctrl-x''' to delete it. This will give you a clean scene to import the protein structure you just exported from PyMOL as VRML 2 (.wrl).&lt;br /&gt;
&lt;br /&gt;
* '''Step 6'''&lt;br /&gt;
Now import the &amp;quot;3IQS_cartoon&amp;quot; into Blender by going to &amp;quot;File &amp;gt; Import &amp;gt; X3D &amp;amp; VRML97&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr06.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 7'''&lt;br /&gt;
Navigate to the folder where you exported the VRML 2 files from PyMOL and select the &amp;quot;3IQS_cartoon&amp;quot; file, thusly:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr07.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Import X3D/VRML97&amp;quot; button after selecting the correct file and just click &amp;quot;OK&amp;quot; on the dialog that comes up.&lt;br /&gt;
&lt;br /&gt;
* '''Step 8'''&lt;br /&gt;
Doing the above should result in a display such as the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr08.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 9'''&lt;br /&gt;
Now you need to select the just imported cartoon and just that only, so '''right click''' on it so that it is the only object selected in the view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr09.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 10'''&lt;br /&gt;
With the cartoon object selected, hit the '''Tab'' key on your keyboard to enter into &amp;quot;Edit mode&amp;quot; in Blender. All the vertices  that make up this object will be selected and colored yellow, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr10.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 11'''&lt;br /&gt;
Now click on &amp;quot;Mesh &amp;gt; Vertices &amp;gt; Remove Doubles&amp;quot; in Blender to get rid of duplicate vertices, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr11.png|center|350px]]&lt;br /&gt;
[[Image:Scr12.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 12'''&lt;br /&gt;
Now hit the '''Tab'' key again, to exit the &amp;quot;Edit mode&amp;quot; to see a nice smooth cartoon object:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr13.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 13'''&lt;br /&gt;
This cartoon is too big to be visible in the Blender's camera viewport while rendering, so we need to scale it down by hitting the &amp;quot;S&amp;quot; key once, then moving the mouse so that the object becomes smaller in size and then clicking the left mouse button to accept the new size:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr14.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
The final size should be small enough to completely fit in the &amp;quot;Camera view&amp;quot; in Blender. You can enter the &amp;quot;Camera view&amp;quot; by hitting the zero '''0''' key on the '''numeric keypad'''. Scale the object so that it fits within the camera boundaries:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr15.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 14'''&lt;br /&gt;
Now import the &amp;quot;3IQS_surface&amp;quot; VRML 2 file and process it the same way (steps 6 to 13):&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' You may hold off doing &amp;quot;Step 13&amp;quot;, the scaling, until you have imported and processed all objects that you exported from PyMOL. It is best to import and process all the objects and then scale them together to maintain the same scaling ratio for all. You can select multiple objects in blender by holding down the '''Shift''' key while right-clicking on individual objects.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr16.png|center|350px]]&lt;br /&gt;
[[Image:Scr17.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 15'''&lt;br /&gt;
In order to assign different colors (&amp;quot;materials&amp;quot; in Blender-speak) to each object, it is easier to go to camera view (num-pad 0), toggle into &amp;quot;wireframe view&amp;quot; ('''Z''' key) and select an object by right-clicking with the mouse. In the following image, the &amp;quot;3IQS_cartoon&amp;quot; is selected in the wireframe view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr18.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 16'''&lt;br /&gt;
Now select the &amp;quot;3IQS_surface&amp;quot; and toggle back into &amp;quot;solid view&amp;quot; mode ('''Z''' key). Make sure the two buttons with spherical icons are clicked in the bottom panel and the click on the color pad next to the &amp;quot;Col&amp;quot; button to bring up the color selector. You may select any color, in this example a greenish color is asigned.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr19.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 17'''&lt;br /&gt;
In order to make the surface translucent and have short rendering times, it is easiest to change the Z-transparency of the surface by clicking the '''Z-transp''' button on the panel, followed by changing the '''A''' (or alpha) value to below 1.0, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr20.png|center|350px]]&lt;br /&gt;
[[Image:Scr21.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 18'''&lt;br /&gt;
You may similarly select the just the cartoon object and assign it another &amp;quot;material&amp;quot;/color. To render the scene, hit the '''F12''' key on you keyboard, this will render the image in a new &amp;quot;render&amp;quot; window. You can then save the rendered image by hitting '''F3''' key in the render window and then specifying a location and filename.&lt;br /&gt;
&lt;br /&gt;
[[Image:3IQS_final.png|center|500px]]&lt;br /&gt;
&lt;br /&gt;
Play with other parameters and use the Blender manual/wiki to learn more about this awesome complement to PyMOL.&lt;br /&gt;
&lt;br /&gt;
To get you started, here is the final Blender (.blend) file: [[File:3IQS_example.blend]]&lt;br /&gt;
&lt;br /&gt;
== Why Blender? ==&lt;br /&gt;
&lt;br /&gt;
* Blender is FREE (as in beer)&lt;br /&gt;
* Blender is Open Source and therefore FREE (as in freedom)&lt;br /&gt;
* Blender is an extremely capable 3D graphics program and perhaps the only FOSS program capable of taking on similar commercial software head-to-head (Maya/Max/Modo etc.)&lt;br /&gt;
* To see some examples of what Blender can do check out:&lt;br /&gt;
** http://www.elephantsdream.org/&lt;br /&gt;
** http://www.bigbuckbunny.org/&lt;br /&gt;
** http://www.yofrankie.org/&lt;br /&gt;
&lt;br /&gt;
== Blender Help ==&lt;br /&gt;
Blender is a perfect complement to PyMOL for creating high quality images and animation, but has a pretty steep learning curve. The following are a few resources that may be of help along the way:&lt;br /&gt;
&lt;br /&gt;
* http://www.blender.org/education-help/&lt;br /&gt;
* http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Beginner_Tutorials&lt;br /&gt;
* http://forums.cgsociety.org/forumdisplay.php?f=91&lt;br /&gt;
* http://blenderartists.org/forum/&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Blender : http://www.blender.org/&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Blender&amp;diff=6486</id>
		<title>Blender</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Blender&amp;diff=6486"/>
		<updated>2009-12-22T17:14:24Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table style=&amp;quot;border: 1px solid rgb(255, 204, 0); padding: 5px; background: rgb(255, 253, 223) none repeat scroll 0% 0%; text-align: center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 100%; margin-bottom: 0.2em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;HELP! : &amp;lt;/b&amp;gt; Fellow Blenderheads please help improve this page!!!&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.&lt;br /&gt;
&lt;br /&gt;
Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Representative examples. Please change/improve.&lt;br /&gt;
&lt;br /&gt;
=== 1. Translucent Surfaces ===&lt;br /&gt;
High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.&lt;br /&gt;
&lt;br /&gt;
* '''Step 1'''&lt;br /&gt;
Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to &amp;quot;3IQS_cartoon&amp;quot; and &amp;quot;3IQS_surface&amp;quot; as shown in the image below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr01.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 2'''&lt;br /&gt;
Turn off the display of &amp;quot;3IQS_surface&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr02.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 3'''&lt;br /&gt;
Save the displayed &amp;quot;3IQS_cartoon&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr03.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 4'''&lt;br /&gt;
Hide the &amp;quot;3IQS_cartoon&amp;quot; and display the &amp;quot;3IQS_surface&amp;quot;. Again, save the displayed &amp;quot;3IQS_surface&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr04.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 5'''&lt;br /&gt;
Start Blender (please see link in the Introduction to download and install). Assuming you are looking at the default scene and window layout, press '''7''' on '''numeric keypad''' and the view should change similar to the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr05.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Now select the '''cube''' in the center of the screen by '''right clicking''' on it and then press '''ctrl-x''' to delete it. This will give you a clean scene to import the protein structure you just exported from PyMOL as VRML 2 (.wrl).&lt;br /&gt;
&lt;br /&gt;
* '''Step 6'''&lt;br /&gt;
Now import the &amp;quot;3IQS_cartoon&amp;quot; into Blender by going to &amp;quot;File &amp;gt; Import &amp;gt; X3D &amp;amp; VRML97&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr06.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 7'''&lt;br /&gt;
Navigate to the folder where you exported the VRML 2 files from PyMOL and select the &amp;quot;3IQS_cartoon&amp;quot; file, thusly:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr07.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Import X3D/VRML97&amp;quot; button after selecting the correct file and just click &amp;quot;OK&amp;quot; on the dialog that comes up.&lt;br /&gt;
&lt;br /&gt;
* '''Step 8'''&lt;br /&gt;
Doing the above should result in a display such as the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr08.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 9'''&lt;br /&gt;
Now you need to select the just imported cartoon and just that only, so '''right click''' on it so that it is the only object selected in the view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr09.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 10'''&lt;br /&gt;
With the cartoon object selected, hit the '''Tab'' key on your keyboard to enter into &amp;quot;Edit mode&amp;quot; in Blender. All the vertices  that make up this object will be selected and colored yellow, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr10.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 11'''&lt;br /&gt;
Now click on &amp;quot;Mesh &amp;gt; Vertices &amp;gt; Remove Doubles&amp;quot; in Blender to get rid of duplicate vertices, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr11.png|center|350px]]&lt;br /&gt;
[[Image:Scr12.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 12'''&lt;br /&gt;
Now hit the '''Tab'' key again, to exit the &amp;quot;Edit mode&amp;quot; to see a nice smooth cartoon object:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr13.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 13'''&lt;br /&gt;
This cartoon is too big to be visible in the Blender's camera viewport while rendering, so we need to scale it down by hitting the &amp;quot;S&amp;quot; key once, then moving the mouse so that the object becomes smaller in size and then clicking the left mouse button to accept the new size:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr14.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
The final size should be small enough to completely fit in the &amp;quot;Camera view&amp;quot; in Blender. You can enter the &amp;quot;Camera view&amp;quot; by hitting the zero '''0''' key on the '''numeric keypad'''. Scale the object so that it fits within the camera boundaries:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr15.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 14'''&lt;br /&gt;
Now import the &amp;quot;3IQS_surface&amp;quot; VRML 2 file and process it the same way (steps 6 to 13):&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' You may hold off doing &amp;quot;Step 13&amp;quot;, the scaling, until you have imported and processed all objects that you exported from PyMOL. It is best to import and process all the objects and then scale them together to maintain the same scaling ratio for all. You can select multiple objects in blender by holding down the '''Shift''' key while right-clicking on individual objects.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr16.png|center|350px]]&lt;br /&gt;
[[Image:Scr17.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 15'''&lt;br /&gt;
In order to assign different colors (&amp;quot;materials&amp;quot; in Blender-speak) to each object, it is easier to go to camera view (num-pad 0), toggle into &amp;quot;wireframe view&amp;quot; ('''Z''' key) and select an object by right-clicking with the mouse. In the following image, the &amp;quot;3IQS_cartoon&amp;quot; is selected in the wireframe view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr18.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 16'''&lt;br /&gt;
Now select the &amp;quot;3IQS_surface&amp;quot; and toggle back into &amp;quot;solid view&amp;quot; mode ('''Z''' key). Make sure the two buttons with spherical icons are clicked in the bottom panel and the click on the color pad next to the &amp;quot;Col&amp;quot; button to bring up the color selector. You may select any color, in this example a greenish color is asigned.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr19.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 17'''&lt;br /&gt;
In order to make the surface translucent and have short rendering times, it is easiest to change the Z-transparency of the surface by clicking the '''Z-transp''' button on the panel, followed by changing the '''A''' (or alpha) value to below 1.0, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr20.png|center|350px]]&lt;br /&gt;
[[Image:Scr21.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 18'''&lt;br /&gt;
You may similarly select the just the cartoon object and assign it another &amp;quot;material&amp;quot;/color. To render the scene, hit the '''F12''' key on you keyboard, this will render the image in a new &amp;quot;render&amp;quot; window. You can then save the rendered image by hitting '''F3''' key in the render window and then specifying a location and filename.&lt;br /&gt;
&lt;br /&gt;
[[Image:3IQS_final.png|center|500px]]&lt;br /&gt;
&lt;br /&gt;
Play with other parameters and use the Blender manual/wiki to learn more about this awesome complement to PyMOL.&lt;br /&gt;
&lt;br /&gt;
== Why Blender? ==&lt;br /&gt;
&lt;br /&gt;
* Blender is FREE (as in beer)&lt;br /&gt;
* Blender is Open Source and therefore FREE (as in freedom)&lt;br /&gt;
* Blender is an extremely capable 3D graphics program and perhaps the only FOSS program capable of taking on similar commercial software head-to-head (Maya/Max/Modo etc.)&lt;br /&gt;
* To see some examples of what Blender can do check out:&lt;br /&gt;
** http://www.elephantsdream.org/&lt;br /&gt;
** http://www.bigbuckbunny.org/&lt;br /&gt;
** http://www.yofrankie.org/&lt;br /&gt;
&lt;br /&gt;
== Blender Help ==&lt;br /&gt;
Blender is a perfect complement to PyMOL for creating high quality images and animation, but has a pretty steep learning curve. The following are a few resources that may be of help along the way:&lt;br /&gt;
&lt;br /&gt;
* http://www.blender.org/education-help/&lt;br /&gt;
* http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Beginner_Tutorials&lt;br /&gt;
* http://forums.cgsociety.org/forumdisplay.php?f=91&lt;br /&gt;
* http://blenderartists.org/forum/&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Blender : http://www.blender.org/&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Blender&amp;diff=6485</id>
		<title>Blender</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Blender&amp;diff=6485"/>
		<updated>2009-12-22T17:13:58Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;table style=&amp;quot;border: 1px solid rgb(255, 204, 0); padding: 5px; background: rgb(255, 253, 223) none repeat scroll 0% 0%; text-align: center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 100%; margin-bottom: 0.2em;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;HELP!&amp;lt;/b&amp;gt;Fellow Blenderheads please help improve this page!!!&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.&lt;br /&gt;
&lt;br /&gt;
Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Representative examples. Please change/improve.&lt;br /&gt;
&lt;br /&gt;
=== 1. Translucent Surfaces ===&lt;br /&gt;
High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.&lt;br /&gt;
&lt;br /&gt;
* '''Step 1'''&lt;br /&gt;
Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to &amp;quot;3IQS_cartoon&amp;quot; and &amp;quot;3IQS_surface&amp;quot; as shown in the image below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr01.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 2'''&lt;br /&gt;
Turn off the display of &amp;quot;3IQS_surface&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr02.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 3'''&lt;br /&gt;
Save the displayed &amp;quot;3IQS_cartoon&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr03.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 4'''&lt;br /&gt;
Hide the &amp;quot;3IQS_cartoon&amp;quot; and display the &amp;quot;3IQS_surface&amp;quot;. Again, save the displayed &amp;quot;3IQS_surface&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr04.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 5'''&lt;br /&gt;
Start Blender (please see link in the Introduction to download and install). Assuming you are looking at the default scene and window layout, press '''7''' on '''numeric keypad''' and the view should change similar to the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr05.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Now select the '''cube''' in the center of the screen by '''right clicking''' on it and then press '''ctrl-x''' to delete it. This will give you a clean scene to import the protein structure you just exported from PyMOL as VRML 2 (.wrl).&lt;br /&gt;
&lt;br /&gt;
* '''Step 6'''&lt;br /&gt;
Now import the &amp;quot;3IQS_cartoon&amp;quot; into Blender by going to &amp;quot;File &amp;gt; Import &amp;gt; X3D &amp;amp; VRML97&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr06.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 7'''&lt;br /&gt;
Navigate to the folder where you exported the VRML 2 files from PyMOL and select the &amp;quot;3IQS_cartoon&amp;quot; file, thusly:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr07.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Import X3D/VRML97&amp;quot; button after selecting the correct file and just click &amp;quot;OK&amp;quot; on the dialog that comes up.&lt;br /&gt;
&lt;br /&gt;
* '''Step 8'''&lt;br /&gt;
Doing the above should result in a display such as the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr08.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 9'''&lt;br /&gt;
Now you need to select the just imported cartoon and just that only, so '''right click''' on it so that it is the only object selected in the view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr09.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 10'''&lt;br /&gt;
With the cartoon object selected, hit the '''Tab'' key on your keyboard to enter into &amp;quot;Edit mode&amp;quot; in Blender. All the vertices  that make up this object will be selected and colored yellow, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr10.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 11'''&lt;br /&gt;
Now click on &amp;quot;Mesh &amp;gt; Vertices &amp;gt; Remove Doubles&amp;quot; in Blender to get rid of duplicate vertices, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr11.png|center|350px]]&lt;br /&gt;
[[Image:Scr12.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 12'''&lt;br /&gt;
Now hit the '''Tab'' key again, to exit the &amp;quot;Edit mode&amp;quot; to see a nice smooth cartoon object:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr13.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 13'''&lt;br /&gt;
This cartoon is too big to be visible in the Blender's camera viewport while rendering, so we need to scale it down by hitting the &amp;quot;S&amp;quot; key once, then moving the mouse so that the object becomes smaller in size and then clicking the left mouse button to accept the new size:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr14.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
The final size should be small enough to completely fit in the &amp;quot;Camera view&amp;quot; in Blender. You can enter the &amp;quot;Camera view&amp;quot; by hitting the zero '''0''' key on the '''numeric keypad'''. Scale the object so that it fits within the camera boundaries:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr15.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 14'''&lt;br /&gt;
Now import the &amp;quot;3IQS_surface&amp;quot; VRML 2 file and process it the same way (steps 6 to 13):&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' You may hold off doing &amp;quot;Step 13&amp;quot;, the scaling, until you have imported and processed all objects that you exported from PyMOL. It is best to import and process all the objects and then scale them together to maintain the same scaling ratio for all. You can select multiple objects in blender by holding down the '''Shift''' key while right-clicking on individual objects.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr16.png|center|350px]]&lt;br /&gt;
[[Image:Scr17.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 15'''&lt;br /&gt;
In order to assign different colors (&amp;quot;materials&amp;quot; in Blender-speak) to each object, it is easier to go to camera view (num-pad 0), toggle into &amp;quot;wireframe view&amp;quot; ('''Z''' key) and select an object by right-clicking with the mouse. In the following image, the &amp;quot;3IQS_cartoon&amp;quot; is selected in the wireframe view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr18.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 16'''&lt;br /&gt;
Now select the &amp;quot;3IQS_surface&amp;quot; and toggle back into &amp;quot;solid view&amp;quot; mode ('''Z''' key). Make sure the two buttons with spherical icons are clicked in the bottom panel and the click on the color pad next to the &amp;quot;Col&amp;quot; button to bring up the color selector. You may select any color, in this example a greenish color is asigned.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr19.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 17'''&lt;br /&gt;
In order to make the surface translucent and have short rendering times, it is easiest to change the Z-transparency of the surface by clicking the '''Z-transp''' button on the panel, followed by changing the '''A''' (or alpha) value to below 1.0, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr20.png|center|350px]]&lt;br /&gt;
[[Image:Scr21.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 18'''&lt;br /&gt;
You may similarly select the just the cartoon object and assign it another &amp;quot;material&amp;quot;/color. To render the scene, hit the '''F12''' key on you keyboard, this will render the image in a new &amp;quot;render&amp;quot; window. You can then save the rendered image by hitting '''F3''' key in the render window and then specifying a location and filename.&lt;br /&gt;
&lt;br /&gt;
[[Image:3IQS_final.png|center|500px]]&lt;br /&gt;
&lt;br /&gt;
Play with other parameters and use the Blender manual/wiki to learn more about this awesome complement to PyMOL.&lt;br /&gt;
&lt;br /&gt;
== Why Blender? ==&lt;br /&gt;
&lt;br /&gt;
* Blender is FREE (as in beer)&lt;br /&gt;
* Blender is Open Source and therefore FREE (as in freedom)&lt;br /&gt;
* Blender is an extremely capable 3D graphics program and perhaps the only FOSS program capable of taking on similar commercial software head-to-head (Maya/Max/Modo etc.)&lt;br /&gt;
* To see some examples of what Blender can do check out:&lt;br /&gt;
** http://www.elephantsdream.org/&lt;br /&gt;
** http://www.bigbuckbunny.org/&lt;br /&gt;
** http://www.yofrankie.org/&lt;br /&gt;
&lt;br /&gt;
== Blender Help ==&lt;br /&gt;
Blender is a perfect complement to PyMOL for creating high quality images and animation, but has a pretty steep learning curve. The following are a few resources that may be of help along the way:&lt;br /&gt;
&lt;br /&gt;
* http://www.blender.org/education-help/&lt;br /&gt;
* http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Beginner_Tutorials&lt;br /&gt;
* http://forums.cgsociety.org/forumdisplay.php?f=91&lt;br /&gt;
* http://blenderartists.org/forum/&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Blender : http://www.blender.org/&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Blender&amp;diff=6484</id>
		<title>Blender</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Blender&amp;diff=6484"/>
		<updated>2009-12-22T17:07:20Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{quotation|'''HELP!'''Fellow Blenderheads please help improve this page!!!}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.&lt;br /&gt;
&lt;br /&gt;
Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Representative examples. Please change/improve.&lt;br /&gt;
&lt;br /&gt;
=== 1. Translucent Surfaces ===&lt;br /&gt;
High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.&lt;br /&gt;
&lt;br /&gt;
* '''Step 1'''&lt;br /&gt;
Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to &amp;quot;3IQS_cartoon&amp;quot; and &amp;quot;3IQS_surface&amp;quot; as shown in the image below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr01.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 2'''&lt;br /&gt;
Turn off the display of &amp;quot;3IQS_surface&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr02.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 3'''&lt;br /&gt;
Save the displayed &amp;quot;3IQS_cartoon&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr03.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 4'''&lt;br /&gt;
Hide the &amp;quot;3IQS_cartoon&amp;quot; and display the &amp;quot;3IQS_surface&amp;quot;. Again, save the displayed &amp;quot;3IQS_surface&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr04.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 5'''&lt;br /&gt;
Start Blender (please see link in the Introduction to download and install). Assuming you are looking at the default scene and window layout, press '''7''' on '''numeric keypad''' and the view should change similar to the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr05.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Now select the '''cube''' in the center of the screen by '''right clicking''' on it and then press '''ctrl-x''' to delete it. This will give you a clean scene to import the protein structure you just exported from PyMOL as VRML 2 (.wrl).&lt;br /&gt;
&lt;br /&gt;
* '''Step 6'''&lt;br /&gt;
Now import the &amp;quot;3IQS_cartoon&amp;quot; into Blender by going to &amp;quot;File &amp;gt; Import &amp;gt; X3D &amp;amp; VRML97&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr06.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 7'''&lt;br /&gt;
Navigate to the folder where you exported the VRML 2 files from PyMOL and select the &amp;quot;3IQS_cartoon&amp;quot; file, thusly:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr07.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Import X3D/VRML97&amp;quot; button after selecting the correct file and just click &amp;quot;OK&amp;quot; on the dialog that comes up.&lt;br /&gt;
&lt;br /&gt;
* '''Step 8'''&lt;br /&gt;
Doing the above should result in a display such as the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr08.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 9'''&lt;br /&gt;
Now you need to select the just imported cartoon and just that only, so '''right click''' on it so that it is the only object selected in the view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr09.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 10'''&lt;br /&gt;
With the cartoon object selected, hit the '''Tab'' key on your keyboard to enter into &amp;quot;Edit mode&amp;quot; in Blender. All the vertices  that make up this object will be selected and colored yellow, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr10.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 11'''&lt;br /&gt;
Now click on &amp;quot;Mesh &amp;gt; Vertices &amp;gt; Remove Doubles&amp;quot; in Blender to get rid of duplicate vertices, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr11.png|center|350px]]&lt;br /&gt;
[[Image:Scr12.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 12'''&lt;br /&gt;
Now hit the '''Tab'' key again, to exit the &amp;quot;Edit mode&amp;quot; to see a nice smooth cartoon object:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr13.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 13'''&lt;br /&gt;
This cartoon is too big to be visible in the Blender's camera viewport while rendering, so we need to scale it down by hitting the &amp;quot;S&amp;quot; key once, then moving the mouse so that the object becomes smaller in size and then clicking the left mouse button to accept the new size:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr14.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
The final size should be small enough to completely fit in the &amp;quot;Camera view&amp;quot; in Blender. You can enter the &amp;quot;Camera view&amp;quot; by hitting the zero '''0''' key on the '''numeric keypad'''. Scale the object so that it fits within the camera boundaries:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr15.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 14'''&lt;br /&gt;
Now import the &amp;quot;3IQS_surface&amp;quot; VRML 2 file and process it the same way (steps 6 to 13):&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' You may hold off doing &amp;quot;Step 13&amp;quot;, the scaling, until you have imported and processed all objects that you exported from PyMOL. It is best to import and process all the objects and then scale them together to maintain the same scaling ratio for all. You can select multiple objects in blender by holding down the '''Shift''' key while right-clicking on individual objects.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr16.png|center|350px]]&lt;br /&gt;
[[Image:Scr17.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 15'''&lt;br /&gt;
In order to assign different colors (&amp;quot;materials&amp;quot; in Blender-speak) to each object, it is easier to go to camera view (num-pad 0), toggle into &amp;quot;wireframe view&amp;quot; ('''Z''' key) and select an object by right-clicking with the mouse. In the following image, the &amp;quot;3IQS_cartoon&amp;quot; is selected in the wireframe view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr18.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 16'''&lt;br /&gt;
Now select the &amp;quot;3IQS_surface&amp;quot; and toggle back into &amp;quot;solid view&amp;quot; mode ('''Z''' key). Make sure the two buttons with spherical icons are clicked in the bottom panel and the click on the color pad next to the &amp;quot;Col&amp;quot; button to bring up the color selector. You may select any color, in this example a greenish color is asigned.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr19.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 17'''&lt;br /&gt;
In order to make the surface translucent and have short rendering times, it is easiest to change the Z-transparency of the surface by clicking the '''Z-transp''' button on the panel, followed by changing the '''A''' (or alpha) value to below 1.0, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr20.png|center|350px]]&lt;br /&gt;
[[Image:Scr21.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 18'''&lt;br /&gt;
You may similarly select the just the cartoon object and assign it another &amp;quot;material&amp;quot;/color. To render the scene, hit the '''F12''' key on you keyboard, this will render the image in a new &amp;quot;render&amp;quot; window. You can then save the rendered image by hitting '''F3''' key in the render window and then specifying a location and filename.&lt;br /&gt;
&lt;br /&gt;
[[Image:3IQS_final.png|center|500px]]&lt;br /&gt;
&lt;br /&gt;
Play with other parameters and use the Blender manual/wiki to learn more about this awesome complement to PyMOL.&lt;br /&gt;
&lt;br /&gt;
== Why Blender? ==&lt;br /&gt;
&lt;br /&gt;
* Blender is FREE (as in beer)&lt;br /&gt;
* Blender is Open Source and therefore FREE (as in freedom)&lt;br /&gt;
* Blender is an extremely capable 3D graphics program and perhaps the only FOSS program capable of taking on similar commercial software head-to-head (Maya/Max/Modo etc.)&lt;br /&gt;
* To see some examples of what Blender can do check out:&lt;br /&gt;
** http://www.elephantsdream.org/&lt;br /&gt;
** http://www.bigbuckbunny.org/&lt;br /&gt;
** http://www.yofrankie.org/&lt;br /&gt;
&lt;br /&gt;
== Blender Help ==&lt;br /&gt;
Blender is a perfect complement to PyMOL for creating high quality images and animation, but has a pretty steep learning curve. The following are a few resources that may be of help along the way:&lt;br /&gt;
&lt;br /&gt;
* http://www.blender.org/education-help/&lt;br /&gt;
* http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Beginner_Tutorials&lt;br /&gt;
* http://forums.cgsociety.org/forumdisplay.php?f=91&lt;br /&gt;
* http://blenderartists.org/forum/&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Blender : http://www.blender.org/&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Blender&amp;diff=6483</id>
		<title>Blender</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Blender&amp;diff=6483"/>
		<updated>2009-12-22T16:47:06Z</updated>

		<summary type="html">&lt;p&gt;Shiven: /* 1. Translucent Surfaces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
An attempt at using Blender, an open-source, free, 3D modeling software to render, pose and animate objects exported from Pymol.&lt;br /&gt;
&lt;br /&gt;
Blender may be downloaded freely for all major platforms (Win/Mac/Linux), from: http://www.blender.org/download/get-blender/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Representative examples. Please change/improve.&lt;br /&gt;
&lt;br /&gt;
=== 1. Translucent Surfaces ===&lt;br /&gt;
High quality translucent surfaces, better than PyMOL's internal renderer/ray-tracer.&lt;br /&gt;
&lt;br /&gt;
* '''Step 1'''&lt;br /&gt;
Load the PDB file 3IQS into PyMOL, duplicate it twice and rename the two new objects to &amp;quot;3IQS_cartoon&amp;quot; and &amp;quot;3IQS_surface&amp;quot; as shown in the image below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr01.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 2'''&lt;br /&gt;
Turn off the display of &amp;quot;3IQS_surface&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr02.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 3'''&lt;br /&gt;
Save the displayed &amp;quot;3IQS_cartoon&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr03.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 4'''&lt;br /&gt;
Hide the &amp;quot;3IQS_cartoon&amp;quot; and display the &amp;quot;3IQS_surface&amp;quot;. Again, save the displayed &amp;quot;3IQS_surface&amp;quot; as a VRML file, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr04.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 5'''&lt;br /&gt;
Start Blender (please see link in the Introduction to download and install). Assuming you are looking at the default scene and window layout, press '''7''' on '''numeric keypad''' and the view should change similar to the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr05.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Now select the '''cube''' in the center of the screen by '''right clicking''' on it and then press '''ctrl-x''' to delete it. This will give you a clean scene to import the protein structure you just exported from PyMOL as VRML 2 (.wrl).&lt;br /&gt;
&lt;br /&gt;
* '''Step 6'''&lt;br /&gt;
Now import the &amp;quot;3IQS_cartoon&amp;quot; into Blender by going to &amp;quot;File &amp;gt; Import &amp;gt; X3D &amp;amp; VRML97&amp;quot; as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr06.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 7'''&lt;br /&gt;
Navigate to the folder where you exported the VRML 2 files from PyMOL and select the &amp;quot;3IQS_cartoon&amp;quot; file, thusly:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr07.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
Click the &amp;quot;Import X3D/VRML97&amp;quot; button after selecting the correct file and just click &amp;quot;OK&amp;quot; on the dialog that comes up.&lt;br /&gt;
&lt;br /&gt;
* '''Step 8'''&lt;br /&gt;
Doing the above should result in a display such as the one below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr08.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 9'''&lt;br /&gt;
Now you need to select the just imported cartoon and just that only, so '''right click''' on it so that it is the only object selected in the view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr09.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 10'''&lt;br /&gt;
With the cartoon object selected, hit the '''Tab'' key on your keyboard to enter into &amp;quot;Edit mode&amp;quot; in Blender. All the vertices  that make up this object will be selected and colored yellow, as shown below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr10.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 11'''&lt;br /&gt;
Now click on &amp;quot;Mesh &amp;gt; Vertices &amp;gt; Remove Doubles&amp;quot; in Blender to get rid of duplicate vertices, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr11.png|center|350px]]&lt;br /&gt;
[[Image:Scr12.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 12'''&lt;br /&gt;
Now hit the '''Tab'' key again, to exit the &amp;quot;Edit mode&amp;quot; to see a nice smooth cartoon object:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr13.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 13'''&lt;br /&gt;
This cartoon is too big to be visible in the Blender's camera viewport while rendering, so we need to scale it down by hitting the &amp;quot;S&amp;quot; key once, then moving the mouse so that the object becomes smaller in size and then clicking the left mouse button to accept the new size:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr14.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
The final size should be small enough to completely fit in the &amp;quot;Camera view&amp;quot; in Blender. You can enter the &amp;quot;Camera view&amp;quot; by hitting the zero '''0''' key on the '''numeric keypad'''. Scale the object so that it fits within the camera boundaries:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr15.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 14'''&lt;br /&gt;
Now import the &amp;quot;3IQS_surface&amp;quot; VRML 2 file and process it the same way (steps 6 to 13):&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' You may hold off doing &amp;quot;Step 13&amp;quot;, the scaling, until you have imported and processed all objects that you exported from PyMOL. It is best to import and process all the objects and then scale them together to maintain the same scaling ratio for all. You can select multiple objects in blender by holding down the '''Shift''' key while right-clicking on individual objects.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr16.png|center|350px]]&lt;br /&gt;
[[Image:Scr17.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 15'''&lt;br /&gt;
In order to assign different colors (&amp;quot;materials&amp;quot; in Blender-speak) to each object, it is easier to go to camera view (num-pad 0), toggle into &amp;quot;wireframe view&amp;quot; ('''Z''' key) and select an object by right-clicking with the mouse. In the following image, the &amp;quot;3IQS_cartoon&amp;quot; is selected in the wireframe view:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr18.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 16'''&lt;br /&gt;
Now select the &amp;quot;3IQS_surface&amp;quot; and toggle back into &amp;quot;solid view&amp;quot; mode ('''Z''' key). Make sure the two buttons with spherical icons are clicked in the bottom panel and the click on the color pad next to the &amp;quot;Col&amp;quot; button to bring up the color selector. You may select any color, in this example a greenish color is asigned.&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr19.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 17'''&lt;br /&gt;
In order to make the surface translucent and have short rendering times, it is easiest to change the Z-transparency of the surface by clicking the '''Z-transp''' button on the panel, followed by changing the '''A''' (or alpha) value to below 1.0, as shown in the two images below:&lt;br /&gt;
&lt;br /&gt;
[[Image:Scr20.png|center|350px]]&lt;br /&gt;
[[Image:Scr21.png|center|350px]]&lt;br /&gt;
&lt;br /&gt;
* '''Step 18'''&lt;br /&gt;
You may similarly select the just the cartoon object and assign it another &amp;quot;material&amp;quot;/color. To render the scene, hit the '''F12''' key on you keyboard, this will render the image in a new &amp;quot;render&amp;quot; window. You can then save the rendered image by hitting '''F3''' key in the render window and then specifying a location and filename.&lt;br /&gt;
&lt;br /&gt;
[[Image:3IQS_final.png|center|500px]]&lt;br /&gt;
&lt;br /&gt;
Play with other parameters and use the Blender manual/wiki to learn more about this awesome complement to PyMOL.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Blender : http://www.blender.org/&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:3IQS_final.png&amp;diff=1600</id>
		<title>File:3IQS final.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:3IQS_final.png&amp;diff=1600"/>
		<updated>2009-12-22T16:44:56Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr21.png&amp;diff=2665</id>
		<title>File:Scr21.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr21.png&amp;diff=2665"/>
		<updated>2009-12-22T16:44:43Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr20.png&amp;diff=2543</id>
		<title>File:Scr20.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr20.png&amp;diff=2543"/>
		<updated>2009-12-22T16:44:33Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr19.png&amp;diff=2789</id>
		<title>File:Scr19.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr19.png&amp;diff=2789"/>
		<updated>2009-12-22T16:44:23Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr18.png&amp;diff=2663</id>
		<title>File:Scr18.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr18.png&amp;diff=2663"/>
		<updated>2009-12-22T16:44:14Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr17.png&amp;diff=2541</id>
		<title>File:Scr17.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr17.png&amp;diff=2541"/>
		<updated>2009-12-22T16:44:03Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr16.png&amp;diff=2787</id>
		<title>File:Scr16.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr16.png&amp;diff=2787"/>
		<updated>2009-12-22T16:43:53Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr15.png&amp;diff=2661</id>
		<title>File:Scr15.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr15.png&amp;diff=2661"/>
		<updated>2009-12-22T16:43:41Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr14.png&amp;diff=2539</id>
		<title>File:Scr14.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr14.png&amp;diff=2539"/>
		<updated>2009-12-22T16:43:30Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr13.png&amp;diff=2785</id>
		<title>File:Scr13.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr13.png&amp;diff=2785"/>
		<updated>2009-12-22T16:43:19Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr12.png&amp;diff=2659</id>
		<title>File:Scr12.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr12.png&amp;diff=2659"/>
		<updated>2009-12-22T16:43:09Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr11.png&amp;diff=2537</id>
		<title>File:Scr11.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr11.png&amp;diff=2537"/>
		<updated>2009-12-22T16:42:58Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr10.png&amp;diff=2783</id>
		<title>File:Scr10.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr10.png&amp;diff=2783"/>
		<updated>2009-12-22T16:42:47Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr09.png&amp;diff=2657</id>
		<title>File:Scr09.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr09.png&amp;diff=2657"/>
		<updated>2009-12-22T16:42:37Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr08.png&amp;diff=2535</id>
		<title>File:Scr08.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr08.png&amp;diff=2535"/>
		<updated>2009-12-22T16:42:25Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr07.png&amp;diff=2781</id>
		<title>File:Scr07.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr07.png&amp;diff=2781"/>
		<updated>2009-12-22T16:42:12Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr06.png&amp;diff=2655</id>
		<title>File:Scr06.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr06.png&amp;diff=2655"/>
		<updated>2009-12-22T16:42:00Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:Scr05.png&amp;diff=2533</id>
		<title>File:Scr05.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:Scr05.png&amp;diff=2533"/>
		<updated>2009-12-22T16:41:48Z</updated>

		<summary type="html">&lt;p&gt;Shiven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Shiven</name></author>
	</entry>
</feed>