Virtual Ambient Light Textures

From The DarkMod Wiki
Revision as of 06:08, 26 November 2010 by Tels (talk | contribs) (update for v1.03)
Jump to navigationJump to search

To improve performance on some low-end systems, Dark Mod textures can simulate the main ambient light. This feature pre-calculates how much textures should be illuminated once only instead of continuously. Players can select between three methods, so those with faster machines can use the true ambient light which gives better quality.

So all textures should include these two stages:

        // TDM Ambient Method Related
        {
                if (global5 == 1)
                blend add
                map                             textures/darkmod/yourname
                scale                   1, 1
                red                             global2
                green                   global3
                blue                    global4
        }
        {
                if (global5 == 2)
                blend add
                program ambientEnvironment.vfp
                vertexParm              0               1, 1, 1, 1              // UV Scales for Diffuse and Bump
                vertexParm              1               1, 1, 1, 1      // (X,Y) UV Scale for specular
                vertexParm              2               global2, global3, global4, 1

                fragmentMap             0               cubeMap env/gen1
                fragmentMap             1               textures/darkmod/yourname_local                  // Bump
                fragmentMap             2               textures/darkmod/yourname                        // Diffuse
                fragmentMap             3               _black                  // Specular
        }