Changeset 1131 for GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs
- Timestamp:
- 07/13/06 08:17:27 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs
- Files:
-
- 2 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 }
Note: See TracChangeset
for help on using the changeset viewer.