[692] | 1 | // Bump map with Parallax offset vertex program, support for this is required
|
---|
| 2 | vertex_program Examples/OffsetMappingVP cg
|
---|
| 3 | {
|
---|
| 4 | source OffsetMapping.cg
|
---|
| 5 | entry_point main_vp
|
---|
| 6 | profiles vs_1_1 arbvp1
|
---|
| 7 | }
|
---|
| 8 |
|
---|
| 9 | // Bump map with parallax fragment program
|
---|
| 10 | fragment_program Examples/OffsetMappingFP cg
|
---|
| 11 | {
|
---|
| 12 | source OffsetMapping.cg
|
---|
| 13 | entry_point main_fp
|
---|
| 14 | profiles ps_2_0 arbfp1
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | // Bump map with parallax fragment program
|
---|
| 18 | fragment_program Examples/OffsetMappingPS asm
|
---|
| 19 | {
|
---|
| 20 | source OffsetMapping_specular.asm
|
---|
| 21 | // sorry, only for ps_1_4 and above:)
|
---|
| 22 | syntax ps_1_4
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 |
|
---|
| 26 | material Examples/OffsetMapping/Specular
|
---|
| 27 | {
|
---|
| 28 |
|
---|
| 29 | // This is the preferred technique which uses both vertex and
|
---|
| 30 | // fragment programs, supports coloured lights
|
---|
| 31 | technique
|
---|
| 32 | {
|
---|
| 33 | // do the lighting and bump mapping with parallax pass
|
---|
| 34 | // NB we don't do decal texture here because this is repeated per light
|
---|
| 35 | pass
|
---|
| 36 | {
|
---|
| 37 |
|
---|
| 38 | // Vertex program reference
|
---|
| 39 | vertex_program_ref Examples/OffsetMappingVP
|
---|
| 40 | {
|
---|
| 41 | param_named_auto lightPosition light_position_object_space 0
|
---|
| 42 | param_named_auto eyePosition camera_position_object_space
|
---|
| 43 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | // Fragment program
|
---|
| 47 | fragment_program_ref Examples/OffsetMappingFP
|
---|
| 48 | {
|
---|
| 49 | param_named_auto lightDiffuse light_diffuse_colour 0
|
---|
| 50 | param_named_auto lightSpecular light_specular_colour 0
|
---|
| 51 | // Parallax Height scale and bias
|
---|
| 52 | param_named scaleBias float4 0.04 -0.02 1 0
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | // Normal + height(alpha) map
|
---|
| 56 | texture_unit
|
---|
| 57 | {
|
---|
| 58 | texture rockwall_NH.tga
|
---|
| 59 | tex_coord_set 0
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | // Base diffuse texture map
|
---|
| 63 | texture_unit
|
---|
| 64 | {
|
---|
| 65 | texture rockwall.tga
|
---|
| 66 | tex_coord_set 1
|
---|
| 67 | }
|
---|
| 68 | }
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 |
|
---|
| 72 | // This is the preferred technique which uses both vertex and
|
---|
| 73 | // fragment programs, supports coloured lights
|
---|
| 74 | technique
|
---|
| 75 | {
|
---|
| 76 | // do the lighting and bump mapping with parallax pass
|
---|
| 77 | // NB we don't do decal texture here because this is repeated per light
|
---|
| 78 | pass
|
---|
| 79 | {
|
---|
| 80 |
|
---|
| 81 | // Vertex program reference
|
---|
| 82 | vertex_program_ref Examples/OffsetMappingVP
|
---|
| 83 | {
|
---|
| 84 | param_named_auto lightPosition light_position_object_space 0
|
---|
| 85 | param_named_auto eyePosition camera_position_object_space
|
---|
| 86 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | // Fragment program
|
---|
| 90 | fragment_program_ref Examples/OffsetMappingPS
|
---|
| 91 | {
|
---|
| 92 | param_indexed_auto 0 light_diffuse_colour 0
|
---|
| 93 | param_indexed_auto 1 light_specular_colour 0
|
---|
| 94 | // Parallax Height scale and bias
|
---|
| 95 | param_indexed 2 float4 0.04 -0.02 1 0
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | // Normal + height(alpha) map
|
---|
| 99 | texture_unit
|
---|
| 100 | {
|
---|
| 101 | texture rockwall_NH.tga
|
---|
| 102 | tex_coord_set 0
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | // Base diffuse texture map
|
---|
| 106 | texture_unit
|
---|
| 107 | {
|
---|
| 108 | texture rockwall.tga
|
---|
| 109 | tex_coord_set 1
|
---|
| 110 | }
|
---|
| 111 | }
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 | // Simple no-shader fallback
|
---|
| 115 | technique
|
---|
| 116 | {
|
---|
| 117 | pass
|
---|
| 118 | {
|
---|
| 119 | // Base diffuse texture map
|
---|
| 120 | texture_unit
|
---|
| 121 | {
|
---|
| 122 | texture rockwall.tga
|
---|
| 123 | }
|
---|
| 124 | }
|
---|
| 125 | }
|
---|
| 126 |
|
---|
| 127 | }
|
---|