source: GTP/trunk/App/Demos/Illum/IBRBillboardCloudTrees/OGRE/IBRTreesOGRE/media/materials/scripts/Examples-Advanced.material @ 1493

Revision 1493, 27.2 KB checked in by igarcia, 18 years ago (diff)
Line 
1// -------------------------------
2// Cel Shading Section
3// -------------------------------
4vertex_program Ogre/CelShadingVP cg
5{
6        source Example_CelShading.cg
7        entry_point main_vp
8        profiles vs_1_1 arbvp1
9
10        default_params
11        {
12                param_named_auto lightPosition light_position_object_space 0
13                param_named_auto eyePosition camera_position_object_space
14                param_named_auto worldViewProj worldviewproj_matrix
15                param_named shininess float 10
16        }
17}
18
19fragment_program Ogre/CelShadingFP cg
20{
21        source Example_CelShading.cg
22        entry_point main_fp
23        profiles ps_1_1 arbfp1 fp20
24}
25
26
27material Examples/CelShading
28{
29        technique
30        {
31                pass
32                {
33                        vertex_program_ref Ogre/CelShadingVP
34                        {
35                                // map shininess from custom renderable param 1
36                                param_named_auto shininess custom 1
37                        }
38                        fragment_program_ref Ogre/CelShadingFP
39                        {
40                                // map diffuse from custom renderable param 2
41                                param_named_auto diffuse custom 2
42                                // map specular from custom renderable param 2
43                                param_named_auto specular custom 3
44                        }
45                        texture_unit
46                        {
47                                texture cel_shading_diffuse.png 1d
48                                tex_address_mode clamp
49                                filtering none
50                        }
51                        texture_unit
52                        {
53                                texture cel_shading_specular.png 1d
54                                tex_address_mode clamp
55                                filtering none
56                                tex_coord_set 1
57                        }
58                        texture_unit
59                        {
60                                texture cel_shading_edge.png 1d
61                                tex_address_mode clamp
62                                filtering none
63                                tex_coord_set 2
64                        }
65                }
66        }
67       
68}
69
70
71
72//------------------------
73// Bump mapping section
74//------------------------
75
76// Bump map vertex program, support for this is required
77vertex_program Examples/BumpMapVP cg
78{
79        source Example_BumpMapping.cg
80        entry_point main_vp
81        profiles vs_1_1 arbvp1
82}
83
84// Bump map fragment program, support for this is optional
85fragment_program Examples/BumpMapFP cg
86{
87        source Example_BumpMapping.cg
88        entry_point main_fp
89        profiles ps_1_1 arbfp1 fp20
90}
91
92// Bump map with specular vertex program, support for this is required
93vertex_program Examples/BumpMapVPSpecular cg
94{
95        source Example_BumpMapping.cg
96        entry_point specular_vp
97        profiles vs_1_1 arbvp1
98}
99
100// Bump map fragment program, support for this is optional
101fragment_program Examples/BumpMapFPSpecular cg
102{
103        source Example_BumpMapping.cg
104        entry_point specular_fp
105        profiles ps_1_1 arbfp1 fp20
106}
107
108// Single light material, less passes (one pass on a 4-unit card)
109material Examples/BumpMapping/SingleLight
110{
111        // Preferred technique, uses vertex and fragment programs
112        // to support a single coloured light
113        technique
114        {
115                pass
116                {
117                        // base colours, not needed for rendering, but as information
118                        // to lighting pass categorisation routine
119                        ambient 0 0 0
120                        // Vertex program reference
121                        vertex_program_ref Examples/BumpMapVP
122                        {
123                                param_named_auto lightPosition light_position_object_space 0
124                                param_named_auto worldViewProj worldviewproj_matrix
125                        }
126
127                        // Fragment program
128                        fragment_program_ref Examples/BumpMapFP
129                        {
130                                param_named_auto lightDiffuse light_diffuse_colour 0
131                        }
132                       
133                        // Base bump map
134                        texture_unit
135                        {
136                                texture NMBumpsOut.png
137                                colour_op replace
138                        }
139                        // Normalisation cube map
140                        texture_unit
141                        {
142                                cubic_texture nm.png combinedUVW
143                                tex_coord_set 1
144                                tex_address_mode clamp
145                        }
146                        // Decal
147                        texture_unit
148                        {
149                                texture RustySteel.jpg
150                        }
151                }
152        }
153        // Fallback technique, uses vertex program but only fixed-function
154        // fragment shading, which does not support coloured light
155        technique
156        {
157                pass
158                {
159                        // base colours, not needed for rendering, but as information
160                        // to lighting pass categorisation routine
161                        ambient 0 0 0
162                        // Vertex program reference
163                        vertex_program_ref Examples/BumpMapVP
164                        {
165                                param_named_auto lightPosition light_position_object_space 0
166                                param_named_auto worldViewProj worldviewproj_matrix
167                        }
168
169                        // Base bump map
170                        texture_unit
171                        {
172                                texture NMBumpsOut.png
173                                colour_op replace
174                        }
175                        // Normalisation cube map
176                        texture_unit
177                        {
178                                cubic_texture nm.png combinedUVW
179                                tex_coord_set 1
180                                tex_address_mode clamp
181                                colour_op_ex dotproduct src_texture src_current
182                                colour_op_multipass_fallback dest_colour zero
183                        }
184                        // Decal
185                        texture_unit
186                        {
187                                texture RustySteel.jpg
188                        }
189                }
190        }
191}
192
193// Any number of lights, diffuse
194material Examples/BumpMapping/MultiLight
195{
196
197        // This is the preferred technique which uses both vertex and
198        // fragment programs, supports coloured lights
199        technique
200        {
201                // Base ambient pass
202                pass
203                {
204                        // base colours, not needed for rendering, but as information
205                        // to lighting pass categorisation routine
206                        ambient 1 1 1
207                        diffuse 0 0 0
208                        specular 0 0 0 0
209                        // Really basic vertex program
210                        // NB we don't use fixed function here because GL does not like
211                        // mixing fixed function and vertex programs, depth fighting can
212                        // be an issue
213                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
214                        {
215                                param_named_auto worldViewProj worldviewproj_matrix
216                                param_named_auto ambient ambient_light_colour
217                        }
218                       
219                }
220                // Now do the lighting pass
221                // NB we don't do decal texture here because this is repeated per light
222                pass
223                {
224                        // base colours, not needed for rendering, but as information
225                        // to lighting pass categorisation routine
226                        ambient 0 0 0
227                       
228                        // do this for each light
229                        iteration once_per_light
230
231               
232                        scene_blend add
233
234                        // Vertex program reference
235                        vertex_program_ref Examples/BumpMapVP
236                        {
237                                param_named_auto lightPosition light_position_object_space 0
238                                param_named_auto worldViewProj worldviewproj_matrix
239                        }
240
241                        // Fragment program
242                        fragment_program_ref Examples/BumpMapFP
243                        {
244                                param_named_auto lightDiffuse light_diffuse_colour 0
245                        }
246                       
247                        // Base bump map
248                        texture_unit
249                        {
250                                texture NMBumpsOut.png
251                                colour_op replace
252                        }
253                        // Normalisation cube map
254                        texture_unit
255                        {
256                                cubic_texture nm.png combinedUVW
257                                tex_coord_set 1
258                                tex_address_mode clamp
259                        }
260                }
261               
262                // Decal pass
263                pass
264                {
265                        // base colours, not needed for rendering, but as information
266                        // to lighting pass categorisation routine
267                        lighting off
268                        // Really basic vertex program
269                        // NB we don't use fixed function here because GL does not like
270                        // mixing fixed function and vertex programs, depth fighting can
271                        // be an issue
272                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
273                        {
274                                param_named_auto worldViewProj worldviewproj_matrix
275                                param_named ambient float4 1 1 1 1
276                        }
277                        scene_blend dest_colour zero
278                        texture_unit
279                        {
280                                texture RustedMetal.jpg
281                        }
282                       
283                }
284        }
285
286        // This is the fallback which cards which don't have fragment program
287        // support will use
288        // Note that it still requires vertex program support
289        technique
290        {
291                // Base ambient pass
292                pass
293                {
294                        // base colours, not needed for rendering, but as information
295                        // to lighting pass categorisation routine
296                        ambient 1 1 1
297                        diffuse 0 0 0
298                        specular 0 0 0 0
299                        // Really basic vertex program
300                        // NB we don't use fixed function here because GL does not like
301                        // mixing fixed function and vertex programs, depth fighting can
302                        // be an issue
303                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
304                        {
305                                param_named_auto worldViewProj worldviewproj_matrix
306                                param_named_auto ambient ambient_light_colour
307                        }
308                       
309                }
310                // Now do the lighting pass
311                // NB we don't do decal texture here because this is repeated per light
312                pass
313                {
314                        // base colours, not needed for rendering, but as information
315                        // to lighting pass categorisation routine
316                        ambient 0 0 0
317                        // do this for each light
318                        iteration once_per_light
319
320               
321                        scene_blend add
322
323                        // Vertex program reference
324                        vertex_program_ref Examples/BumpMapVP
325                        {
326                                param_named_auto lightPosition light_position_object_space 0
327                                param_named_auto worldViewProj worldviewproj_matrix
328                        }
329                       
330                        // Base bump map
331                        texture_unit
332                        {
333                                texture NMBumpsOut.png
334                                colour_op replace
335                        }
336                        // Normalisation cube map, with dot product on bump map
337                        texture_unit
338                        {
339                                cubic_texture nm.png combinedUVW
340                                tex_coord_set 1
341                                tex_address_mode clamp
342                                colour_op_ex dotproduct src_texture src_current
343                                colour_op_multipass_fallback dest_colour zero
344                        }
345                }
346               
347                // Decal pass
348                pass
349                {
350                        lighting off
351                        // Really basic vertex program
352                        // NB we don't use fixed function here because GL does not like
353                        // mixing fixed function and vertex programs, depth fighting can
354                        // be an issue
355                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
356                        {
357                                param_named_auto worldViewProj worldviewproj_matrix
358                                param_named ambient float4 1 1 1 1
359                        }
360                        scene_blend dest_colour zero
361                        texture_unit
362                        {
363                                texture RustedMetal.jpg
364                        }
365                       
366                }
367
368        }
369}
370
371// Any number of lights, diffuse and specular
372material Examples/BumpMapping/MultiLightSpecular
373{
374
375        // This is the preferred technique which uses both vertex and
376        // fragment programs, supports coloured lights
377        technique
378        {
379                // Base ambient pass
380                pass
381                {
382                        // base colours, not needed for rendering, but as information
383                        // to lighting pass categorisation routine
384                        ambient 1 1 1
385                        diffuse 0 0 0
386                        specular 0 0 0 0
387                        // Really basic vertex program
388                        // NB we don't use fixed function here because GL does not like
389                        // mixing fixed function and vertex programs, depth fighting can
390                        // be an issue
391                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
392                        {
393                                param_named_auto worldViewProj worldviewproj_matrix
394                                param_named_auto ambient ambient_light_colour
395                        }
396                       
397                }
398                // Now do the lighting pass
399                // NB we don't do decal texture here because this is repeated per light
400                pass
401                {
402                        // base colours, not needed for rendering, but as information
403                        // to lighting pass categorisation routine
404                        ambient 0 0 0
405                        // do this for each light
406                        iteration once_per_light
407
408               
409                        scene_blend add
410
411                        // Vertex program reference
412                        vertex_program_ref Examples/BumpMapVPSpecular
413                        {
414                                param_named_auto lightPosition light_position_object_space 0
415                                param_named_auto eyePosition camera_position_object_space
416                                param_named_auto worldViewProj worldviewproj_matrix
417                        }
418
419                        // Fragment program
420                        fragment_program_ref Examples/BumpMapFPSpecular
421                        {
422                                param_named_auto lightDiffuse light_diffuse_colour 0
423                                param_named_auto lightSpecular light_specular_colour 0
424                        }
425                       
426                        // Base bump map
427                        texture_unit
428                        {
429                                texture NMBumpsOut.png
430                                colour_op replace
431                        }
432                        // Normalisation cube map
433                        texture_unit
434                        {
435                                cubic_texture nm.png combinedUVW
436                                tex_coord_set 1
437                                tex_address_mode clamp
438                        }
439                        // Normalisation cube map #2
440                        texture_unit
441                        {
442                                cubic_texture nm.png combinedUVW
443                                tex_coord_set 2
444                                tex_address_mode clamp
445                        }
446                }
447               
448                // Decal pass
449                pass
450                {
451                        lighting off
452                        // Really basic vertex program
453                        // NB we don't use fixed function here because GL does not like
454                        // mixing fixed function and vertex programs, depth fighting can
455                        // be an issue
456                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
457                        {
458                                param_named_auto worldViewProj worldviewproj_matrix
459                                param_named ambient float4 1 1 1 1
460                        }
461                        scene_blend dest_colour zero
462                        texture_unit
463                        {
464                                texture RustedMetal.jpg
465                        }
466                       
467                }
468        }
469
470        // This is the fallback which cards which don't have fragment program
471        // support will use, NB does not support specular colour
472        // Note that it still requires vertex program support
473        technique
474        {
475                // Base ambient pass
476                pass
477                {
478                        // base colours, not needed for rendering, but as information
479                        // to lighting pass categorisation routine
480                        ambient 1 1 1
481                        diffuse 0 0 0
482                        specular 0 0 0 0
483                        // Really basic vertex program
484                        // NB we don't use fixed function here because GL does not like
485                        // mixing fixed function and vertex programs, depth fighting can
486                        // be an issue
487                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
488                        {
489                                param_named_auto worldViewProj worldviewproj_matrix
490                                param_named_auto ambient ambient_light_colour
491                        }
492                       
493                }
494                // Now do the lighting pass
495                // NB we don't do decal texture here because this is repeated per light
496                pass
497                {
498                        // base colours, not needed for rendering, but as information
499                        // to lighting pass categorisation routine
500                        ambient 0 0 0
501                        // do this for each light
502                        iteration once_per_light
503
504               
505                        scene_blend add
506
507                        // Vertex program reference
508                        vertex_program_ref Examples/BumpMapVP
509                        {
510                                param_named_auto lightPosition light_position_object_space 0
511                                param_named_auto worldViewProj worldviewproj_matrix
512                        }
513                       
514                        // Base bump map
515                        texture_unit
516                        {
517                                texture NMBumpsOut.png
518                                colour_op replace
519                        }
520                        // Normalisation cube map, with dot product on bump map
521                        texture_unit
522                        {
523                                cubic_texture nm.png combinedUVW
524                                tex_coord_set 1
525                                tex_address_mode clamp
526                                colour_op_ex dotproduct src_texture src_current
527                                colour_op_multipass_fallback dest_colour zero
528                        }
529                }
530               
531                // Decal pass
532                pass
533                {
534                        lighting off
535                        // Really basic vertex program
536                        // NB we don't use fixed function here because GL does not like
537                        // mixing fixed function and vertex programs, depth fighting can
538                        // be an issue
539                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
540                        {
541                                param_named_auto worldViewProj worldviewproj_matrix
542                                param_named ambient float4 1 1 1 1
543                        }
544                        scene_blend dest_colour zero
545                        texture_unit
546                        {
547                                texture RustedMetal.jpg
548                        }
549                       
550                }
551
552        }
553}
554
555//---------------------------
556// Projective texture section
557//---------------------------
558
559
560vertex_program Examples/TexProjectionVP cg
561{
562        source Example_Projection.cg
563        entry_point generalPurposeProjection_vp
564        profiles vs_1_1 arbvp1
565}
566
567fragment_program Examples/TexProjectionFP cg
568{
569        source Example_Projection.cg
570        entry_point generalPurposeProjection_fp
571        // sorry, ps_1_1 can't do this, fp20 can though
572        profiles ps_2_0 arbfp1 fp20
573}
574
575material Examples/GeneralTexProjection
576{
577        technique
578        {
579                pass
580                {
581                       
582                        vertex_program_ref Examples/TexProjectionVP
583                        {
584                                param_named_auto worldViewProjMatrix worldviewproj_matrix
585                                param_named_auto worldMatrix world_matrix
586                                // You'll need to update the tex projection, I suggest using
587                                // the Frustum class
588                                //param_named_auto texWorldViewProj worldviewproj_matrix
589                        }
590                        fragment_program_ref Examples/TexProjectionFP
591                        {
592                                // no params
593                        }
594                        texture_unit
595                        {
596                                // Project the OGRE logo
597                                texture ogrelogo.png
598                                tex_address_mode clamp
599                        }
600                }
601               
602                       
603        }
604   
605}
606
607//----------------------------
608// Distortion effects
609//----------------------------
610
611vertex_program Examples/FresnelRefractReflectVP cg
612{
613        source Example_Fresnel.cg
614        entry_point main_vp
615        profiles vs_1_1 arbvp1
616}
617
618fragment_program Examples/FresnelRefractReflectFP cg
619{
620        source Example_Fresnel.cg
621        entry_point main_fp
622        // sorry, ps_1_1 and fp20 can't do this
623        profiles ps_2_0 arbfp1
624}
625
626fragment_program Examples/FresnelRefractReflectPS asm
627{
628        source Example_FresnelPS.asm
629        // sorry, only for ps_1_4 :)
630        syntax ps_1_4
631
632}
633
634material Examples/FresnelReflectionRefraction
635{
636        // ps_2_0 / arbfp1
637        technique
638        {
639                pass
640                {
641                       
642                        vertex_program_ref Examples/FresnelRefractReflectVP
643                        {
644                                param_named_auto worldViewProjMatrix worldviewproj_matrix
645                                param_named_auto eyePosition camera_position_object_space
646                                param_named fresnelBias float -0.3
647                                param_named fresnelScale float 1.4
648                                param_named fresnelPower float 8 
649                                param_named_auto timeVal time 0.05
650                                param_named scroll float 1 
651                                param_named scale float 4
652                                param_named noise float 1
653                                // scroll and noisePos will need updating per frame
654                        }
655                        fragment_program_ref Examples/FresnelRefractReflectFP
656                        {
657                                param_named distortionRange float 0.025
658                                param_named tintColour float4 0 0 0 1
659                        }
660                        // Noise
661                        texture_unit
662                        {
663                                // Perlin noise volume
664                                texture perlinvolume.dds 3d
665                                // min / mag filtering, no mip
666                                filtering linear linear none
667                        }
668                        // Reflection
669                        texture_unit
670                        {
671                                // Will be filled in at runtime
672                                texture Reflection
673                                tex_address_mode clamp
674                                // needed by ps.1.4
675                                tex_coord_set 1
676                        }
677                        // Refraction
678                        texture_unit
679                        {
680                                // Will be filled in at runtime
681                                texture Refraction
682                                tex_address_mode clamp
683                                // needed by ps.1.4
684                                tex_coord_set 2
685                        }
686                }
687               
688                       
689        }
690
691        // ATI 8500 +
692        technique
693        {
694                pass
695                {
696                        vertex_program_ref Examples/FresnelRefractReflectVP
697                        {
698                                param_named_auto worldViewProjMatrix worldviewproj_matrix
699                                param_named_auto eyePosition camera_position_object_space
700                                param_named fresnelBias float -0.3
701                                param_named fresnelScale float 1.4
702                                param_named fresnelPower float 8
703                                param_named_auto timeVal time 0.05
704                                param_named scroll float 1
705                                param_named scale float 4
706                                param_named noise float 1
707                                // scroll and noisePos will need updating per frame
708                        }
709
710                        // for ATI RADEON 8500 - 9200
711                        fragment_program_ref Examples/FresnelRefractReflectPS
712                        {
713                                // distortionRange
714                                param_indexed 0  float 0.025 
715                                // tintColour
716                                param_indexed 1  float4 0.05 0.12 0.15 1
717                        }
718
719                        // Noise
720                        texture_unit
721                        {
722                                // Perlin noise volume
723                                texture perlinvolume.dds 3d
724                                // min / mag filtering, no mip
725                                filtering linear linear none
726                        }
727                        // Reflection
728                        texture_unit
729                        {
730                                // Will be filled in at runtime
731                                texture Reflection
732                                tex_address_mode clamp
733                                // needed by ps.1.4
734                                tex_coord_set 1
735                        }
736                        // Refraction
737                        texture_unit
738                        {
739                                // Will be filled in at runtime
740                                texture Refraction
741                                tex_address_mode clamp
742                                // needed by ps.1.4
743                                tex_coord_set 2
744                        }
745                }
746        }   
747}
748
749// Normal-mapped Athene statue
750material Examples/Athene/NormalMapped
751{
752
753        // This is the preferred technique which uses both vertex and
754        // fragment programs, supports coloured lights
755        technique
756        {
757                // Base ambient pass
758                pass
759                {
760                        // base colours, not needed for rendering, but as information
761                        // to lighting pass categorisation routine
762                        ambient 1 1 1
763                        diffuse 0 0 0
764                        specular 0 0 0 0
765                        // Really basic vertex program
766                        // NB we don't use fixed function here because GL does not like
767                        // mixing fixed function and vertex programs, depth fighting can
768                        // be an issue
769                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
770                        {
771                                param_named_auto worldViewProj worldviewproj_matrix
772                                param_named_auto ambient ambient_light_colour
773                        }
774                       
775                }
776                // Now do the lighting pass
777                // NB we don't do decal texture here because this is repeated per light
778                pass
779                {
780                        // base colours, not needed for rendering, but as information
781                        // to lighting pass categorisation routine
782                        ambient 0 0 0
783                       
784                        // do this for each light
785                        iteration once_per_light
786
787               
788                        scene_blend add
789
790                        // Vertex program reference
791                        vertex_program_ref Examples/BumpMapVP
792                        {
793                                param_named_auto lightPosition light_position_object_space 0
794                                param_named_auto worldViewProj worldviewproj_matrix
795                        }
796
797                        // Fragment program
798                        fragment_program_ref Examples/BumpMapFP
799                        {
800                                param_named_auto lightDiffuse light_diffuse_colour 0
801                        }
802                       
803                        // Base bump map
804                        texture_unit
805                        {
806                                texture atheneNormalMap.png
807                                colour_op replace
808                        }
809                        // Normalisation cube map
810                        texture_unit
811                        {
812                                cubic_texture nm.png combinedUVW
813                                tex_coord_set 1
814                                tex_address_mode clamp
815                        }
816                }
817               
818                // Decal pass
819                pass
820                {
821                        // base colours, not needed for rendering, but as information
822                        // to lighting pass categorisation routine
823                        lighting off
824                        // Really basic vertex program
825                        // NB we don't use fixed function here because GL does not like
826                        // mixing fixed function and vertex programs, depth fighting can
827                        // be an issue
828                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
829                        {
830                                param_named_auto worldViewProj worldviewproj_matrix
831                                param_named ambient float4 1 1 1 1
832                        }
833                        scene_blend dest_colour zero
834                        texture_unit
835                        {
836                                texture egyptrockyfull.jpg
837                        }
838                       
839                }
840        }
841
842        // This is the fallback which cards which don't have fragment program
843        // support will use
844        // Note that it still requires vertex program support
845        technique
846        {
847                // Base ambient pass
848                pass
849                {
850                        // base colours, not needed for rendering, but as information
851                        // to lighting pass categorisation routine
852                        ambient 1 1 1
853                        diffuse 0 0 0
854                        specular 0 0 0 0
855                        // Really basic vertex program
856                        // NB we don't use fixed function here because GL does not like
857                        // mixing fixed function and vertex programs, depth fighting can
858                        // be an issue
859                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
860                        {
861                                param_named_auto worldViewProj worldviewproj_matrix
862                                param_named_auto ambient ambient_light_colour
863                        }
864                       
865                }
866                // Now do the lighting pass
867                // NB we don't do decal texture here because this is repeated per light
868                pass
869                {
870                        // base colours, not needed for rendering, but as information
871                        // to lighting pass categorisation routine
872                        ambient 0 0 0
873                        // do this for each light
874                        iteration once_per_light
875
876               
877                        scene_blend add
878
879                        // Vertex program reference
880                        vertex_program_ref Examples/BumpMapVP
881                        {
882                                param_named_auto lightPosition light_position_object_space 0
883                                param_named_auto worldViewProj worldviewproj_matrix
884                        }
885                       
886                        // Base bump map
887                        texture_unit
888                        {
889                                texture atheneNormalMap.png
890                                colour_op replace
891                        }
892                        // Normalisation cube map, with dot product on bump map
893                        texture_unit
894                        {
895                                cubic_texture nm.png combinedUVW
896                                tex_coord_set 1
897                                tex_address_mode clamp
898                                colour_op_ex dotproduct src_texture src_current
899                                colour_op_multipass_fallback dest_colour zero
900                        }
901                }
902               
903                // Decal pass
904                pass
905                {
906                        lighting off
907                        // Really basic vertex program
908                        // NB we don't use fixed function here because GL does not like
909                        // mixing fixed function and vertex programs, depth fighting can
910                        // be an issue
911                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
912                        {
913                                param_named_auto worldViewProj worldviewproj_matrix
914                                param_named ambient float4 1 1 1 1
915                        }
916                        scene_blend dest_colour zero
917                        texture_unit
918                        {
919                                texture egyptrockyfull.jpg
920                        }
921                       
922                }
923
924        }
925}
926
927// Basic Athene statue
928material Examples/Athene/Basic
929{
930
931        technique
932        {
933                pass
934                {
935                        ambient 0.3 0.3 0.3
936                        diffuse 1.0 1.0 0.9
937
938                        texture_unit
939                        {
940                                texture egyptrockyfull.jpg
941                        }
942                       
943                }
944        }
945}
946
947
948// Any number of lights, diffuse and specular
949material Examples/Athene/NormalMappedSpecular
950{
951
952        // This is the preferred technique which uses both vertex and
953        // fragment programs, supports coloured lights
954        technique
955        {
956                // Base ambient pass
957                pass
958                {
959                        // base colours, not needed for rendering, but as information
960                        // to lighting pass categorisation routine
961                        ambient 1 1 1
962                        diffuse 0 0 0
963                        specular 0 0 0 0
964                        // Really basic vertex program
965                        // NB we don't use fixed function here because GL does not like
966                        // mixing fixed function and vertex programs, depth fighting can
967                        // be an issue
968                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
969                        {
970                                param_named_auto worldViewProj worldviewproj_matrix
971                                param_named_auto ambient ambient_light_colour
972                        }
973                       
974                }
975                // Now do the lighting pass
976                // NB we don't do decal texture here because this is repeated per light
977                pass
978                {
979                        // base colours, not needed for rendering, but as information
980                        // to lighting pass categorisation routine
981                        ambient 0 0 0
982                        // do this for each light
983                        iteration once_per_light
984
985               
986                        scene_blend add
987
988                        // Vertex program reference
989                        vertex_program_ref Examples/BumpMapVPSpecular
990                        {
991                                param_named_auto lightPosition light_position_object_space 0
992                                param_named_auto eyePosition camera_position_object_space
993                                param_named_auto worldViewProj worldviewproj_matrix
994                        }
995
996                        // Fragment program
997                        fragment_program_ref Examples/BumpMapFPSpecular
998                        {
999                                param_named_auto lightDiffuse light_diffuse_colour 0
1000                                param_named_auto lightSpecular light_specular_colour 0
1001                        }
1002                       
1003                        // Base bump map
1004                        texture_unit
1005                        {
1006                                texture atheneNormalMap.png
1007                                colour_op replace
1008                        }
1009                        // Normalisation cube map
1010                        texture_unit
1011                        {
1012                                cubic_texture nm.png combinedUVW
1013                                tex_coord_set 1
1014                                tex_address_mode clamp
1015                        }
1016                        // Normalisation cube map #2
1017                        texture_unit
1018                        {
1019                                cubic_texture nm.png combinedUVW
1020                                tex_coord_set 2
1021                                tex_address_mode clamp
1022                        }
1023                }
1024               
1025                // Decal pass
1026                pass
1027                {
1028                        lighting off
1029                        // Really basic vertex program
1030                        // NB we don't use fixed function here because GL does not like
1031                        // mixing fixed function and vertex programs, depth fighting can
1032                        // be an issue
1033                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
1034                        {
1035                                param_named_auto worldViewProj worldviewproj_matrix
1036                                param_named ambient float4 1 1 1 1
1037                        }
1038                        scene_blend dest_colour zero
1039                        texture_unit
1040                        {
1041                                texture egyptrockyfull.jpg
1042                        }
1043                       
1044                }
1045        }
1046
1047        // This is the fallback which cards which don't have fragment program
1048        // support will use, NB does not support specular colour
1049        // Note that it still requires vertex program support
1050        technique
1051        {
1052                // Base ambient pass
1053                pass
1054                {
1055                        // base colours, not needed for rendering, but as information
1056                        // to lighting pass categorisation routine
1057                        ambient 1 1 1
1058                        diffuse 0 0 0
1059                        specular 0 0 0 0
1060                        // Really basic vertex program
1061                        // NB we don't use fixed function here because GL does not like
1062                        // mixing fixed function and vertex programs, depth fighting can
1063                        // be an issue
1064                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
1065                        {
1066                                param_named_auto worldViewProj worldviewproj_matrix
1067                                param_named_auto ambient ambient_light_colour
1068                        }
1069                       
1070                }
1071                // Now do the lighting pass
1072                // NB we don't do decal texture here because this is repeated per light
1073                pass
1074                {
1075                        // base colours, not needed for rendering, but as information
1076                        // to lighting pass categorisation routine
1077                        ambient 0 0 0
1078                        // do this for each light
1079                        iteration once_per_light
1080
1081               
1082                        scene_blend add
1083
1084                        // Vertex program reference
1085                        vertex_program_ref Examples/BumpMapVP
1086                        {
1087                                param_named_auto lightPosition light_position_object_space 0
1088                                param_named_auto worldViewProj worldviewproj_matrix
1089                        }
1090                       
1091                        // Base bump map
1092                        texture_unit
1093                        {
1094                                texture atheneNormalMap.png
1095                                colour_op replace
1096                        }
1097                        // Normalisation cube map, with dot product on bump map
1098                        texture_unit
1099                        {
1100                                cubic_texture nm.png combinedUVW
1101                                tex_coord_set 1
1102                                tex_address_mode clamp
1103                                colour_op_ex dotproduct src_texture src_current
1104                                colour_op_multipass_fallback dest_colour zero
1105                        }
1106                }
1107               
1108                // Decal pass
1109                pass
1110                {
1111                        lighting off
1112                        // Really basic vertex program
1113                        // NB we don't use fixed function here because GL does not like
1114                        // mixing fixed function and vertex programs, depth fighting can
1115                        // be an issue
1116                        vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
1117                        {
1118                                param_named_auto worldViewProj worldviewproj_matrix
1119                                param_named ambient float4 1 1 1 1
1120                        }
1121                        scene_blend dest_colour zero
1122                        texture_unit
1123                        {
1124                                texture egyptrockyfull.jpg
1125                        }
1126                       
1127                }
1128
1129        }
1130}
1131
Note: See TracBrowser for help on using the repository browser.