[6493] | 1 | /* |
---|
[5119] | 2 | //-------------- |
---|
| 3 | // Bump mapping |
---|
| 4 | //-------------- |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | // Any number of lights, diffuse and specular |
---|
[5126] | 9 | material Assff/BumpMap |
---|
[5119] | 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 |
---|
[5137] | 28 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture |
---|
[5119] | 29 | { |
---|
[5137] | 30 | param_named_auto worldViewProj worldviewproj_matrix |
---|
[5119] | 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 |
---|
[5126] | 49 | vertex_program_ref BumpMapVPSpecular |
---|
[5119] | 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 |
---|
[5126] | 57 | fragment_program_ref BumpMapFPSpecular |
---|
[5119] | 58 | { |
---|
| 59 | param_named_auto lightDiffuse light_diffuse_colour 0 |
---|
[5313] | 60 | param_named_auto lightSpecular light_specular_colour 0 |
---|
[5126] | 61 | param_named shine float 2 |
---|
[5119] | 62 | } |
---|
| 63 | |
---|
| 64 | // Base bump map |
---|
| 65 | texture_unit |
---|
| 66 | { |
---|
[5126] | 67 | texture nmnone.tga |
---|
[5119] | 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 |
---|
[5137] | 94 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture |
---|
[5119] | 95 | { |
---|
[5137] | 96 | param_named_auto worldViewProj worldviewproj_matrix |
---|
[5119] | 97 | param_named ambient float4 1 1 1 1 |
---|
| 98 | } |
---|
| 99 | scene_blend dest_colour zero |
---|
| 100 | texture_unit |
---|
| 101 | { |
---|
[5126] | 102 | texture assff.JPG |
---|
[5119] | 103 | } |
---|
| 104 | |
---|
| 105 | } |
---|
| 106 | } |
---|
| 107 | |
---|
[5313] | 108 | |
---|
[5137] | 109 | // This is the fallback which cards which don't have fragment program |
---|
| 110 | // support will use, NB does not support specular colour |
---|
| 111 | // Note that it still requires vertex program support |
---|
| 112 | technique |
---|
| 113 | { |
---|
| 114 | // Base ambient pass |
---|
| 115 | pass |
---|
| 116 | { |
---|
| 117 | // base colours, not needed for rendering, but as information |
---|
| 118 | // to lighting pass categorisation routine |
---|
| 119 | ambient 1 1 1 |
---|
| 120 | diffuse 0 0 0 |
---|
| 121 | specular 0 0 0 0 |
---|
| 122 | // Really basic vertex program |
---|
| 123 | // NB we don't use fixed function here because GL does not like |
---|
| 124 | // mixing fixed function and vertex programs, depth fighting can |
---|
| 125 | // be an issue |
---|
| 126 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture |
---|
| 127 | { |
---|
| 128 | param_named_auto worldViewProj worldviewproj_matrix |
---|
| 129 | param_named_auto ambient ambient_light_colour |
---|
| 130 | } |
---|
[5119] | 131 | |
---|
[5137] | 132 | } |
---|
| 133 | // Now do the lighting pass |
---|
| 134 | // NB we don't do decal texture here because this is repeated per light |
---|
| 135 | pass |
---|
| 136 | { |
---|
| 137 | // base colours, not needed for rendering, but as information |
---|
| 138 | // to lighting pass categorisation routine |
---|
| 139 | ambient 0 0 0 |
---|
| 140 | // do this for each light |
---|
| 141 | iteration once_per_light |
---|
[5119] | 142 | |
---|
| 143 | |
---|
[5137] | 144 | scene_blend add |
---|
| 145 | |
---|
| 146 | // Vertex program reference |
---|
| 147 | vertex_program_ref BumpMapVP |
---|
| 148 | { |
---|
| 149 | param_named_auto lightPosition light_position_object_space 0 |
---|
| 150 | param_named_auto worldViewProj worldviewproj_matrix |
---|
| 151 | } |
---|
| 152 | |
---|
| 153 | // Base bump map |
---|
| 154 | texture_unit |
---|
| 155 | { |
---|
| 156 | texture nmnone.tga |
---|
| 157 | colour_op replace |
---|
| 158 | } |
---|
| 159 | // Normalisation cube map, with dot product on bump map |
---|
| 160 | texture_unit |
---|
| 161 | { |
---|
| 162 | cubic_texture nm.tga combinedUVW |
---|
| 163 | tex_coord_set 1 |
---|
| 164 | tex_address_mode clamp |
---|
| 165 | colour_op_ex dotproduct src_texture src_current |
---|
| 166 | colour_op_multipass_fallback dest_colour zero |
---|
| 167 | } |
---|
| 168 | } |
---|
| 169 | |
---|
| 170 | // Decal pass |
---|
| 171 | pass |
---|
| 172 | { |
---|
| 173 | lighting off |
---|
| 174 | // Really basic vertex program |
---|
| 175 | // NB we don't use fixed function here because GL does not like |
---|
| 176 | // mixing fixed function and vertex programs, depth fighting can |
---|
| 177 | // be an issue |
---|
| 178 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture |
---|
| 179 | { |
---|
| 180 | param_named_auto worldViewProj worldviewproj_matrix |
---|
| 181 | param_named ambient float4 1 1 1 1 |
---|
| 182 | } |
---|
| 183 | scene_blend dest_colour zero |
---|
| 184 | texture_unit |
---|
| 185 | { |
---|
| 186 | texture assff.JPG |
---|
| 187 | } |
---|
| 188 | |
---|
| 189 | } |
---|
| 190 | |
---|
| 191 | } |
---|
| 192 | |
---|
| 193 | |
---|
| 194 | } |
---|
[6493] | 195 | */ |
---|