Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/Media/materials/scripts/asteroids.material @ 5132

Last change on this file since 5132 was 5132, checked in by janise, 16 years ago

try to fix shaderbug

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