Go to the source code of this file.
Defines | |
#define | FASTONESIDEDSPHERES 1 |
\file vmdsphere.frag \brief VMD OpenGL fragment shader implementing a ray-cast sphere primitive with per-pixel lighting, phong highlights, etc. The sphere is drawn within the confines of a correctly transformed bounding cube or viewer-aligned billboard. Much of the shading code is shared with the main VMD fragment shader, with a few optimizations that simplify the sphere shader due to the way it is specifically known to be used within VMD. Certain texturing modes can't actually occur in practice, so the shader can be simplified relative to what the main fragment shader must implement. VMD shaders require GLSL version 1.10 (or later) for minimum features XXX If/when we implement usage of ARB_sample_shading for antialiasing of the sphere shader, we will have to crank the GLSL fragment shader version to 130. macro to enable one-sided spheres for improved speed. More... | |
Functions | |
void | main (void) |
VMD Sphere Fragment Shader (not for normal geometry). More... | |
Variables | |
varying vec3 | oglcolor |
interpolated color from the vertex shader. More... | |
varying vec3 | V |
view direction vector. More... | |
varying vec3 | spherepos |
sphere origin. More... | |
varying vec3 | rayorigin |
ray origin. More... | |
varying float | sphereradsq |
sphere rad^2. More... | |
uniform vec3 | vmdlight0 |
light 0 direction. More... | |
uniform vec3 | vmdlight1 |
light 1 direction. More... | |
uniform vec3 | vmdlight2 |
light 2 direction. More... | |
uniform vec3 | vmdlight3 |
light 3 direction. More... | |
uniform vec3 | vmdlight0H |
light 0 Blinn halfway vector. More... | |
uniform vec3 | vmdlight1H |
light 1 Blinn halfway vector. More... | |
uniform vec3 | vmdlight2H |
light 2 Blinn halfway vector. More... | |
uniform vec3 | vmdlight3H |
light 3 Blinn halfway vector. More... | |
uniform vec4 | vmdlightscale |
VMD light on/off state for all 4 VMD lights, represented as a scaling constant. Could be done with on/off flags but ATI doesn't deal well with branching constructs, so this value is simply multiplied by the light's contribution. Hacky, but it works for now. More... | |
uniform vec4 | vmdmaterial |
VMD material properties [0] is ambient (white ambient light only) [1] is diffuse [2] is specular [3] is shininess. More... | |
uniform int | vmdprojectionmode |
perspective=1 orthographic=0. More... | |
uniform vec4 | vmdprojparms |
VMD projection parameters [0] is nearClip [1] is farClip [2] is 0.5 * (farClip + nearClip) [3] is 1.0 / (farClip - nearClip). More... | |
uniform float | vmdopacity |
VMD global alpha value. More... | |
uniform float | vmdoutline |
VMD outline shading. More... | |
uniform float | vmdoutlinewidth |
VMD outline shading width. More... | |
uniform int | vmdtransmode |
VMD transparency mode. More... | |
uniform int | vmdfogmode |
VMD depth cueing / fog mode. More... | |
uniform int | vmdtexturemode |
VMD texture mode 0=off 1=modulate 2=replace. More... | |
uniform sampler3D | vmdtex0 |
active 3-D texture map. More... |
|
\file vmdsphere.frag \brief VMD OpenGL fragment shader implementing a ray-cast sphere primitive with per-pixel lighting, phong highlights, etc. The sphere is drawn within the confines of a correctly transformed bounding cube or viewer-aligned billboard. Much of the shading code is shared with the main VMD fragment shader, with a few optimizations that simplify the sphere shader due to the way it is specifically known to be used within VMD. Certain texturing modes can't actually occur in practice, so the shader can be simplified relative to what the main fragment shader must implement. VMD shaders require GLSL version 1.10 (or later) for minimum features XXX If/when we implement usage of ARB_sample_shading for antialiasing of the sphere shader, we will have to crank the GLSL fragment shader version to 130. macro to enable one-sided spheres for improved speed.
Definition at line 38 of file vmdsphere.frag. |
|
VMD Sphere Fragment Shader (not for normal geometry).
Definition at line 93 of file vmdsphere.frag. References dot, oglcolor, rayorigin, spherepos, sphereradsq, V, vmdfogmode, vmdlight0, vmdlight0H, vmdlight1, vmdlight1H, vmdlight2, vmdlight2H, vmdlight3, vmdlight3H, vmdlightscale, vmdmaterial, vmdopacity, vmdoutline, vmdoutlinewidth, vmdprojectionmode, vmdprojparms, vmdtex0, vmdtexturemode, and vmdtransmode. |
|
interpolated color from the vertex shader.
Definition at line 44 of file vmdsphere.frag. Referenced by main. |
|
ray origin.
Definition at line 47 of file vmdsphere.frag. Referenced by main. |
|
sphere origin.
Definition at line 46 of file vmdsphere.frag. Referenced by main. |
|
sphere rad^2.
Definition at line 48 of file vmdsphere.frag. Referenced by main. |
|
view direction vector.
Definition at line 45 of file vmdsphere.frag. Referenced by main. |
|
VMD depth cueing / fog mode.
Definition at line 85 of file vmdsphere.frag. Referenced by main. |
|
light 0 direction.
Definition at line 50 of file vmdsphere.frag. Referenced by main. |
|
light 0 Blinn halfway vector.
Definition at line 55 of file vmdsphere.frag. Referenced by main. |
|
light 1 direction.
Definition at line 51 of file vmdsphere.frag. Referenced by main. |
|
light 1 Blinn halfway vector.
Definition at line 56 of file vmdsphere.frag. Referenced by main. |
|
light 2 direction.
Definition at line 52 of file vmdsphere.frag. Referenced by main. |
|
light 2 Blinn halfway vector.
Definition at line 57 of file vmdsphere.frag. Referenced by main. |
|
light 3 direction.
Definition at line 53 of file vmdsphere.frag. Referenced by main. |
|
light 3 Blinn halfway vector.
Definition at line 58 of file vmdsphere.frag. Referenced by main. |
|
VMD light on/off state for all 4 VMD lights, represented as a scaling constant. Could be done with on/off flags but ATI doesn't deal well with branching constructs, so this value is simply multiplied by the light's contribution. Hacky, but it works for now.
Definition at line 60 of file vmdsphere.frag. Referenced by main. |
|
VMD material properties [0] is ambient (white ambient light only) [1] is diffuse [2] is specular [3] is shininess.
Definition at line 67 of file vmdsphere.frag. Referenced by main. |
|
VMD global alpha value.
Definition at line 80 of file vmdsphere.frag. Referenced by main. |
|
VMD outline shading.
Definition at line 82 of file vmdsphere.frag. Referenced by main. |
|
VMD outline shading width.
Definition at line 83 of file vmdsphere.frag. Referenced by main. |
|
perspective=1 orthographic=0.
Definition at line 73 of file vmdsphere.frag. Referenced by main. |
|
VMD projection parameters [0] is nearClip [1] is farClip [2] is 0.5 * (farClip + nearClip) [3] is 1.0 / (farClip - nearClip).
Definition at line 74 of file vmdsphere.frag. Referenced by main. |
|
active 3-D texture map.
Definition at line 87 of file vmdsphere.frag. Referenced by main. |
|
VMD texture mode 0=off 1=modulate 2=replace.
Definition at line 86 of file vmdsphere.frag. Referenced by main. |
|
VMD transparency mode.
Definition at line 84 of file vmdsphere.frag. Referenced by main. |