Home | History | Annotate | Download | only in Light
      1 MaterialDef Phong Lighting {
      2 
      3     MaterialParameters {
      4 
      5         // Compute vertex lighting in the shader
      6         // For better performance
      7         Boolean VertexLighting
      8 
      9         // Use more efficent algorithms to improve performance
     10         Boolean LowQuality
     11 
     12         // Improve quality at the cost of performance
     13         Boolean HighQuality
     14 
     15         // Output alpha from the diffuse map
     16         Boolean UseAlpha
     17 
     18         // Apha threshold for fragment discarding
     19         Float AlphaDiscardThreshold
     20 
     21         // Normal map is in BC5/ATI2n/LATC/3Dc compression format
     22         Boolean LATC
     23 
     24         // Use the provided ambient, diffuse, and specular colors
     25         Boolean UseMaterialColors
     26 
     27         // Activate shading along the tangent, instead of the normal
     28         // Requires tangent data to be available on the model.
     29         Boolean VTangent
     30 
     31         // Use minnaert diffuse instead of lambert
     32         Boolean Minnaert
     33 
     34         // Use ward specular instead of phong
     35         Boolean WardIso
     36 
     37         // Use vertex color as an additional diffuse color.
     38         Boolean UseVertexColor
     39 
     40         // Ambient color
     41         Color Ambient (MaterialAmbient)
     42 
     43         // Diffuse color
     44         Color Diffuse (MaterialDiffuse)
     45 
     46         // Specular color
     47         Color Specular (MaterialSpecular)
     48 
     49         // Specular power/shininess
     50         Float Shininess (MaterialShininess) : 1
     51 
     52         // Diffuse map
     53         Texture2D DiffuseMap
     54 
     55         // Normal map
     56         Texture2D NormalMap
     57 
     58         // Specular/gloss map
     59         Texture2D SpecularMap
     60 
     61         // Parallax/height map
     62         Texture2D ParallaxMap
     63 
     64         //Set to true is parallax map is stored in the alpha channel of the normal map
     65         Boolean PackedNormalParallax   
     66 
     67         //Sets the relief height for parallax mapping
     68         Float ParallaxHeight : 0.05       
     69 
     70         //Set to true to activate Steep Parallax mapping
     71         Boolean SteepParallax
     72 
     73         // Texture that specifies alpha values
     74         Texture2D AlphaMap
     75 
     76         // Color ramp, will map diffuse and specular values through it.
     77         Texture2D ColorRamp
     78 
     79         // Texture of the glowing parts of the material
     80         Texture2D GlowMap
     81 
     82         // Set to Use Lightmap
     83         Texture2D LightMap
     84 
     85         // Set to use TexCoord2 for the lightmap sampling
     86         Boolean SeparateTexCoord
     87 
     88         // The glow color of the object
     89         Color GlowColor
     90 
     91         // Parameters for fresnel
     92         // X = bias
     93         // Y = scale
     94         // Z = power
     95         Vector3 FresnelParams
     96 
     97         // Env Map for reflection
     98         TextureCubeMap EnvMap
     99 
    100         // the env map is a spheremap and not a cube map
    101         Boolean EnvMapAsSphereMap
    102     }
    103 
    104     Technique {
    105 
    106         LightMode MultiPass
    107 
    108         VertexShader GLSL100:   Common/MatDefs/Light/Lighting.vert
    109         FragmentShader GLSL100: Common/MatDefs/Light/Lighting.frag
    110 
    111         WorldParameters {
    112             WorldViewProjectionMatrix
    113             NormalMatrix
    114             WorldViewMatrix
    115             ViewMatrix
    116             CameraPosition
    117             WorldMatrix
    118         }
    119 
    120         Defines {
    121             LATC : LATC
    122             VERTEX_COLOR : UseVertexColor
    123             VERTEX_LIGHTING : VertexLighting
    124             ATTENUATION : Attenuation
    125             MATERIAL_COLORS : UseMaterialColors
    126             V_TANGENT : VTangent
    127             MINNAERT  : Minnaert
    128             WARDISO   : WardIso
    129             LOW_QUALITY : LowQuality
    130             HQ_ATTENUATION : HighQuality
    131 
    132             DIFFUSEMAP : DiffuseMap
    133             NORMALMAP : NormalMap
    134             SPECULARMAP : SpecularMap
    135             PARALLAXMAP : ParallaxMap
    136             NORMALMAP_PARALLAX : PackedNormalParallax
    137             STEEP_PARALLAX : SteepParallax
    138             ALPHAMAP : AlphaMap
    139             COLORRAMP : ColorRamp
    140             LIGHTMAP : LightMap
    141             SEPARATE_TEXCOORD : SeparateTexCoord
    142 
    143             USE_REFLECTION : EnvMap
    144             SPHERE_MAP : SphereMap
    145         }
    146     }
    147 
    148     Technique PreShadow {
    149 
    150         VertexShader GLSL100 :   Common/MatDefs/Shadow/PreShadow.vert
    151         FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
    152 
    153         WorldParameters {
    154             WorldViewProjectionMatrix
    155             WorldViewMatrix
    156         }
    157 
    158         Defines {
    159             DIFFUSEMAP_ALPHA : DiffuseMap
    160         }
    161 
    162         RenderState {
    163             FaceCull Off
    164             DepthTest On
    165             DepthWrite On
    166             PolyOffset 5 0
    167             ColorWrite Off
    168         }
    169 
    170     }
    171 
    172   Technique PreNormalPass {
    173 
    174         VertexShader GLSL100 :   Common/MatDefs/SSAO/normal.vert
    175         FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
    176 
    177         WorldParameters {
    178             WorldViewProjectionMatrix
    179             WorldViewMatrix
    180             NormalMatrix
    181         }
    182 
    183         Defines {
    184             DIFFUSEMAP_ALPHA : DiffuseMap
    185         }
    186 
    187         RenderState {
    188 
    189         }
    190 
    191     }
    192 
    193     Technique GBuf {
    194 
    195         VertexShader GLSL100:   Common/MatDefs/Light/GBuf.vert
    196         FragmentShader GLSL100: Common/MatDefs/Light/GBuf.frag
    197 
    198         WorldParameters {
    199             WorldViewProjectionMatrix
    200             NormalMatrix
    201             WorldViewMatrix
    202             WorldMatrix
    203         }
    204 
    205         Defines {
    206             VERTEX_COLOR : UseVertexColor
    207             MATERIAL_COLORS : UseMaterialColors
    208             V_TANGENT : VTangent
    209             MINNAERT  : Minnaert
    210             WARDISO   : WardIso
    211 
    212             DIFFUSEMAP : DiffuseMap
    213             NORMALMAP : NormalMap
    214             SPECULARMAP : SpecularMap
    215             PARALLAXMAP : ParallaxMap
    216         }
    217     }
    218 
    219     Technique FixedFunc {
    220         LightMode FixedPipeline
    221     }
    222 
    223     Technique Glow {
    224 
    225         VertexShader GLSL100:   Common/MatDefs/Misc/SimpleTextured.vert
    226         FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag
    227 
    228         WorldParameters {
    229             WorldViewProjectionMatrix
    230         }
    231 
    232         Defines {
    233             HAS_GLOWMAP : GlowMap
    234             HAS_GLOWCOLOR : GlowColor
    235         }
    236     }
    237 
    238 }