| | 1 | = Bump Mapping = |
| | 2 | To use a bump map in a material, you can create a new material script inheriting from the base bump map script. Replace both texture image files with your own files. |
| | 3 | |
| | 4 | {{{#!cpp |
| | 5 | import * from "BumpMap.material" |
| | 6 | // Any number of lights, diffuse |
| | 7 | material Cube_Lava_Normal : BumpMap_Base |
| | 8 | { |
| | 9 | technique |
| | 10 | { |
| | 11 | pass ambient |
| | 12 | { |
| | 13 | } |
| | 14 | // Now do the lighting pass |
| | 15 | // NB we don't do decal texture here because this is repeated per light |
| | 16 | pass perlight |
| | 17 | { |
| | 18 | // Base bump map |
| | 19 | texture_unit normalmap |
| | 20 | { |
| | 21 | texture Cube_Lava_NORM.jpg |
| | 22 | colour_op replace |
| | 23 | } |
| | 24 | } |
| | 25 | |
| | 26 | // Decal pass |
| | 27 | pass decal |
| | 28 | { |
| | 29 | texture_unit decalmap |
| | 30 | { |
| | 31 | texture Cube_Lava_COLOR.jpg |
| | 32 | } |
| | 33 | } |
| | 34 | } |
| | 35 | } |
| | 36 | }}} |
| | 37 | |
| | 38 | The base bump map material script is located at `[media_directory]/materials/BumpMapping/BumpMap.material` |
| | 39 | |
| | 40 | To get an idea what bump maps are capable of, start the test level `BumpMap` |
| | 41 | |