| Program | Draw | Presets 
            
             Category: Realtime > OpenGL 
            
             Shader Family: Realtime 
            
             Output: Realtime 
            
            Builds a complete program using the high-level OpenGL Shading Language (GLSL). Vertex and fragment shaders can be defined
               as one "entity" within a single GLSL Shader node. For general information about working with this shader, see Setting Up a Unified GLSL Program [Realtime Shaders]. 
            
             
               Program
               
 
                  
                     
                        
                        
                     
                     
                        |   
                            | Sets the build options for your GLSL program:  | 
                     
                        |   
                            | Enables debug messages. Compilation results are logged and available from the script editor's log window.  To open the script editor, click the script icon at the bottom of the Softimage interface.    | 
                  
                 
                
                  GLSL Vertex Program and Fragment Program
                  
 
                  Enter the code for your vertex shader and fragment shader in the appropriate text editor. You can also load one of the preset
                     shaders available from the Presets tab. 
                  
  
                  The text editor supports text customization (font, color, size), syntax styling, folding (hiding blocks such as functions
                     and subroutines), auto-completion and highlighting for keywords. You can also implement this text editor widget in your own
                     plug-ins. For more information, see Text Editor Widget [SDK Guide]. 
                  
 
                 
             
             
               Draw
               
  
               You do not need to connect the GLSL Program node to a Draw node in the render tree because the draw operations are handled
                  directly within the GLSL Program shader. 
               
 
                
                  Blending
                  
 
                  In RGBA mode, pixels can be drawn using a function (glBlendFunc) that blends the incoming (source) RGBA values with the RGBA values that are already in the frame buffer (the destination
                     values). For more information, see How Blending Works. 
                  
 
                     
                        
                           
                           
                        
                        
                           |   
                               | Enable or disable blending. When enabled, the blend function defines the operation of blending.  | 
                        
                           |   
                               | The blend source factor (sfactor) specifies which method is used to scale the source color components. 
                               Select one of the supported methods from the drop-down menu. Each method defines four scale factors, one each for red, green,
                                 blue, and alpha. All scale factors have range [0,1]. 
                               | 
                        
                           |   
                               | The blend destination factor (dfactor) specifies which method is used to scale the destination color components. 
                               Select one of the supported methods from the drop-down menu. Each method defines four scale factors, one each for red, green,
                                 blue, and alpha. All scale factors have range [0,1]. 
                               | 
                     
                    
                 
                
                  Alpha Testing
                  
 
                  Alpha testing (glAlphaFunc) discards fragments depending on the outcome of a comparison between an incoming fragment's alpha value and a constant reference
                     value. The alpha test specifies the reference value and the comparison function. The comparison is performed only if alpha
                     testing is enabled. 
                  
 
                  The alpha function and alpha reference specify the conditions under which the pixel is drawn. The incoming alpha value is
                     compared to  using the function specified by . If the value passes the comparison, the incoming fragment is drawn if it also passes subsequent stencil and depth buffer
                     tests. If the value fails the comparison, no change is made to the frame buffer at that pixel location. 
                  
 
                  Alpha testing operates on all pixel write operations, including those resulting from the scan conversion of points, lines,
                     polygons, and bitmaps, and from pixel draw and copy operations. It does not affect screen clear operations. 
                  
 
                  NoteAlpha testing is performed only in RGBA mode. 
                     
                  
                     
                        
                           
                           
                        
                        
                           |   
                               | Enable or disable alpha testing.  | 
                        
                           |   
                               | Specifies the alpha comparison function (func). 
                               Select one of the supported comparison functions from the drop-down menu. The functions are defined as follows:  
                                  
                                     ¥GL_NEVER 
                                     Never passes. 
                                     
                                     GL_LESS 
                                     Passes if the incoming alpha value is less than the reference value. 
                                     
                                     GL_EQUAL 
                                     Passes if the incoming alpha value is equal to the reference value. 
                                     
                                     GL_LEQUAL 
                                     Passes if the incoming alpha value is less than or equal to the reference value. 
                                     
                                     GL_GREATER 
                                     Passes if the incoming alpha value is greater than the reference value. 
                                     
                                     GL_NOTEQUAL 
                                     Passes if the incoming alpha value is not equal to the reference value. 
                                     
                                     GL_GEQUAL 
                                     Passes if the incoming alpha value is greater than or equal to the reference value. 
                                     
                                     GL_ALWAYS 
                                     Always passes. 
                                     | 
                        
                           |   
                               | Specifies the reference value (ref) that incoming alpha values are compared to. This value is clamped to the range [0,1], where 0 represents the lowest possible
                                 alpha value and 1 the highest possible value. 
                               | 
                     
                    
                 
                
                  Particle Cloud
                  
 
                     
                        
                           
                           
                        
                        
                           |   
                               | Enables the use of OpenGL point sprites. Draws an arbitrary shape at each point position by means of a texture called a point
                                 sprite. If this shader is applied to a point cloud, it will render sprites instead of points. 
                               | 
                     
                    
                 
             
             
               Presets
               
 
                
                  Particle Cloud
                  
 
                     
                        
                           
                           
                        
                        
                           |   
                               | A simple GLSL shader that transforms the incoming vertices by the current modelview matrix using the ftransform() function.
                                 This is equivalent to transforming the point using fixed-function. 
                               | 
                        
                           |   
                               | Renders a particle cloud as a set of colored points of varying sizes. Both Color and Size must be initialized attributes in
                                 your ICE tree. See Getting and Setting Data in ICE Trees [ICE Guide]. 
                               | 
                        
                           |   
                               | Renders a particle cloud as points of varying size and color depending on age.  | 
                        
                           |   
                               | Renders a particle cloud as points of varying color dependant on each particle's velocity.  This shader takes the PointVelocity ICE attribute and puts it in the normal register. Then, the vertex shader takes the length
                                 of the vector and puts it in a float value called l_fAbsVel (absolute velocity). It then uses that value to drive the red
                                 component of each particle. 
                               | 
                     
                    
                 
                
                  Triangle Mesh
                  
 
                     
                        
                           
                           
                        
                        
                           |   
                               | A vertex and fragment shader that implement a point light source.  | 
                        
                           |   
                               | A vertex and fragment shader that implement a spotlight source.  | 
                        
                           |   
                               | A vertex and fragment shader that implement spherical harmonics lighting.  | 
                     
                    
                 
             
             
               Advanced
               
  
               Graphics hardware usually have a small number of fixed locations for passing standard and generic vertex attributes. Therefore,
                  the OpenGL Shading Language defines each non-matrix attribute variable as having space for up to four floating-point values
                  (a vec4). There is an implementation dependent limit on the number of attribute variables that can be used and if this is
                  exceeded it will cause a link error. However, attribute variables that are declared but not used do not count against this
                  limit. A float attribute counts the same amount against this limit as a vec4, so you may want to use attribute packing techniques
                  such as grouping four unrelated float attributes together into a vec4 to better utilize the capabilities of the underlying
                  hardware. Softimage's GLSL Program shader will ignore any matrix attributes that are mapped to a register. 
               
 
                
                  Hardware Attribute Mapping
                  
 
                     
                        
                           
                           
                        
                        
                           |   | 
                                  
                                    Click and choose  or  to set the default attribute mappings for a polygon mesh or a point cloud. 
                                     
                                    Click and choose  to empty the entire hardware attribute mapping table. You can then add your mapping entries from scratch. 
                                     | 
                        
                           |   | Refreshes the attributes and registers available in each list. Refreshing is particularly useful when you have made modifications
                                 to the polygon mesh or point cloud being read by the shader. Any new (or recently initialized) attributes are displayed in
                                 the attributes list. If a register is no longer assigned it will be added back to the registers list. 
                               | 
                        
                           |   | Adds an attribute and register mapping (row) to the hardware attribute mapping table. To modify this mapping, first click
                                 the attribute entry and select an available attribute from the attributes list. Then click the corresponding register entry
                                 and select an available register from the registers list. 
                               | 
                        
                           |   | Deletes the selected attribute and register mapping (row) from the hardware attribute mapping table.  | 
                        
                           |   
                               | The Attribute column of the hardware attribute mapping table holds the attribute entries that each represent one of the 0D
                                 components that exist or can be created on the polygon mesh or point cloud. 
                               | 
                        
                           |   
                               | The Hardware Register column of the hardware attribute mapping table holds the register entries that each represent one of
                                 the possible register locations available on most OpenGL graphics accelerators. 
                               | 
                     
                    
                 
                
                  Register Mapping Information
                  
 
                     
                        
                           
                           
                           
                           
                           
                        
                        
                           | Vertex Attributes Passed Using...  | Type  | Components  | Hardware Register  | Additional Information  | 
                        
                           | gl_Color  | vec4  | r, g, b, a  | color0  | Typically used for vertex colors.  | 
                        
                           | gl_SecondaryColor  | vec4  | r, g, b, a  | color1  | Typically used for vertex colors.  | 
                        
                           | gl_Normal  | vec3  | x, y, z  | normal  | Typically used for normal coordinates.  | 
                        
                           | gl_Vertex  | vec4  | x, y, z, w  | position  | Typically used for vertex coordinates.  | 
                        
                           | gl_PointSize  | float  | x  | psize  | Typically used for point size (pixels).  | 
                        
                           | gl_MultiTexCoord0  | vec4  | x, y, z, w  | texcoord0  | Typically used for texture coordinates.  | 
                        
                           | gl_MultiTexCoord1  | vec4  | x, y, z, w  | texcoord1  | Typically used for texture coordinates.  | 
                        
                           | gl_MultiTexCoord2  | vec4  | x, y, z, w  | texcoord2  | Typically used for texture coordinates.  | 
                        
                           | gl_MultiTexCoord3  | vec4  | x, y, z, w  | texcoord3  | Typically used for texture coordinates.  | 
                        
                           | gl_MultiTexCoord4  | vec4  | x, y, z, w  | texcoord4  | Typically used for texture coordinates.  | 
                        
                           | gl_MultiTexCoord5  | vec4  | x, y, z, w  | texcoord5  | Typically used for texture coordinates.  | 
                        
                           | gl_MultiTexCoord6  | vec4  | x, y, z, w  | texcoord6  | Typically used for texture coordinates.  | 
                        
                           | gl_MultiTexCoord7  | vec4  | x, y, z, w  | texcoord7  | Typically used for texture coordinates.  | 
                        
                           | gl_FogCoord  | float  | x  | fogcoord  | Typically used for fog coordinates.  | 
                        
                           | glVertexAttrib  | short,  float,  int,  double,  unsigned byte,  unsigned short,  unsigned int  | x, y, z, w  | attr[0...15]  | Softimage's GLSL shader does not support the passing of generic vertex attribute values to attr hardware registers. 
                               If you are using the glVertexAttrib family of entry points to pass generic vertex attributes into numbered locations, you
                                 will have to write your own application code (shader objects) to be able to take advantage of the attr hardware resgisters. 
                               | 
                        
                           | glMultiTexCoord[6]  | vec4  | x, y, z, w  | tangent  | OpenGL does not have a defined vertex attribute for a tangent vector.  You can assign it to the tangent register which is aliased to the texcoord6 register.  Softimage encodes tangents into a 4-float rgba vertex color.  | 
                        
                           | glMultiTexCoord[7]  | vec4  | x, y, z, w  | binormal  | OpenGL does not have a defined vertex attribute for a binormal vector.  You can assign it to the binormal register which is aliased to the texcoord7 register.  Softimage encodes binormals into a 4-float rgba vertex color.  | 
                        
                           | D3DDECLUSAGE_BLENDWEIGHT  |  | x, y, z, w  | weight  | Softimage's GLSL Program shader does not support the passing of values to these registers. However, these registers are made
                                 available in anticipation that shader developers will rewrite this shader implementation to take advantage of DirectX-based
                                 GPU skinning features. 
                               | 
                        
                           | D3DDECLUSAGE_BLENDINDICES  |  | x, y, z, w  | indice  |  | 
                        
                           | D3DDECLUSAGE_SAMPLE  |  | x, y, z, w  | sample  |  | 
                        
                           | D3DDECLUSAGE_TESSFACTOR  |  | x  | tessfactor  |  | 
                        
                           | D3DDECLUSAGE_DEPTH  |  | x  | depth  |  |