1 | |
---|
2 | //-------------- |
---|
3 | // Bump mapping |
---|
4 | //-------------- |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | // Any number of lights, diffuse and specular |
---|
9 | material Assff/BumpMap |
---|
10 | { |
---|
11 | |
---|
12 | // This is the preferred technique which uses both vertex and |
---|
13 | // fragment programs, supports coloured lights |
---|
14 | technique |
---|
15 | { |
---|
16 | // Base ambient pass |
---|
17 | pass |
---|
18 | { |
---|
19 | // base colours, not needed for rendering, but as information |
---|
20 | // to lighting pass categorisation routine |
---|
21 | ambient 1 1 1 |
---|
22 | diffuse 0 0 0 |
---|
23 | specular 0 0 0 0 |
---|
24 | // Really basic vertex program |
---|
25 | // NB we don't use fixed function here because GL does not like |
---|
26 | // mixing fixed function and vertex programs, depth fighting can |
---|
27 | // be an issue |
---|
28 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureGLSL |
---|
29 | { |
---|
30 | |
---|
31 | param_named_auto ambient ambient_light_colour |
---|
32 | } |
---|
33 | |
---|
34 | } |
---|
35 | // Now do the lighting pass |
---|
36 | // NB we don't do decal texture here because this is repeated per light |
---|
37 | pass |
---|
38 | { |
---|
39 | // base colours, not needed for rendering, but as information |
---|
40 | // to lighting pass categorisation routine |
---|
41 | ambient 0 0 0 |
---|
42 | // do this for each light |
---|
43 | iteration once_per_light |
---|
44 | |
---|
45 | |
---|
46 | scene_blend add |
---|
47 | |
---|
48 | // Vertex program reference |
---|
49 | vertex_program_ref BumpMapVPSpecular |
---|
50 | { |
---|
51 | param_named_auto lightPosition light_position_object_space 0 |
---|
52 | param_named_auto eyePosition camera_position_object_space |
---|
53 | param_named_auto worldViewProj worldviewproj_matrix |
---|
54 | } |
---|
55 | |
---|
56 | // Fragment program |
---|
57 | fragment_program_ref BumpMapFPSpecular |
---|
58 | { |
---|
59 | param_named_auto lightDiffuse light_diffuse_colour 0 |
---|
60 | param_named_auto lightSpecular light_specular_colour 0 |
---|
61 | param_named shine float 2 |
---|
62 | } |
---|
63 | |
---|
64 | // Base bump map |
---|
65 | texture_unit |
---|
66 | { |
---|
67 | texture nmnone.tga |
---|
68 | colour_op replace |
---|
69 | } |
---|
70 | // Normalisation cube map |
---|
71 | texture_unit |
---|
72 | { |
---|
73 | cubic_texture nm.tga combinedUVW |
---|
74 | tex_coord_set 1 |
---|
75 | tex_address_mode clamp |
---|
76 | } |
---|
77 | // Normalisation cube map #2 |
---|
78 | texture_unit |
---|
79 | { |
---|
80 | cubic_texture nm.tga combinedUVW |
---|
81 | tex_coord_set 2 |
---|
82 | tex_address_mode clamp |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | // Decal pass |
---|
87 | pass |
---|
88 | { |
---|
89 | lighting off |
---|
90 | // Really basic vertex program |
---|
91 | // NB we don't use fixed function here because GL does not like |
---|
92 | // mixing fixed function and vertex programs, depth fighting can |
---|
93 | // be an issue |
---|
94 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureGLSL |
---|
95 | { |
---|
96 | |
---|
97 | param_named ambient float4 1 1 1 1 |
---|
98 | } |
---|
99 | scene_blend dest_colour zero |
---|
100 | texture_unit |
---|
101 | { |
---|
102 | texture assff.JPG |
---|
103 | } |
---|
104 | |
---|
105 | } |
---|
106 | } |
---|
107 | |
---|
108 | |
---|
109 | } |
---|
110 | |
---|
111 | |
---|
112 | |
---|