Changeset 2181
- Timestamp:
- 03/01/07 22:48:05 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre
- Files:
-
- 10 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; -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl
r2138 r2181 53 53 { 54 54 float4 hPosition : POSITION; 55 float4 Position : TEXCOORD0; 56 float4 lPosition : TEXCOORD1; 57 float4 lVPosition : TEXCOORD2; 55 float4 lPosition : TEXCOORD0; 56 float4 lVPosition : TEXCOORD1; 58 57 }; 59 58 … … 67 66 float4 wPos = mul(world, position); 68 67 OUT.lPosition = mul(lightViewProj, wPos); 69 OUT.lVPosition = 0; 70 OUT.Position = position; 71 return OUT; 72 } 73 74 68 OUT.lVPosition = 0; 69 return OUT; 70 } 71 72 /* 75 73 float4 depthShadowPS(VS_OUT_SHADOW IN, 76 74 uniform float4x4 lightViewProj, … … 110 108 return light; 111 109 } 112 110 */ 113 111 114 112 … … 125 123 OUT.lPosition = mul(lightViewProj, wPos); 126 124 OUT.lVPosition = mul(lightView, wPos); 127 OUT.Position = position;128 125 return OUT; 129 126 } … … 213 210 } 214 211 */ 215 /* 212 216 213 float4 depthShadowPS(VS_OUT_SHADOW IN, 217 214 uniform float4x4 lightViewProj, … … 249 246 return light; 250 247 } 251 */ -
GTP/trunk/App/Demos/Illum/Ogre/bin/Debug/ogre.cfg
r2167 r2181 6 6 Floating-point mode=Fastest 7 7 Full Screen=No 8 Rendering Device=NVIDIA GeForce 7950 GX28 Rendering Device=NVIDIA GeForce 6800 GT 9 9 VSync=No 10 10 Video Mode=800 x 600 @ 32-bit colour -
GTP/trunk/App/Demos/Illum/Ogre/bin/Release/ogre.cfg
r2167 r2181 6 6 Floating-point mode=Fastest 7 7 Full Screen=No 8 Rendering Device=NVIDIA GeForce 7950 GX28 Rendering Device=NVIDIA GeForce 6800 GT 9 9 VSync=No 10 10 Video Mode=800 x 600 @ 32-bit colour -
GTP/trunk/App/Demos/Illum/Ogre/src/PRMDemo/include/PRMDemo.h
r2179 r2181 104 104 OgreIlluminationManager::getSingleton().setMainViewport(mWindow->getViewport(0)); 105 105 OgreIlluminationManager::getSingleton().setShadowMapSize(512); 106 OgreIlluminationManager::getSingleton().setShadowMapMaterialName("G ameTools/ShadowMapDistance");106 OgreIlluminationManager::getSingleton().setShadowMapMaterialName("GTP/Basic/DepthCCW"); 107 107 OgreIlluminationManager::getSingleton().setFocusingSM(true); 108 OgreIlluminationManager::getSingleton().setShadowMapSize( 512);109 OgreIlluminationManager::getSingleton().setBlurShadowMap( false);110 OgreIlluminationManager::getSingleton().setUseLISPSM( false);108 OgreIlluminationManager::getSingleton().setShadowMapSize(700); 109 OgreIlluminationManager::getSingleton().setBlurShadowMap(true); 110 OgreIlluminationManager::getSingleton().setUseLISPSM(true); 111 111 112 112 Root::getSingleton()._setCurrentSceneManager(mSceneMgr); … … 126 126 SceneSerializer s(mSceneMgr); 127 127 DataStreamPtr inputStream; 128 inputStream = ResourceGroupManager::getSingleton().openResource(" level.txt"); //towers2.level128 inputStream = ResourceGroupManager::getSingleton().openResource("towers2.level"); //towers2.level 129 129 s.parseScript(inputStream, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 130 130 131 createPlane("p","GTP/Basic/ShadowReciever/Depth",Vector3(0, 0,0),Vector2(1000,1000));131 createPlane("p","GTP/Basic/ShadowReciever/Depth",Vector3(0,-0.3,0),Vector2(150,150)); 132 132 133 133 Light* mainLight = mSceneMgr->createLight("MainLight");
Note: See TracChangeset
for help on using the changeset viewer.