Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/materials/BumpMapping/BumpMap.material @ 12120

Last change on this file since 12120 was 12120, checked in by wiesep, 6 years ago

Implemented material script inheritance for bump mapping

File size: 3.9 KB
Line 
1// Any number of lights, diffuse
2material BumpMap_Base
3{
4    technique
5    {
6        // Base ambient pass
7        pass ambient
8        {
9          // base colours, not needed for rendering, but as information
10          // to lighting pass categorisation routine
11          diffuse 0 0 0
12          depth_write on
13          depth_bias 0
14
15        }
16        // Now do the lighting pass
17        // NB we don't do decal texture here because this is repeated per light
18        pass perlight
19        {
20
21            // do this for each light
22            iteration once_per_light
23            scene_blend add
24            depth_write on
25            depth_bias 1
26
27            // base colours, not needed for rendering, but as information
28            // to lighting pass categorisation routine
29            ambient 0 0 0
30
31            // Vertex program reference
32            vertex_program_ref BumpMapping/BumpMapVP
33            {
34                param_named_auto lightPosition light_position_object_space 0
35                param_named_auto worldViewProj worldviewproj_matrix
36            }
37
38            // Fragment program
39            fragment_program_ref BumpMapping/BumpMapFP
40            {
41                param_named_auto lightDiffuse light_diffuse_colour 0
42            }
43
44            // texture shadow receiver program
45            shadow_receiver_vertex_program_ref BumpMapping/BumpMapVPShadowRcv
46            {
47                param_named_auto lightPosition light_position_object_space 0
48                param_named_auto worldViewProj worldviewproj_matrix
49                param_named_auto worldMatrix world_matrix
50                param_named_auto texViewProj texture_viewproj_matrix
51            }
52            // Additive texture shadow receiver program
53            shadow_receiver_fragment_program_ref BumpMapping/BumpMapFPShadowRcv
54            {
55                param_named_auto lightDiffuse light_diffuse_colour 0
56            }
57
58            // Vertex program reference
59            vertex_program_ref BumpMapping/BumpMapVPSpecular
60            {
61                param_named_auto lightPosition light_position_object_space 0
62                param_named_auto eyePosition camera_position_object_space
63                param_named_auto worldViewProj worldviewproj_matrix
64            }
65
66            // Fragment program
67            fragment_program_ref BumpMapping/BumpMapFPSpecular
68            {
69                param_named_auto lightDiffuse light_diffuse_colour 0
70                param_named_auto lightSpecular light_specular_colour 0
71            }
72
73
74            // Base bump map
75            texture_unit normalmap
76            {
77                texture Cube_Lava_NORM.jpg
78                colour_op replace
79            }
80        }
81
82        // Decal pass
83        pass decal
84        {
85            // base colours, not needed for rendering, but as information
86            // to lighting pass categorisation routine
87            lighting off
88            depth_write on
89            depth_bias 2
90
91            scene_blend dest_colour zero
92            texture_unit decalmap
93            {
94                texture Cube_Lava_COLOR.jpg
95            }
96        }
97    }
98}
99
100// Example for Material using this template //
101// import * from "BumpMap.material"
102// // Any number of lights, diffuse
103// material Cube_Lava_Normal : BumpMap_Base
104// {
105//     technique
106//     {
107//         pass ambient
108//         {
109//         }
110//         // Now do the lighting pass
111//         // NB we don't do decal texture here because this is repeated per light
112//         pass perlight
113//         {
114//             // Base bump map
115//             texture_unit normalmap
116//             {
117//                 texture Cube_Lava_NORM.jpg
118//                 colour_op replace
119//             }
120//         }
121
122//         // Decal pass
123//         pass decal
124//         {
125//             texture_unit decalmap
126//             {
127//                 texture Cube_Lava_COLOR.jpg
128//             }
129//         }
130//     }
131// }
Note: See TracBrowser for help on using the repository browser.