Changeset 2181 for GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic
- Timestamp:
- 03/01/07 22:48:05 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic.material
r2179 r2181 40 40 material GTP/Basic/Depth 41 41 { 42 technique 42 technique maintechnique 43 43 { 44 pass 44 pass mainpass 45 45 { 46 46 cull_hardware clockwise … … 49 49 param_named_auto WorldViewProj worldviewproj_matrix 50 50 } 51 vertex_program_ref GTP/Basic/VDepth_PS51 fragment_program_ref GTP/Basic/VDepth_PS 52 52 { 53 53 } … … 58 58 material GTP/Basic/DepthCCW : GTP/Basic/Depth 59 59 { 60 technique 060 technique maintechnique 61 61 { 62 pass 062 pass mainpass 63 63 { 64 64 cull_hardware anticlockwise … … 79 79 param_named_auto WorldView worldview_matrix 80 80 } 81 vertex_program_ref GTP/Basic/CDepth_PS81 fragment_program_ref GTP/Basic/CDepth_PS 82 82 { 83 83 } … … 88 88 material GTP/Basic/Distance 89 89 { 90 technique 90 technique maintechnique 91 91 { 92 pass 92 pass mainpass 93 93 { 94 94 cull_hardware clockwise … … 107 107 material GTP/Basic/DistanceCCW : GTP/Basic/Distance 108 108 { 109 technique 0109 technique maintechnique 110 110 { 111 pass 0111 pass mainpass 112 112 { 113 113 cull_hardware anticlockwise … … 118 118 material GTP/Basic/Distance_Normalized 119 119 { 120 technique 120 technique maintechnique 121 121 { 122 pass 122 pass mainpass 123 123 { 124 124 cull_hardware clockwise … … 138 138 material GTP/Basic/Distance_NormalizedCCW : GTP/Basic/Distance_Normalized 139 139 { 140 technique 0140 technique maintechnique 141 141 { 142 pass 0142 pass mainpass 143 143 { 144 144 cull_hardware anticlockwise … … 160 160 max_light_count 1 161 161 vertex_program_name GTP/Basic/LightVPos_VS 162 fragment_program_name GTP/Basic/SM/Depth_ PS162 fragment_program_name GTP/Basic/SM/Depth_VSM_PS 163 163 set_light_view false 164 164 set_light_farplane false 165 world_view_proj_param_name WorldViewProj 166 world_param_name World 167 light_viewproj_param_name LightViewProj 165 168 } 166 169 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic.program
r2179 r2181 49 49 source GTPBasic_VS.hlsl 50 50 entry_point VPos 51 target vs_ 1_151 target vs_2_0 52 52 } 53 53 -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic_PS.hlsl
r2179 r2181 28 28 { 29 29 float4 pos = IN.VPosition / IN.VPosition.w; 30 return float4(pos.z, pos.z * pos.z, 0, pos.z);30 return float4(pos.z, pos.z * pos.z, 1, 1); 31 31 } 32 32 -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic_VS.hlsl
r2179 r2181 145 145 }; 146 146 147 VPos_OUT VPos(float4 position : POSITION 0,147 VPos_OUT VPos(float4 position : POSITION, 148 148 uniform float4x4 WorldViewProj) 149 149 { … … 159 159 }; 160 160 161 MPos_OUT MPos(float4 position : POSITION 0,161 MPos_OUT MPos(float4 position : POSITION, 162 162 uniform float4x4 WorldViewProj) 163 163 { … … 168 168 } 169 169 170 MPos_OUT MPos_NoTransform(float4 position : POSITION 0)170 MPos_OUT MPos_NoTransform(float4 position : POSITION) 171 171 { 172 172 MPos_OUT OUT; … … 182 182 }; 183 183 184 CPos_OUT CPos(float4 position : POSITION 0,184 CPos_OUT CPos(float4 position : POSITION, 185 185 uniform float4x4 WorldViewProj, 186 186 uniform float4x4 WorldView) … … 222 222 }; 223 223 224 LightVPos_OUT LightVPos(float4 position : POSITION 0,224 LightVPos_OUT LightVPos(float4 position : POSITION, 225 225 uniform float4x4 WorldViewProj, 226 226 uniform float4x4 LightViewProj, … … 242 242 }; 243 243 244 LightCPos_OUT LightCPos(float4 position : POSITION 0,244 LightCPos_OUT LightCPos(float4 position : POSITION, 245 245 uniform float4x4 WorldViewProj, 246 246 uniform float4x4 World, -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPShadowMap_PS.hlsl
r2179 r2181 14 14 #define DEPTH_BIAS 0.001 15 15 #define DEPTH_BIAS_VSM 0.001 16 #define DEPTH_EPSILON 0.00 116 #define DEPTH_EPSILON 0.00005 17 17 #define DIST_BIAS 0.1 18 18 #define DIST_BIAS_VSM 0.001 … … 24 24 uniform sampler2D shadowMap) : COLOR 25 25 { 26 float4 light = shadowColor; 27 if( IN.LightVPos.z > 0.0) 26 float4 light = shadowColor; 27 28 if(IN.LightVPos.z > 0.0) 28 29 { 29 30 pos.xy = (pos.xy + 1.0) / 2.0; 31 pos.y = 1.0 - pos.y;32 float storedDepth = tex2D(shadowMap, pos.xy).r;33 pos.z -= DIST_BIAS;34 light = max( pos.z <= storedDepth.r, shadowColor);35 } 30 float4 pos = (IN.LightVPos / IN.LightVPos.w); 31 32 pos.xy = (pos.xy + 1.0) / 2.0; 33 pos.y = 1.0 - pos.y; 34 float4 storedDepth = tex2D(shadowMap, pos.xy); 35 light = max(storedDepth.r + DEPTH_BIAS >= pos.z, shadowColor); 36 } 36 37 return light; 37 38 } … … 45 46 46 47 if( pos.z > 0.0) 47 { 48 { 48 { 49 49 float depth = pos.z; 50 50 pos.xy = (pos.xy + 1.0) / 2.0; … … 58 58 float v2 = min(max(M2 - M1 * M1, 0.0) + DEPTH_EPSILON, 1.0); 59 59 float m_d = M1 - depth; 60 60 float pmax = v2 / (v2 + m_d * m_d); 61 61 62 // Adjust the light color based on the shadow attenuation 63 light = max(lit_factor, pmax); 64 65 } 62 // Adjust the light color based on the shadow attenuation 63 light = max(lit_factor, pmax); 66 64 } 67 65 else … … 73 71 74 72 float4 shadowMapDist(LightCPos_OUT IN, 75 //uniform float lightFarPlane,73 uniform float lightFarPlane, 76 74 uniform sampler2D shadowMap) : COLOR 77 75 { 78 float4 light = shadowColor; 79 76 float4 light = shadowColor; 80 77 if( IN.LightVPos.z > 0.0) 81 78 { … … 85 82 //if(d <= 1.0) 86 83 //{ 87 float dist = length(IN.LightCPos.xyz) ;84 float dist = length(IN.LightCPos.xyz) / lightFarPlane; 88 85 pos.xy = (pos.xy + 1.0) / 2.0; 89 86 pos.y = 1.0 - pos.y;
Note: See TracChangeset
for help on using the changeset viewer.