- Timestamp:
- 10/18/06 15:21:29 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl
r1629 r1638 55 55 ):COLOR 56 56 { 57 float bias = 0.00 01;57 float bias = 0.001; 58 58 float4 light = float4(1,1,1,1); 59 float4 shadow = float4(0.6,0.6,0.6,1); 59 float4 shadow = float4(0.85,0.85,0.85,1); 60 //float4 shadow = float4(0,0,0,1); 60 61 61 float4 pos = (IN.lPosition / IN.lPosition.w); 62 pos.xy = (pos.xy +1.0 ) / 2.0; 63 pos.y = 1.0 - pos.y; 64 float4 storedDepth = tex2D(depthShadowMap, pos.xy); 62 if(IN.lPosition.z > 0.0) 63 { 64 float4 pos = (IN.lPosition / IN.lPosition.w); 65 66 if(length(pos.xy)>1) 67 light = shadow; 68 else 69 { 70 pos.xy = (pos.xy + 1.0) / 2.0; 71 pos.y = 1.0 - pos.y; 72 float4 storedDepth = tex2D(depthShadowMap, pos.xy); 65 73 66 if(storedDepth.r + bias < pos.z) 67 { 68 float M1 = storedDepth.r; 69 float M2 = storedDepth.g; 70 float v2 = M2 - M1 * M1; 71 float pmax = v2 / (v2 + pow(M1 - pos.z, 2)); 72 light = shadow + (1 - shadow) * pmax; 74 if(storedDepth.r + bias < pos.z) 75 { 76 float M1 = storedDepth.r; 77 float M2 = storedDepth.g; 78 float v2 = M2 - M1 * M1; 79 float pmax = v2 / (v2 + pow(M1 - pos.z, 2)); 80 light = saturate(shadow + (1 - shadow) * pmax); 81 } 82 } 73 83 74 //light = shadow;75 84 } 76 //return abs( pos.z - storedDepth.z ); 85 else 86 light = shadow; 87 77 88 return light; 78 89 } … … 87 98 float bias = 0.0001; 88 99 float4 light = float4(1,1,1,1); 89 float4 shadow = float4(0. 65,0.65,0.65,1);100 float4 shadow = float4(0.95,0.95,0.95,1); 90 101 //float4 shadow = float4(0,0,0,1); 91 102 … … 93 104 { 94 105 float4 pos = (IN.lPosition / IN.lPosition.w); 95 pos.xy = (pos.xy + 1.0) / 2.0; 106 107 if(length(pos.xy)>1) 108 light = shadow; 109 else 110 { 111 pos.xy = (pos.xy + 1.0) / 2.0; 112 pos.y = 1.0 - pos.y; 113 float4 storedDepth = tex2D(depthShadowMap, pos.xy); 96 114 97 98 pos.y = 1.0 - pos.y; 99 float4 storedDepth = tex2D(depthShadowMap, pos.xy); 100 101 if(storedDepth.r + bias < pos.z) 102 { 103 light = shadow; 115 if(storedDepth.r + bias < pos.z) 116 { 117 light = shadow; 118 } 104 119 } 105 //if(length(pos.xy)>1) 106 // light = shadow; 120 107 121 } 122 else 123 light = shadow; 108 124 109 125 -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Diffuse.hlsl
r1590 r1638 111 111 float2 texCoord : TEXCOORD0, 112 112 uniform float4x4 worldViewProj, 113 uniform float4x4 worldI, 113 114 uniform float4x4 world) 114 115 { … … 116 117 OUT.hPos = mul(worldViewProj, position); 117 118 OUT.wPos = mul(world, position).xyz; 118 OUT.mNormal = mul( world, normal);119 OUT.mNormal = mul(normal, worldI); 119 120 //OUT.mNormal = normal; 120 121 OUT.texCoord = texCoord; … … 136 137 float3 pos = IN.wPos - lastCenter; 137 138 139 //return float4(N,1)+ lastCenter.x*0.000001; 138 140 // return float4(N,1)+ lastCenter.x*0.000001; 139 141 // return readCubeMap(SmallEnvMapSampler, pos) + lastCenter.x*0.000001; … … 146 148 float d; 147 149 148 for (float x = 0.5; x < M; x++)149 for (float y = 0.5; y < M; y++)150 for (float x = 1; x < M; x++) 151 for (float y = 1; y < M; y++) 150 152 { 151 153 float2 p, tpos; … … 167 169 } 168 170 169 for (float x = 0.5; x < M; x++)170 for (float y = 0.5; y < M; y++)171 for (float x = 1; x < M; x++) 172 for (float y = 1; y < M; y++) 171 173 { 172 174 float2 p, tpos; … … 187 189 } 188 190 189 for (float x = 0.5; x < M; x++)190 for (float y = 0.5; y < M; y++)191 for (float x = 1; x < M; x++) 192 for (float y = 1; y < M; y++) 191 193 { 192 194 float2 p, tpos; … … 207 209 } 208 210 209 for (float x = 0.5; x < M; x++)210 for (float y = 0.5; y < M; y++)211 for (float x = 1; x < M; x++) 212 for (float y = 1; y < M; y++) 211 213 { 212 214 float2 p, tpos; … … 227 229 } 228 230 229 for (float x = 0.5; x < M; x++)230 for (float y = 0.5; y < M; y++)231 for (float x = 1; x < M; x++) 232 for (float y = 1; y < M; y++) 231 233 { 232 234 float2 p, tpos; … … 247 249 } 248 250 249 for (float x = 0.5; x < M; x++)250 for (float y = 0.5; y < M; y++)251 for (float x = 1; x < M; x++) 252 for (float y = 1; y < M; y++) 251 253 { 252 254 float2 p, tpos; … … 266 268 I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler); 267 269 } 268 float kd = 0. 3;270 float kd = 0.5; 269 271 return kd * I; 270 272 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/Diffuse.material
r1590 r1638 125 125 { 126 126 update_interval 1 127 distance_calc false 127 update_all_face true 128 distance_calc false 129 face_angle_calc false 130 resolution 128 128 131 } 129 132 RenderTechnique ReducedColorCubeMap … … 141 144 vertex_program_ref Diffuse2VS 142 145 { 143 param_named_auto worldViewProj worldviewproj_matrix 144 param_named_auto world world_matrix 146 param_named_auto worldViewProj worldviewproj_matrix 147 param_named_auto worldI inverse_world_matrix 148 param_named_auto world world_matrix 145 149 146 150 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GlassHead.material
r1519 r1638 131 131 RenderTechnique ColorCubeMap 132 132 { 133 update_interval 5 133 update_interval 1 134 update_all_face true 134 135 distance_calc true 3.5 135 136 } 136 137 RenderTechnique DistanceCubeMap 137 138 { 138 update_interval 5 139 update_interval 1 140 update_all_face true 139 141 distance_calc true 3.5 140 142 } -
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/difflab.material
r1629 r1638 155 155 pass 156 156 { 157 IllumTechniques 158 { 159 RenderTechnique DepthShadowReciever 160 { 161 max_light_count 3 162 } 163 } 157 164 158 lighting off 165 159 ambient 0 0 0 1 -
GTP/trunk/App/Demos/Illum/Ogre/src/CausticTest/scripts/CausticTest.vcproj
r1629 r1638 159 159 RelativePath="..\..\..\Media\materials\scripts\GlassHead.material"> 160 160 </File> 161 <Filter162 Name="Header Files"163 Filter="h;hpp;hxx;hm;inl;inc">164 <File165 RelativePath="..\include\CausticTest.h">166 </File>167 </Fil ter>161 </Filter> 162 <Filter 163 Name="Header Files" 164 Filter="h;hpp;hxx;hm;inl;inc"> 165 <File 166 RelativePath="..\include\CausticTest.h"> 167 </File> 168 168 </Filter> 169 169 </Files> -
GTP/trunk/App/Demos/Illum/Ogre/src/DiffuseTest/include/DiffuseTest.h
r1629 r1638 51 51 if (mInputDevice->isKeyDown(KC_UP)) 52 52 { 53 objectNode->translate(0,0,0. 5);53 objectNode->translate(0,0,0.1); 54 54 } 55 55 if (mInputDevice->isKeyDown(KC_MULTIPLY)) … … 71 71 if (mInputDevice->isKeyDown(KC_HOME)) 72 72 { 73 objectNode->translate(0,0. 5,0);73 objectNode->translate(0,0.1,0); 74 74 } 75 75 if (mInputDevice->isKeyDown(KC_END)) 76 76 { 77 objectNode->translate(0,-0. 5,0);77 objectNode->translate(0,-0.1,0); 78 78 } 79 79 if (mInputDevice->isKeyDown(KC_DOWN)) 80 80 { 81 objectNode->translate(0,0,-0. 5);81 objectNode->translate(0,0,-0.1); 82 82 } 83 83 if (mInputDevice->isKeyDown(KC_RIGHT)) … … 578 578 void createScene3() 579 579 { 580 OgreIlluminationManager::getSingleton().setFocusingSM(false); 581 OgreIlluminationManager::getSingleton().setShadowMapSize(1024); 582 // OgreIlluminationManager::getSingleton().setBlurShadowMap(true); 580 583 mSceneMgr->setAmbientLight(ColourValue(0.505 * 0.2, 0.897 * 0.2, 0.914 * 0.2)); 581 584 582 585 SceneNode* rootNode = mSceneMgr->getRootSceneNode(); 583 586 584 Entity* object = mSceneMgr->createEntity("object", " santa.mesh");587 Entity* object = mSceneMgr->createEntity("object", "buddha.mesh"); 585 588 object->setMaterialName("GameTools/Diffuse/use"); 586 589 //object->setMaterialName("GameTools/Diffuse2"); 587 590 objectNode = rootNode->createChildSceneNode(); 588 591 objectNode->attachObject(object); 589 objectNode->scale(0. 1,0.1,0.1);592 objectNode->scale(0.5,0.5,0.5); 590 593 objectNode->rotate(Vector3(0,1,0),Radian(Math::PI)); 591 objectNode->setPosition(0,0, 2);594 objectNode->setPosition(0,0,0); 592 595 objectNode->_updateBounds(); 593 596 … … 622 625 mainBlueLight->setDiffuseColour(ColourValue(0.395,0.766, 1.0)); 623 626 mainBlueLight->setPowerScale(5.0); 624 mainBlueLight->setSpotlightRange(Degree(20),Degree(90)); 627 mainBlueLight->setSpotlightRange(Degree(0),Degree(160)); 628 mainBlueLight->setAttenuation(5, 0, 1, 0); 625 629 SceneNode* mainBlueLightNode = rootNode->createChildSceneNode(); 626 630 mainBlueLightNode->setPosition(-0.546,2.095,1.035);
Note: See TracChangeset
for help on using the changeset viewer.