Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/data_extern/materials/asteroids.material @ 12188

Last change on this file since 12188 was 7708, checked in by dafrick, 13 years ago

Merging cleanup branch. You will need to update your data repository as well as your local copy of the code.

  • Property svn:eol-style set to native
File size: 5.6 KB
Line 
1
2// A really basic ambient pass program, support for one texture coodinate set
3vertex_program Ogre/BasicVertexPrograms/AmbientOneTexture cg
4{
5        source Example_Basic.cg
6        entry_point ambientOneTexture_vp
7        profiles vs_1_1 arbvp1
8
9        default_params
10        {
11                param_named_auto worldViewProj worldviewproj_matrix
12                param_named_auto ambient ambient_light_colour
13        }
14
15}
16
17
18
19//--------------
20// Bump mapping
21//--------------
22
23// Bump map vertex program, support for this is required
24vertex_program BumpMapVP cg
25{
26        source BumpMapping.cg
27        entry_point main_vp
28        profiles vs_1_1 arbvp1
29}
30
31// Bump map fragment program, support for this is optional
32fragment_program BumpMapFP cg
33{
34        source BumpMapping.cg
35        entry_point main_fp
36        profiles ps_1_1 arbfp1 fp20
37}
38
39// Bump map with specular vertex program, support for this is required
40vertex_program BumpMapVPSpecular cg
41{
42        source BumpMapping.cg
43        entry_point specular_vp
44        profiles vs_1_1 arbvp1
45}
46
47// Bump map fragment program, support for this is optional
48fragment_program BumpMapFPSpecular cg
49{
50        source BumpMapping.cg
51        entry_point specular_fp
52        profiles ps_2_0 arbfp1 fp20
53
54        default_params
55        {
56        param_named shine float 3
57        }
58
59}
60
61
62// Any number of lights, diffuse and specular
63material Asteroid/BumpMap
64{
65
66        // This is the preferred technique which uses both vertex and
67        // fragment programs, supports coloured lights
68        technique
69        {
70                // Base ambient pass
71                pass
72                {
73                        // base colours, not needed for rendering, but as information
74                        // to lighting pass categorisation routine
75                        ambient 1 1 1
76                        diffuse 0 0 0
77                        specular 0 0 0 0
78                        // Really basic vertex program
79                        // NB we don't use fixed function here because GL does not like
80                        // mixing fixed function and vertex programs, depth fighting can
81                        // be an issue
82                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
83                        {
84                                param_named_auto worldViewProj worldviewproj_matrix
85                                param_named_auto ambient ambient_light_colour
86                        }
87
88                }
89                // Now do the lighting pass
90                // NB we don't do decal texture here because this is repeated per light
91                pass
92                {
93                        // base colours, not needed for rendering, but as information
94                        // to lighting pass categorisation routine
95                        ambient 0 0 0
96                        // do this for each light
97                        iteration once_per_light
98
99
100                        scene_blend add
101
102                        // Vertex program reference
103                        vertex_program_ref BumpMapVPSpecular
104                        {
105                                param_named_auto lightPosition light_position_object_space 0
106                                param_named_auto eyePosition camera_position_object_space
107                                param_named_auto worldViewProj worldviewproj_matrix
108                        }
109
110                        // Fragment program
111                        fragment_program_ref BumpMapFPSpecular
112                        {
113                                param_named_auto lightDiffuse light_diffuse_colour 0
114                                param_named_auto lightSpecular light_specular_colour 0
115                                param_named shine float 4
116                        }
117
118                        // Base bump map
119                        texture_unit
120                        {
121                                texture nmrock.png
122                                colour_op replace
123                        }
124                        // Normalisation cube map
125                        texture_unit
126                        {
127                                cubic_texture nm.png combinedUVW
128                                tex_coord_set 1
129                                tex_address_mode clamp
130                        }
131                        // Normalisation cube map #2
132                        texture_unit
133                        {
134                                cubic_texture nm.png combinedUVW
135                                tex_coord_set 2
136                                tex_address_mode clamp
137                        }
138                }
139
140                // Decal pass
141                pass
142                {
143                        lighting off
144                        // Really basic vertex program
145                        // NB we don't use fixed function here because GL does not like
146                        // mixing fixed function and vertex programs, depth fighting can
147                        // be an issue
148                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
149                        {
150                                param_named_auto worldViewProj worldviewproj_matrix
151                                param_named ambient float4 1 1 1 1
152                        }
153                        scene_blend dest_colour zero
154                        texture_unit
155                        {
156                                texture rock.png
157                        }
158
159                }
160        }
161        // This is the fallback which cards which don't have fragment program
162        // support will use, NB does not support specular colour
163        // Note that it still requires vertex program support
164        technique
165        {
166                // Base ambient pass
167                pass
168                {
169                        // base colours, not needed for rendering, but as information
170                        // to lighting pass categorisation routine
171                        ambient 1 1 1
172                        diffuse 0 0 0
173                        specular 0 0 0 0
174                        // Really basic vertex program
175                        // NB we don't use fixed function here because GL does not like
176                        // mixing fixed function and vertex programs, depth fighting can
177                        // be an issue
178                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
179                        {
180                                param_named_auto worldViewProj worldviewproj_matrix
181                                param_named_auto ambient ambient_light_colour
182                        }
183
184                }
185                // Now do the lighting pass
186                // NB we don't do decal texture here because this is repeated per light
187                pass
188                {
189                        // base colours, not needed for rendering, but as information
190                        // to lighting pass categorisation routine
191                        ambient 0 0 0
192                        // do this for each light
193                        iteration once_per_light
194
195
196                        scene_blend add
197
198                        // Vertex program reference
199                        vertex_program_ref BumpMapVP
200                        {
201                                param_named_auto lightPosition light_position_object_space 0
202                                param_named_auto worldViewProj worldviewproj_matrix
203                        }
204
205                        // Base bump map
206                        texture_unit
207                        {
208                                texture nmrock.png
209                                colour_op replace
210                        }
211                        // Normalisation cube map, with dot product on bump map
212                        texture_unit
213                        {
214                                cubic_texture nm.png combinedUVW
215                                tex_coord_set 1
216                                tex_address_mode clamp
217                                colour_op_ex dotproduct src_texture src_current
218                                colour_op_multipass_fallback dest_colour zero
219                        }
220                }
221
222                // Decal pass
223                pass
224                {
225                        lighting off
226                        // Really basic vertex program
227                        // NB we don't use fixed function here because GL does not like
228                        // mixing fixed function and vertex programs, depth fighting can
229                        // be an issue
230                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
231                        {
232                                param_named_auto worldViewProj worldviewproj_matrix
233                                param_named ambient float4 1 1 1 1
234                        }
235                        scene_blend dest_colour zero
236                        texture_unit
237                        {
238                                texture rock.png
239                        }
240
241                }
242
243        }
244
245
246}
247
248
249
Note: See TracBrowser for help on using the repository browser.