Changeset 1131 for GTP/trunk/App/Demos/Illum/Ogre/Media/materials
- Timestamp:
- 07/13/06 08:17:27 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media/materials
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl
r1126 r1131 7 7 8 8 VS_OUT DepthVS(float4 position : POSITION, 9 uniform float4x4 worldViewProj, 10 uniform float4x4 viewProj, 11 uniform float4x4 cameraMatrix) 9 uniform float4x4 worldViewProj) 12 10 { 13 11 … … 15 13 16 14 OUT.hPosition = mul(worldViewProj, position); 17 OUT.Position = mul( viewProj, position);15 OUT.Position = mul(worldViewProj, position); 18 16 19 17 return OUT; … … 25 23 float4 pos = (IN.Position / IN.Position.w); 26 24 pos = (pos +1.0 ) / 2.0; 27 return pos.z;25 return float4(pos.z, pos.z * pos.z, 1, 1); 28 26 } 29 27 … … 39 37 VS_OUT_SHADOW depthShadowVS(float4 position : POSITION, 40 38 uniform float4x4 worldViewProj, 39 uniform float4x4 world, 41 40 uniform float4x4 lightViewProj) 42 41 { 43 42 VS_OUT_SHADOW OUT; 44 43 OUT.hPosition = mul(worldViewProj, position); 45 OUT.lPosition = mul(lightViewProj, position); 44 float4 wPos = mul(world, position); 45 OUT.lPosition = mul(lightViewProj, wPos); 46 46 OUT.Position = position; 47 47 return OUT; … … 54 54 ):COLOR 55 55 { 56 float bias = 0. 01;56 float bias = 0.1; 57 57 float4 light = float4(1,1,1,1); 58 58 float4 shadow = float4(0.3,0.3,0.3,1); 59 59 60 60 float4 pos = (IN.lPosition / IN.lPosition.w); 61 pos = (pos+1.0 ) / 2.0;61 pos.xy = (pos.xy +1.0 ) / 2.0; 62 62 pos.y = 1.0 - pos.y; 63 63 float4 storedDepth = tex2D(depthShadowMap, pos.xy); 64 if(storedDepth.r + bias < pos.z) 65 light = shadow; 64 65 if(storedDepth.r + bias > pos.z) 66 { 67 float M1 = storedDepth.r; 68 float M2 = storedDepth.g; 69 float v2 = M2 - M1 * M1; 70 float pmax = v2 / (v2 + pow(M1 - pos.z, 2)); 71 light = shadow + (1 - shadow) * pmax; 72 73 //light = shadow; 74 } 66 75 //return abs( pos.z - storedDepth.z ); 67 76 return light; -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Focusing.hlsl
r1126 r1131 6 6 7 7 VS_OUT FocusingVS(float4 position : POSITION, 8 uniform float4x4 world View,8 uniform float4x4 world, 9 9 uniform float4x4 worldViewProj, 10 10 uniform float4x4 lightTransform) 11 11 { 12 12 VS_OUT OUT; 13 OUT.hPosition = mul(worldViewProj, position); 14 OUT.Position = mul(lightTransform, position); 13 OUT.hPosition = mul(worldViewProj, position); 14 float4 wPos = mul(world, position); 15 OUT.Position = mul(lightTransform, wPos); 15 16 return OUT; 16 17 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.material
r1118 r1131 148 148 vertex_program_ref GameTools/FocusingVS 149 149 { 150 param_named_auto worldView worldview_matrix151 param_named_auto worldViewProj worldviewproj_matrix 152 150 param_named_auto world world_matrix 151 param_named_auto worldViewProj worldviewproj_matrix 152 param_named lightTransform matrix4x4 153 153 } 154 154 fragment_program_ref GameTools/FocusingPS … … 171 171 { 172 172 //cull_hardware anticlockwise 173 //cull_hardware none 173 174 174 175 vertex_program_ref GameTools/ShadowMap/DepthVS 175 176 { 176 param_named_auto viewProj viewproj_matrix 177 param_named_auto worldViewProj worldviewproj_matrix 177 param_named_auto worldViewProj worldviewproj_matrix 178 178 } 179 179 fragment_program_ref GameTools/ShadowMap/DepthPS … … 185 185 } 186 186 } 187 188 189 material GameTools/Blur 190 { 191 192 technique 193 { 194 195 pass 196 { 197 vertex_program_ref GameTools/BlurVS 198 { 199 200 } 201 fragment_program_ref GameTools/BlurPS 202 { 203 param_named_auto width viewport_width 204 param_named_auto height viewport_height 205 } 206 texture_unit 207 { 208 filtering bilinear 209 } 210 211 } 212 } 213 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.program
r1118 r1131 1 vertex_program GameTools/BlurVS hlsl 2 { 3 source GameTools_Blur.hlsl 4 entry_point BlurVS 5 target vs_2_0 6 } 7 8 fragment_program GameTools/BlurPS hlsl 9 { 10 source GameTools_Blur.hlsl 11 entry_point BlurPS 12 target ps_3_0 13 } 14 1 15 vertex_program GameTools/FocusingVS hlsl 2 16 {
Note: See TracChangeset
for help on using the changeset viewer.