[3] | 1 | |
---|
| 2 | // Shadow Caster __________________________________________________ |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | vertex_program VarianceShadowMapping/ShadowCasterVP cg |
---|
| 6 | { |
---|
| 7 | source varianceshadowcastervp.cg |
---|
| 8 | entry_point main |
---|
| 9 | profiles arbvp1 vs_2_x |
---|
| 10 | |
---|
| 11 | default_params |
---|
| 12 | { |
---|
| 13 | param_named_auto uModelViewProjection worldviewproj_matrix |
---|
| 14 | } |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | fragment_program VarianceShadowMapping/ShadowCasterFP cg |
---|
| 18 | { |
---|
| 19 | source varianceshadowcasterfp.cg |
---|
| 20 | entry_point main |
---|
| 21 | profiles arbfp1 ps_2_x |
---|
| 22 | |
---|
| 23 | default_params |
---|
| 24 | { |
---|
| 25 | param_named uDepthOffset float 1.0 |
---|
| 26 | param_named_auto uProjection projection_matrix |
---|
| 27 | } |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | material VarianceShadowMapping/ShadowCaster |
---|
| 31 | { |
---|
| 32 | technique default |
---|
| 33 | { |
---|
| 34 | // Z-write only pass |
---|
| 35 | pass Z-write |
---|
| 36 | { |
---|
| 37 | //Instead of using depth_bias, we'll be implementing it manually |
---|
| 38 | |
---|
| 39 | vertex_program_ref VarianceShadowMapping/ShadowCasterVP |
---|
| 40 | { |
---|
| 41 | } |
---|
| 42 | fragment_program_ref VarianceShadowMapping/ShadowCasterFP |
---|
| 43 | { |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | } |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | // Shadow Receiver ________________________________________________ |
---|
| 52 | |
---|
| 53 | vertex_program VarianceShadowMapping/ShadowReceiverVP cg |
---|
| 54 | { |
---|
| 55 | source varianceshadowreceivervp.cg |
---|
| 56 | entry_point main |
---|
| 57 | profiles arbvp1 vs_2_x |
---|
| 58 | |
---|
| 59 | default_params |
---|
| 60 | { |
---|
| 61 | param_named_auto uModelViewProjection worldviewproj_matrix |
---|
| 62 | param_named_auto uLightPosition light_position_object_space 0 |
---|
| 63 | param_named_auto uModel world_matrix |
---|
| 64 | param_named_auto uTextureViewProjection texture_viewproj_matrix |
---|
| 65 | } |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | fragment_program VarianceShadowMapping/ShadowReceiverFP cg |
---|
| 69 | { |
---|
| 70 | source varianceshadowreceiverfp.cg |
---|
| 71 | entry_point main |
---|
| 72 | profiles arbfp1 ps_2_x |
---|
| 73 | |
---|
| 74 | default_params |
---|
| 75 | { |
---|
| 76 | param_named uSTexWidth float 512.0 |
---|
| 77 | param_named uSTexHeight float 512.0 |
---|
| 78 | } |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | material VarianceShadowMapping/ShadowReceiver |
---|
| 82 | { |
---|
| 83 | technique default |
---|
| 84 | { |
---|
| 85 | pass lighting |
---|
| 86 | { |
---|
| 87 | vertex_program_ref VarianceShadowMapping/ShadowReceiverVP |
---|
| 88 | { |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | fragment_program_ref VarianceShadowMapping/ShadowReceiverFP |
---|
| 92 | { |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | // we won't rely on hardware specific filtering of z-tests |
---|
| 96 | texture_unit ShadowMap |
---|
| 97 | { |
---|
| 98 | tex_address_mode clamp |
---|
| 99 | filtering none |
---|
| 100 | } |
---|
| 101 | } |
---|
| 102 | } |
---|
| 103 | } |
---|