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