1 | // Any number of lights, diffuse |
---|
2 | material BumpMap_Base |
---|
3 | { |
---|
4 | technique |
---|
5 | { |
---|
6 | // Base ambient pass |
---|
7 | pass ambient |
---|
8 | { |
---|
9 | // base colours, not needed for rendering, but as information |
---|
10 | // to lighting pass categorisation routine |
---|
11 | diffuse 0 0 0 |
---|
12 | // need to prevent flickering |
---|
13 | depth_write on |
---|
14 | depth_bias 0 |
---|
15 | |
---|
16 | } |
---|
17 | // Now do the lighting pass |
---|
18 | // NB we don't do decal texture here because this is repeated per light |
---|
19 | pass perlight |
---|
20 | { |
---|
21 | |
---|
22 | // do this for each light |
---|
23 | iteration once_per_light |
---|
24 | scene_blend add |
---|
25 | |
---|
26 | // need to prevent flickering |
---|
27 | depth_write on |
---|
28 | depth_bias 1 |
---|
29 | |
---|
30 | // base colours, not needed for rendering, but as information |
---|
31 | // to lighting pass categorisation routine |
---|
32 | ambient 0 0 0 |
---|
33 | |
---|
34 | // Vertex program reference |
---|
35 | vertex_program_ref BumpMapping/BumpMapVP |
---|
36 | { |
---|
37 | param_named_auto lightPosition light_position_object_space 0 |
---|
38 | param_named_auto worldViewProj worldviewproj_matrix |
---|
39 | } |
---|
40 | |
---|
41 | // Fragment program |
---|
42 | fragment_program_ref BumpMapping/BumpMapFP |
---|
43 | { |
---|
44 | param_named_auto lightDiffuse light_diffuse_colour 0 |
---|
45 | } |
---|
46 | |
---|
47 | // texture shadow receiver program |
---|
48 | shadow_receiver_vertex_program_ref BumpMapping/BumpMapVPShadowRcv |
---|
49 | { |
---|
50 | param_named_auto lightPosition light_position_object_space 0 |
---|
51 | param_named_auto worldViewProj worldviewproj_matrix |
---|
52 | param_named_auto worldMatrix world_matrix |
---|
53 | param_named_auto texViewProj texture_viewproj_matrix |
---|
54 | } |
---|
55 | // Additive texture shadow receiver program |
---|
56 | shadow_receiver_fragment_program_ref BumpMapping/BumpMapFPShadowRcv |
---|
57 | { |
---|
58 | param_named_auto lightDiffuse light_diffuse_colour 0 |
---|
59 | } |
---|
60 | |
---|
61 | // Vertex program reference |
---|
62 | vertex_program_ref BumpMapping/BumpMapVPSpecular |
---|
63 | { |
---|
64 | param_named_auto lightPosition light_position_object_space 0 |
---|
65 | param_named_auto eyePosition camera_position_object_space |
---|
66 | param_named_auto worldViewProj worldviewproj_matrix |
---|
67 | } |
---|
68 | |
---|
69 | // Fragment program |
---|
70 | fragment_program_ref BumpMapping/BumpMapFPSpecular |
---|
71 | { |
---|
72 | param_named_auto lightDiffuse light_diffuse_colour 0 |
---|
73 | param_named_auto lightSpecular light_specular_colour 0 |
---|
74 | } |
---|
75 | |
---|
76 | |
---|
77 | // Base bump map |
---|
78 | texture_unit normalmap |
---|
79 | { |
---|
80 | texture Cube_Lava_NORM.jpg |
---|
81 | colour_op replace |
---|
82 | } |
---|
83 | } |
---|
84 | |
---|
85 | // Decal pass |
---|
86 | pass decal |
---|
87 | { |
---|
88 | // base colours, not needed for rendering, but as information |
---|
89 | // to lighting pass categorisation routine |
---|
90 | lighting off |
---|
91 | // need to prevent flickering |
---|
92 | depth_write on |
---|
93 | depth_bias 2 |
---|
94 | |
---|
95 | scene_blend dest_colour zero |
---|
96 | texture_unit decalmap |
---|
97 | { |
---|
98 | texture Cube_Lava_COLOR.jpg |
---|
99 | } |
---|
100 | } |
---|
101 | } |
---|
102 | } |
---|
103 | |
---|
104 | // Example for Material using this template // |
---|
105 | // import * from "BumpMap.material" |
---|
106 | // // Any number of lights, diffuse |
---|
107 | // material Cube_Lava_Normal : BumpMap_Base |
---|
108 | // { |
---|
109 | // technique |
---|
110 | // { |
---|
111 | // pass ambient |
---|
112 | // { |
---|
113 | // } |
---|
114 | // // Now do the lighting pass |
---|
115 | // // NB we don't do decal texture here because this is repeated per light |
---|
116 | // pass perlight |
---|
117 | // { |
---|
118 | // // Base bump map |
---|
119 | // texture_unit normalmap |
---|
120 | // { |
---|
121 | // texture Cube_Lava_NORM.jpg |
---|
122 | // colour_op replace |
---|
123 | // } |
---|
124 | // } |
---|
125 | |
---|
126 | // // Decal pass |
---|
127 | // pass decal |
---|
128 | // { |
---|
129 | // texture_unit decalmap |
---|
130 | // { |
---|
131 | // texture Cube_Lava_COLOR.jpg |
---|
132 | // } |
---|
133 | // } |
---|
134 | // } |
---|
135 | // } |
---|