Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/Samples/Media/materials/scripts/DepthShadowmap.material @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 13.5 KB
Line 
1
2// ***-- Begin HLSL section --**
3
4vertex_program Ogre/DepthShadowmap/CasterVP_HLSL hlsl
5{
6    source DepthShadowmap.hlsl
7    entry_point casterVP
8    target vs_2_0
9
10        preprocessor_defines LINEAR_RANGE=0
11
12    default_params
13    {
14        param_named_auto worldViewProj worldviewproj_matrix
15                param_named_auto texelOffsets texel_offsets
16                //param_named_auto depthRange scene_depth_range
17    }
18}
19
20
21fragment_program Ogre/DepthShadowmap/CasterFP_HLSL hlsl
22{
23    source DepthShadowmap.hlsl
24    entry_point casterFP
25    target ps_2_0
26
27        preprocessor_defines LINEAR_RANGE=0
28
29    default_params
30    {
31    }
32}
33
34
35vertex_program Ogre/DepthShadowmap/ReceiverVP_HLSL hlsl
36{
37    source DepthShadowmap.hlsl
38    entry_point receiverVP
39    target vs_2_0
40
41        preprocessor_defines LINEAR_RANGE=0
42
43    default_params
44    {
45        param_named_auto world world_matrix
46        param_named_auto worldIT inverse_transpose_world_matrix
47                param_named_auto worldViewProj worldviewproj_matrix
48                param_named_auto texViewProj texture_viewproj_matrix
49                param_named_auto lightPosition light_position 0
50                param_named_auto lightColour light_diffuse_colour 0
51                //param_named_auto shadowDepthRange shadow_scene_depth_range 0
52    }
53}
54
55
56fragment_program Ogre/DepthShadowmap/ReceiverFP_HLSL hlsl
57{
58    source DepthShadowmap.hlsl
59    entry_point receiverFP
60        target ps_2_0
61
62        preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=0
63
64        default_params
65    {
66        param_named inverseShadowmapSize float 0.0009765625
67                param_named fixedDepthBias float 0.0005
68                param_named gradientClamp float 0.0098
69                param_named gradientScaleBias float 0
70                //param_named shadowFuzzyWidth float 1
71    }
72}
73
74fragment_program Ogre/DepthShadowmap/ReceiverFPPCF_HLSL hlsl
75{
76    source DepthShadowmap.hlsl
77    entry_point receiverFP
78        target ps_2_0
79
80        preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=1
81
82        default_params
83    {
84        param_named inverseShadowmapSize float 0.0009765625
85                param_named gradientClamp float 0.0098
86                param_named gradientScaleBias float 0
87                //param_named shadowFuzzyWidth float 1
88    }
89}
90vertex_program Ogre/DepthShadowmap/NormalMapReceiverVP_HLSL hlsl
91{
92    source DepthShadowmap.hlsl
93    entry_point normalMapShadowReceiverVp
94    target vs_2_0
95
96        preprocessor_defines LINEAR_RANGE=0
97
98    default_params
99    {
100        param_named_auto world world_matrix
101                param_named_auto worldViewProj worldviewproj_matrix
102                param_named_auto texViewProj texture_viewproj_matrix
103                param_named_auto lightPosition light_position_object_space 0
104                //param_named_auto shadowDepthRange shadow_scene_depth_range 0
105    }
106}
107
108fragment_program Ogre/DepthShadowmap/NormalMapReceiverFP_HLSL hlsl
109{
110    source DepthShadowmap.hlsl
111    entry_point normalMapShadowReceiverFp
112        target ps_2_0
113
114        preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=0
115
116        default_params
117    {
118                param_named_auto lightColour light_diffuse_colour 0
119        param_named inverseShadowmapSize float 0.0009765625
120                param_named fixedDepthBias float 0.0005
121                param_named gradientClamp float 0.0098
122                param_named gradientScaleBias float 0
123                //param_named shadowFuzzyWidth float 1
124    }
125}
126fragment_program Ogre/DepthShadowmap/NormalMapReceiverFPPCF_HLSL hlsl
127{
128    source DepthShadowmap.hlsl
129    entry_point normalMapShadowReceiverFp
130        target ps_2_0
131
132        preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=1
133
134        default_params
135    {
136                param_named_auto lightColour light_diffuse_colour 0
137        param_named inverseShadowmapSize float 0.0009765625
138                param_named fixedDepthBias float 0.0005
139                param_named gradientClamp float 0.0098
140                param_named gradientScaleBias float 0
141                //param_named shadowFuzzyWidth float 1
142    }
143}
144
145
146
147// **-- End HLSL Section --**
148
149// **-- Begin GLSL Section --**
150vertex_program Ogre/DepthShadowmap/CasterVP_GLSL glsl
151{
152    source DepthShadowmapCasterVp.glsl
153
154        preprocessor_defines LINEAR_RANGE=0
155
156    default_params
157    {
158        param_named_auto worldViewProj worldviewproj_matrix
159                param_named_auto texelOffsets texel_offsets
160                //param_named_auto depthRange scene_depth_range
161    }
162}
163
164
165fragment_program Ogre/DepthShadowmap/CasterFP_GLSL glsl
166{
167    source DepthShadowmapCasterFp.glsl
168
169        preprocessor_defines LINEAR_RANGE=0
170
171    default_params
172    {
173    }
174}
175
176
177vertex_program Ogre/DepthShadowmap/ReceiverVP_GLSL glsl
178{
179    source DepthShadowmapReceiverVp.glsl
180
181        preprocessor_defines LINEAR_RANGE=0
182
183    default_params
184    {
185        param_named_auto world world_matrix
186        param_named_auto worldIT inverse_transpose_world_matrix
187                param_named_auto worldViewProj worldviewproj_matrix
188                param_named_auto texViewProj texture_viewproj_matrix
189                param_named_auto lightPosition light_position 0
190                param_named_auto lightColour light_diffuse_colour 0
191                //param_named_auto shadowDepthRange shadow_scene_depth_range 0
192    }
193}
194
195
196fragment_program Ogre/DepthShadowmap/ReceiverFP_GLSL glsl
197{
198    source DepthShadowmapReceiverFp.glsl
199
200        preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=0
201
202        default_params
203    {
204                param_named shadowMap int 0
205        param_named inverseShadowmapSize float 0.0009765625
206                param_named fixedDepthBias float 0.0005
207                param_named gradientClamp float 0.0098
208                param_named gradientScaleBias float 0
209                //param_named shadowFuzzyWidth float 1
210    }
211}
212
213fragment_program Ogre/DepthShadowmap/ReceiverFPPCF_GLSL glsl
214{
215    source DepthShadowmapReceiverFp.glsl
216
217        preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=1
218
219        default_params
220    {
221        param_named inverseShadowmapSize float 0.0009765625
222                param_named gradientClamp float 0.0098
223                param_named gradientScaleBias float 0
224                //param_named shadowFuzzyWidth float 1
225    }
226}
227vertex_program Ogre/DepthShadowmap/NormalMapReceiverVP_GLSL glsl
228{
229    source DepthShadowmapNormalMapReceiverVp.glsl
230
231        preprocessor_defines LINEAR_RANGE=0
232
233    default_params
234    {
235        param_named_auto world world_matrix
236                param_named_auto worldViewProj worldviewproj_matrix
237                param_named_auto texViewProj texture_viewproj_matrix
238                param_named_auto lightPosition light_position_object_space 0
239                //param_named_auto shadowDepthRange shadow_scene_depth_range 0
240    }
241}
242
243fragment_program Ogre/DepthShadowmap/NormalMapReceiverFP_GLSL glsl
244{
245    source DepthShadowmapNormalMapReceiverFp.glsl
246
247        preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=0
248
249        default_params
250    {
251                param_named_auto lightColour light_diffuse_colour 0
252        param_named inverseShadowmapSize float 0.0009765625
253                param_named fixedDepthBias float 0.0005
254                param_named gradientClamp float 0.0098
255                param_named gradientScaleBias float 0
256                //param_named shadowFuzzyWidth float 1
257
258                param_named shadowMap int 0
259                param_named normalMap int 1
260    }
261}
262fragment_program Ogre/DepthShadowmap/NormalMapReceiverFPPCF_GLSL glsl
263{
264    source DepthShadowmapNormalMapReceiverFp.glsl
265
266        preprocessor_defines LINEAR_RANGE=0,FUZZY_TEST=0,PCF=1
267
268        default_params
269    {
270                param_named_auto lightColour light_diffuse_colour 0
271        param_named inverseShadowmapSize float 0.0009765625
272                param_named fixedDepthBias float 0.0005
273                param_named gradientClamp float 0.0098
274                param_named gradientScaleBias float 0
275                //param_named shadowFuzzyWidth float 1
276
277                param_named shadowMap int 0
278                param_named normalMap int 1
279    }
280}
281
282// **-- End GLSL Section --**
283
284// **-- Begin Unified Section --**
285vertex_program Ogre/DepthShadowmap/CasterVP unified
286{
287        delegate Ogre/DepthShadowmap/CasterVP_GLSL
288        delegate Ogre/DepthShadowmap/CasterVP_HLSL
289}
290fragment_program Ogre/DepthShadowmap/CasterFP unified
291{
292        delegate Ogre/DepthShadowmap/CasterFP_GLSL
293        delegate Ogre/DepthShadowmap/CasterFP_HLSL
294}
295vertex_program Ogre/DepthShadowmap/ReceiverVP unified
296{
297        delegate Ogre/DepthShadowmap/ReceiverVP_GLSL
298        delegate Ogre/DepthShadowmap/ReceiverVP_HLSL
299}
300fragment_program Ogre/DepthShadowmap/ReceiverFP unified
301{
302        delegate Ogre/DepthShadowmap/ReceiverFP_GLSL
303        delegate Ogre/DepthShadowmap/ReceiverFP_HLSL
304}
305fragment_program Ogre/DepthShadowmap/ReceiverFPPCF unified
306{
307        delegate Ogre/DepthShadowmap/ReceiverFPPCF_GLSL
308        delegate Ogre/DepthShadowmap/ReceiverFPPCF_HLSL
309}
310vertex_program Ogre/DepthShadowmap/NormalMapReceiverVP unified
311{
312        delegate Ogre/DepthShadowmap/NormalMapReceiverVP_HLSL
313        delegate Ogre/DepthShadowmap/NormalMapReceiverVP_GLSL
314}
315vertex_program Ogre/DepthShadowmap/NormalMapReceiverFP unified
316{
317        delegate Ogre/DepthShadowmap/NormalMapReceiverFP_HLSL
318        delegate Ogre/DepthShadowmap/NormalMapReceiverFP_GLSL
319}
320vertex_program Ogre/DepthShadowmap/NormalMapReceiverFPPCF unified
321{
322        delegate Ogre/DepthShadowmap/NormalMapReceiverFPPCF_HLSL
323        delegate Ogre/DepthShadowmap/NormalMapReceiverFPPCF_GLSL
324}
325
326// **-- End Unified Section --**
327
328
329
330// Generic Shadow caster material (floating point shadowmap)
331material Ogre/DepthShadowmap/Caster/Float
332{
333        technique
334    {
335        pass
336        {
337            vertex_program_ref Ogre/DepthShadowmap/CasterVP
338            {
339            }
340            fragment_program_ref Ogre/DepthShadowmap/CasterFP
341            {
342            }
343        }
344    }
345}
346
347// Generic Shadow receiver material (floating point shadowmap)
348material Ogre/DepthShadowmap/Receiver/Float
349{
350        technique
351    {
352        pass
353        {
354            vertex_program_ref Ogre/DepthShadowmap/ReceiverVP
355            {
356            }
357            fragment_program_ref Ogre/DepthShadowmap/ReceiverFP
358            {
359            }
360            texture_unit ShadowMap
361            {
362                tex_address_mode clamp
363                filtering none
364            }
365        }
366    }
367}
368
369
370// Specific receiver material for rockwall
371material Ogre/DepthShadowmap/Receiver/RockWall
372{
373
374        // This is the preferred technique which uses both vertex and
375        // fragment programs, supports coloured lights
376        technique
377        {
378                // Base ambient pass
379                pass
380                {
381                        // base colours, not needed for rendering, but as information
382                        // to lighting pass categorisation routine
383                        ambient 1 1 1
384                        diffuse 0 0 0
385                        specular 0 0 0 0
386                        // Really basic vertex program
387                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureUnified
388                        {
389                        }
390                       
391                }
392                // Now do the lighting pass
393                // NB we don't do decal texture here because this is repeated per light
394                pass lighting
395                {
396                        // base colours, not needed for rendering, but as information
397                        // to lighting pass categorisation routine
398                        ambient 0 0 0
399                       
400                        // do this for each light
401                        iteration once_per_light
402
403               
404                        scene_blend add
405
406                        // Vertex program reference
407                        vertex_program_ref Ogre/DepthShadowmap/ReceiverVP
408                        {
409                        }
410                        shadow_receiver_vertex_program_ref Ogre/DepthShadowmap/ReceiverVP
411                        {
412                        }
413
414                        // Fragment program
415                        fragment_program_ref Ogre/DepthShadowmap/ReceiverFP
416                        {
417                        }
418                        shadow_receiver_fragment_program_ref Ogre/DepthShadowmap/ReceiverFP
419                        {
420                        }
421
422                        // shadowmap texture will be bound by code
423
424                }
425               
426                // Decal pass
427                pass
428                {
429                        // base colours, not needed for rendering, but as information
430                        // to lighting pass categorisation routine
431                        lighting off
432                        // Really basic vertex program
433                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureUnified
434                        {
435                                param_named ambient float4 1 1 1 1
436                        }
437                        scene_blend dest_colour zero
438
439
440                        texture_unit
441                        {
442                                texture rockwall.tga
443                        }
444                       
445                }
446        }
447
448
449}
450
451// Specific receiver material for Athene
452material Ogre/DepthShadowmap/Receiver/Athene
453{
454
455        // This is the preferred technique which uses both vertex and
456        // fragment programs, supports coloured lights
457        technique
458        {
459                // Base ambient pass
460                pass
461                {
462                        // base colours, not needed for rendering, but as information
463                        // to lighting pass categorisation routine
464                        ambient 1 1 1
465                        diffuse 0 0 0
466                        specular 0 0 0 0
467                        // Really basic vertex program
468                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureUnified
469                        {
470                        }
471                       
472                }
473                // Now do the lighting pass
474                // NB we don't do decal texture here because this is repeated per light
475                pass lighting
476                {
477                        // base colours, not needed for rendering, but as information
478                        // to lighting pass categorisation routine
479                        ambient 0 0 0
480                       
481                        // do this for each light
482                        iteration once_per_light
483
484               
485                        scene_blend add
486
487                        // Vertex program reference
488                        vertex_program_ref Ogre/DepthShadowmap/NormalMapReceiverVP
489                        {
490                        }
491                        shadow_receiver_vertex_program_ref Ogre/DepthShadowmap/NormalMapReceiverVP
492                        {
493                        }
494
495                        // Fragment program
496                        fragment_program_ref Ogre/DepthShadowmap/NormalMapReceiverFP
497                        {
498                        }
499                        shadow_receiver_fragment_program_ref Ogre/DepthShadowmap/NormalMapReceiverFP
500                        {
501                        }
502
503                        // shadowmap texture will be bound by code
504
505                        // Base bump map
506                        texture_unit
507                        {
508                                texture atheneNormalMap.png
509                                colour_op replace
510                        }
511                        // Normalisation cube map
512                        texture_unit
513                        {
514                                cubic_texture nm.png combinedUVW
515                                tex_coord_set 1
516                                tex_address_mode clamp
517                        }
518
519                }
520               
521                // Decal pass
522                pass
523                {
524                        // base colours, not needed for rendering, but as information
525                        // to lighting pass categorisation routine
526                        lighting off
527                        // Really basic vertex program
528                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureUnified
529                        {
530                                param_named ambient float4 1 1 1 1
531                        }
532                        scene_blend dest_colour zero
533
534
535                        texture_unit
536                        {
537                                texture egyptrockyfull.jpg
538                        }
539                       
540                }
541        }
542
543
544}
545
546
547
548// Specialisation to use PCF
549material Ogre/DepthShadowmap/Receiver/Float/PCF : Ogre/DepthShadowmap/Receiver/Float
550{
551        technique
552        {
553                pass
554                {
555                        // override just receiver program
556                        fragment_program_ref Ogre/DepthShadowmap/ReceiverFPPCF
557                        {
558                        }
559                       
560                }
561        }
562}
563
564// Specialisation to use PCF
565material Ogre/DepthShadowmap/Receiver/RockWall/PCF : Ogre/DepthShadowmap/Receiver/RockWall
566{
567        technique
568        {
569                pass lighting
570                {
571                        // override just receiver program
572                        shadow_receiver_fragment_program_ref Ogre/DepthShadowmap/ReceiverFPPCF
573                        {
574                        }
575                       
576                }
577        }
578}
579// Specialisation to use PCF
580material Ogre/DepthShadowmap/Receiver/Athene/PCF : Ogre/DepthShadowmap/Receiver/Athene
581{
582        technique
583        {
584                pass lighting
585                {
586                        // override just receiver program
587                        shadow_receiver_fragment_program_ref Ogre/DepthShadowmap/NormalMapReceiverFPPCF
588                        {
589                        }
590                       
591                }
592        }
593}
594
595
Note: See TracBrowser for help on using the repository browser.