PASSIONSYS-TXT # Real world shader sample: Base + Environment Mapped # Note that the texture can be a simple 2D texture (for a sphere map) # or it can be a cubemap texture. Either way this definition is exactly the # same! # # Basic setup description: # One Pass material, # Pass 1: Two textures # Texture 1 : base texture # Texture 2 : "environment" texture, UV's from REFLECT in WORLD coordinates # Combiners: out = tex1 + tex2 * 0.75 # If true, Indicate we want some feedback about how these values were read. # (They appear in the FATBASTARD.LOG file) # Otherwise things are much more silent. debugTextParse true # Identify that we are defining a material (the name of the file is the name # of the material) materialDef [ 0 ] ( # We only need one shader pass struct Simple4T { # blendEnable true blendSrcFactor 4 blendDstFactor 5 blendCombineOp 0 alphaTestEnable false enableLighting true enableSpecular true frontMaterial struct LitResponse { # ambientColor < (0-255) (0-255) (0-255) (0-255) > # diffuseColor < (0-255) (0-255) (0-255) (0-255) > # specularColor < (0-255) (0-255) (0-255) (0-255) > # emissiveColor < (0-255) (0-255) (0-255) (0-255) > # (default < 0 0 0 0 > ) # Each of these takes an RGBA color describing how the # shader responds to the appropriate light colors. ambientColor < 255 255 255 255 > diffuseColor < 255 255 255 255 > specularColor < 202 202 202 202 > emissiveColor < 0 0 0 0 > # specularExponent (0.0 - 1000000.0) (default 0) # Affects the size of the specular highlight. specularExponent 50 # vertexColorAs (0 - 4) (default 2) # Describes what the vertex color is used for when the # shader is being lit. # 0 : The vertex color is ignored. # 1 : The vertex color is used in place of the ambient # color value given just above. # 2 : The vertex color is used in place of the diffuse # color value given just above. # 3 : The vertex color is used in place of the specular # color value given just above. # 4 : The vertex color is used in place of the emissive # color value given just above. vertexColorAs 2 } # Not all the possible settings are given here, so they assume # their defaults. # Define the two textures textures [ 0 ] ( struct Texture # Texture 1 { # Not all the possible settings are given here, so they assume # their defaults. # textureFile (filename) # Identifies the texture file to use. textureFile "B13_OrbFighter_c01.dds" # coordSrc (0 - 3) (default 0) # Controls the source of UV values used to look up # texels. # 0 : Explicit UV values must be given per vertex. # (see coordChannel) # 1 : The vertex normal is used as a source UV value. # (see also coordSys) # 2 : The vertex position is used as a source UV # value. # (see also coordSys) # 3 : A reflection vector involving the eye position, # vertex position, and vertex normal is used. # (see also coordSys) coordSrc 0 # coordChannel (1 - ??) (default 1) # For explicit UV sources, this is the MAX mapping # channel to use. coordChannel 1 } struct Texture # Texture 2 { # Not all the possible settings are given here, so they assume # their defaults. # Set up slow U scroll with a positive scale offsetV < 1 0.25 0.0 1.0 0.0 > # textureFile (filename) # Identifies the texture file to use. textureFile "ww_blueblink_c01.dds" # coordSrc (0 - 3) (default 0) # Controls the source of UV values used to look up # texels. # 0 : Explicit UV values must be given per vertex. # (see coordChannel) # 1 : The vertex normal is used as a source UV value. # (see also coordSys) # 2 : The vertex position is used as a source UV # value. # (see also coordSys) # 3 : A reflection vector involving the eye position, # vertex position, and vertex normal is used. # (see also coordSys) coordSrc 0 # coordSys (0 - 2) (default 0) # The coordinate system to transform the source UV # value into before doing further work with it. # # 0 : The UV values are transformed to camera # coordinates. # 1 : The UV values are transformed to world # coordinates. # 2 : The UV values are transformed to model # coordinates. # # Explicit UV values are considered to be in MODEL # coordinates, so specifying "coordSys 2" means to # leave them as is. Otherwise you will get something # much more funky. # # Examples of use: # Perform texture lookups as for a spherical # environment map: # coordSrc 3 # coordSys 1 # coordCount 3 # # Generate texture coordinates based on where # the object is in the world (ie, planar map # a cloud shadow texture to the object, without # requiring the object to have explicit UV's) # Also give a slow U scroll to the texture. # coordSrc 1 # coordSys 1 # coordCount 3 # offsetU < 1 0.01 0 1 0 > # coordSys 2 # coordCount (0 - 3) (default 0) # Indicates the dimension and transform needs # for the texture coordinates. # 0 : The 'coordSys' above is ignored -- texture # coordinates are generated according to # 'coordSrc', and are passed without # further modification to be used to look # up texture values. # 1: A 1 dimensional transform is performed. # 2: A 2 dimensional transform is performed. # 3: A 3 dimensional transform is performed. coordCount 2 } ) # Combiner stages (max 8) # # Syntax: [ [] ] # # "temp1" should be set with the result as the last combiner # # dest/src can be: # "zero" "diffuse" "specular" "tex1" "tex2" # "tex3" "tex4" "temp1" "temp2" # op can be # "mov" - Set dst to src1 # "mix" - Alpha blend src2 on top of src1 # "add" - Add src2 to src1 # "sub" - Subtract src2 from src1 # "mult" - Multipliy src2 with src1 # # Pure Syntax Examples: # < "mov" "temp1" "tex1" > # temp1 = tex1 # # < "mix" "temp1" "tex1" "tex2" > # temp1 = tex1 * (1-tex2.a) + tex2 * tex2.a (alpha blend) # # < "mix" "temp1" "tex1" "tex2" 0.25 > # temp1 = tex1 * 0.75 + tex2 * 0.25 (constant blend) # # < "add" "temp1" "tex1" "tex2" > # temp1 = tex1 + tex2 # # < "add" "temp1" "tex1" "tex2" 0.25 > # temp1 = tex1 + tex2 * 0.25 # # < "sub" "temp1" "tex1" "tex2" > # temp1 = tex1 - tex2 # # < "sub" "temp1" "tex1" "tex2" 0.25 > # temp1 = tex1 - tex2 * 0.25 # # < "mult" "temp1" "tex1" "tex2" > # temp1 = tex1 * tex2 # # Useful Examples: # Modulate the diffuse color with the texture: # < "temp1" "mult" "diffuse" "tex1" > # # Mix three textures together, and modulate with the diffuse # color: # < "temp1" "mix" "tex1" "tex2" > # < "temp1" "mix" "temp1" "tex3" > # < "temp1" "mult" "diffuse" "tex1" > # # Add texture 3 on top of the mix of 1 and 2, do not modulate # with the diffuse color: # < "temp1" "mix" "tex1" "tex2" > # < "temp1" "add" "temp1" "tex3" > # # combiners [ 0 ] ( < "temp1" "mult" "tex1" "diffuse" > #< "temp1" "mult" "temp1" "tex2" > #< "temp2" "add" "tex2" "diffuse" > # Modulate the diffuse/vertex color with the textures < "temp1" "mix" "tex2" "temp1" > ) } )