1 | |
---|
2 | //-------------- |
---|
3 | // Bump mapping |
---|
4 | //-------------- |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | // Any number of lights, diffuse and specular |
---|
9 | material Assff/BumpMap |
---|
10 | { |
---|
11 | |
---|
12 | // This is the preferred technique which uses both vertex and |
---|
13 | // fragment programs, supports coloured lights |
---|
14 | technique |
---|
15 | { |
---|
16 | // Base ambient pass |
---|
17 | pass |
---|
18 | { |
---|
19 | // base colours, not needed for rendering, but as information |
---|
20 | // to lighting pass categorisation routine |
---|
21 | ambient 1 1 1 |
---|
22 | diffuse 0 0 0 |
---|
23 | specular 0 0 0 0 |
---|
24 | // Really basic vertex program |
---|
25 | // NB we don't use fixed function here because GL does not like |
---|
26 | // mixing fixed function and vertex programs, depth fighting can |
---|
27 | // be an issue |
---|
28 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture |
---|
29 | { |
---|
30 | param_named_auto worldViewProj worldviewproj_matrix |
---|
31 | param_named_auto ambient ambient_light_colour |
---|
32 | } |
---|
33 | |
---|
34 | } |
---|
35 | // Now do the lighting pass |
---|
36 | // NB we don't do decal texture here because this is repeated per light |
---|
37 | pass |
---|
38 | { |
---|
39 | // base colours, not needed for rendering, but as information |
---|
40 | // to lighting pass categorisation routine |
---|
41 | ambient 0 0 0 |
---|
42 | // do this for each light |
---|
43 | iteration once_per_light |
---|
44 | |
---|
45 | |
---|
46 | scene_blend add |
---|
47 | |
---|
48 | // Vertex program reference |
---|
49 | vertex_program_ref BumpMapVPSpecular |
---|
50 | { |
---|
51 | param_named_auto lightPosition light_position_object_space 0 |
---|
52 | param_named_auto eyePosition camera_position_object_space |
---|
53 | param_named_auto worldViewProj worldviewproj_matrix |
---|
54 | } |
---|
55 | |
---|
56 | // Fragment program |
---|
57 | fragment_program_ref BumpMapFPSpecular |
---|
58 | { |
---|
59 | param_named_auto lightDiffuse light_diffuse_colour 0 |
---|
60 | param_named_auto lightSpecular light_specular_colour 0 |
---|
61 | param_named shine float 2 |
---|
62 | } |
---|
63 | |
---|
64 | // Base bump map |
---|
65 | texture_unit |
---|
66 | { |
---|
67 | texture nmnone.tga |
---|
68 | colour_op replace |
---|
69 | } |
---|
70 | // Normalisation cube map |
---|
71 | texture_unit |
---|
72 | { |
---|
73 | cubic_texture nm.tga combinedUVW |
---|
74 | tex_coord_set 1 |
---|
75 | tex_address_mode clamp |
---|
76 | } |
---|
77 | // Normalisation cube map #2 |
---|
78 | texture_unit |
---|
79 | { |
---|
80 | cubic_texture nm.tga combinedUVW |
---|
81 | tex_coord_set 2 |
---|
82 | tex_address_mode clamp |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | // Decal pass |
---|
87 | pass |
---|
88 | { |
---|
89 | lighting off |
---|
90 | // Really basic vertex program |
---|
91 | // NB we don't use fixed function here because GL does not like |
---|
92 | // mixing fixed function and vertex programs, depth fighting can |
---|
93 | // be an issue |
---|
94 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture |
---|
95 | { |
---|
96 | param_named_auto worldViewProj worldviewproj_matrix |
---|
97 | param_named ambient float4 1 1 1 1 |
---|
98 | } |
---|
99 | scene_blend dest_colour zero |
---|
100 | texture_unit |
---|
101 | { |
---|
102 | texture assff.JPG |
---|
103 | } |
---|
104 | |
---|
105 | } |
---|
106 | } |
---|
107 | |
---|
108 | // This is the fallback which cards which don't have fragment program |
---|
109 | // support will use, NB does not support specular colour |
---|
110 | // Note that it still requires vertex program support |
---|
111 | technique |
---|
112 | { |
---|
113 | // Base ambient pass |
---|
114 | pass |
---|
115 | { |
---|
116 | // base colours, not needed for rendering, but as information |
---|
117 | // to lighting pass categorisation routine |
---|
118 | ambient 1 1 1 |
---|
119 | diffuse 0 0 0 |
---|
120 | specular 0 0 0 0 |
---|
121 | // Really basic vertex program |
---|
122 | // NB we don't use fixed function here because GL does not like |
---|
123 | // mixing fixed function and vertex programs, depth fighting can |
---|
124 | // be an issue |
---|
125 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture |
---|
126 | { |
---|
127 | param_named_auto worldViewProj worldviewproj_matrix |
---|
128 | param_named_auto ambient ambient_light_colour |
---|
129 | } |
---|
130 | |
---|
131 | } |
---|
132 | // Now do the lighting pass |
---|
133 | // NB we don't do decal texture here because this is repeated per light |
---|
134 | pass |
---|
135 | { |
---|
136 | // base colours, not needed for rendering, but as information |
---|
137 | // to lighting pass categorisation routine |
---|
138 | ambient 0 0 0 |
---|
139 | // do this for each light |
---|
140 | iteration once_per_light |
---|
141 | |
---|
142 | |
---|
143 | scene_blend add |
---|
144 | |
---|
145 | // Vertex program reference |
---|
146 | vertex_program_ref BumpMapVP |
---|
147 | { |
---|
148 | param_named_auto lightPosition light_position_object_space 0 |
---|
149 | param_named_auto worldViewProj worldviewproj_matrix |
---|
150 | } |
---|
151 | |
---|
152 | // Base bump map |
---|
153 | texture_unit |
---|
154 | { |
---|
155 | texture nmnone.tga |
---|
156 | colour_op replace |
---|
157 | } |
---|
158 | // Normalisation cube map, with dot product on bump map |
---|
159 | texture_unit |
---|
160 | { |
---|
161 | cubic_texture nm.tga combinedUVW |
---|
162 | tex_coord_set 1 |
---|
163 | tex_address_mode clamp |
---|
164 | colour_op_ex dotproduct src_texture src_current |
---|
165 | colour_op_multipass_fallback dest_colour zero |
---|
166 | } |
---|
167 | } |
---|
168 | |
---|
169 | // Decal pass |
---|
170 | pass |
---|
171 | { |
---|
172 | lighting off |
---|
173 | // Really basic vertex program |
---|
174 | // NB we don't use fixed function here because GL does not like |
---|
175 | // mixing fixed function and vertex programs, depth fighting can |
---|
176 | // be an issue |
---|
177 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture |
---|
178 | { |
---|
179 | param_named_auto worldViewProj worldviewproj_matrix |
---|
180 | param_named ambient float4 1 1 1 1 |
---|
181 | } |
---|
182 | scene_blend dest_colour zero |
---|
183 | texture_unit |
---|
184 | { |
---|
185 | texture assff.JPG |
---|
186 | } |
---|
187 | |
---|
188 | } |
---|
189 | |
---|
190 | } |
---|
191 | } |
---|
192 | |
---|
193 | |
---|
194 | |
---|