Changeset 2181


Ignore:
Timestamp:
03/01/07 22:48:05 (17 years ago)
Author:
szirmay
Message:
 
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  
    4040material GTP/Basic/Depth 
    4141{ 
    42  technique 
     42 technique maintechnique 
    4343 { 
    44   pass 
     44  pass mainpass 
    4545  { 
    4646   cull_hardware clockwise 
     
    4949     param_named_auto WorldViewProj worldviewproj_matrix      
    5050   }  
    51    vertex_program_ref GTP/Basic/VDepth_PS 
     51   fragment_program_ref GTP/Basic/VDepth_PS 
    5252   {     
    5353   }    
     
    5858material GTP/Basic/DepthCCW : GTP/Basic/Depth 
    5959{ 
    60  technique 0 
     60 technique maintechnique 
    6161 { 
    62   pass 0 
     62  pass mainpass 
    6363  { 
    6464   cull_hardware anticlockwise    
     
    7979     param_named_auto WorldView     worldview_matrix      
    8080   }  
    81    vertex_program_ref GTP/Basic/CDepth_PS 
     81   fragment_program_ref GTP/Basic/CDepth_PS 
    8282   {     
    8383   }    
     
    8888material GTP/Basic/Distance 
    8989{ 
    90  technique 
     90 technique maintechnique 
    9191 { 
    92   pass 
     92  pass mainpass 
    9393  { 
    9494   cull_hardware clockwise 
     
    107107material GTP/Basic/DistanceCCW : GTP/Basic/Distance 
    108108{ 
    109  technique 0 
     109 technique maintechnique 
    110110 { 
    111   pass 0 
     111  pass mainpass 
    112112  { 
    113113   cull_hardware anticlockwise    
     
    118118material GTP/Basic/Distance_Normalized 
    119119{ 
    120  technique 
     120 technique maintechnique 
    121121 { 
    122   pass 
     122  pass mainpass 
    123123  { 
    124124   cull_hardware clockwise 
     
    138138material GTP/Basic/Distance_NormalizedCCW : GTP/Basic/Distance_Normalized 
    139139{ 
    140  technique 0 
     140 technique maintechnique 
    141141 { 
    142   pass 0 
     142  pass mainpass 
    143143  { 
    144144   cull_hardware anticlockwise    
     
    160160                        max_light_count 1 
    161161                        vertex_program_name GTP/Basic/LightVPos_VS 
    162                         fragment_program_name GTP/Basic/SM/Depth_PS 
     162                        fragment_program_name GTP/Basic/SM/Depth_VSM_PS 
    163163                        set_light_view false 
    164164                        set_light_farplane false 
     165                        world_view_proj_param_name WorldViewProj 
     166                        world_param_name World 
     167                        light_viewproj_param_name LightViewProj                  
    165168                }        
    166169     } 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic.program

    r2179 r2181  
    4949   source GTPBasic_VS.hlsl 
    5050   entry_point VPos 
    51    target vs_1_1 
     51   target vs_2_0 
    5252} 
    5353 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic_PS.hlsl

    r2179 r2181  
    2828{ 
    2929 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);      
    3131} 
    3232 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPBasic_VS.hlsl

    r2179 r2181  
    145145}; 
    146146 
    147 VPos_OUT VPos(float4 position : POSITION0, 
     147VPos_OUT VPos(float4 position : POSITION, 
    148148              uniform float4x4 WorldViewProj) 
    149149{ 
     
    159159}; 
    160160 
    161 MPos_OUT MPos(float4 position : POSITION0, 
     161MPos_OUT MPos(float4 position : POSITION, 
    162162              uniform float4x4 WorldViewProj) 
    163163{ 
     
    168168} 
    169169 
    170 MPos_OUT MPos_NoTransform(float4 position : POSITION0) 
     170MPos_OUT MPos_NoTransform(float4 position : POSITION) 
    171171{ 
    172172 MPos_OUT OUT; 
     
    182182}; 
    183183 
    184 CPos_OUT CPos(float4 position : POSITION0, 
     184CPos_OUT CPos(float4 position : POSITION, 
    185185              uniform float4x4 WorldViewProj, 
    186186              uniform float4x4 WorldView) 
     
    222222}; 
    223223 
    224 LightVPos_OUT LightVPos(float4 position : POSITION0, 
     224LightVPos_OUT LightVPos(float4 position : POSITION, 
    225225              uniform float4x4 WorldViewProj, 
    226226              uniform float4x4 LightViewProj, 
     
    242242}; 
    243243 
    244 LightCPos_OUT LightCPos(float4 position : POSITION0, 
     244LightCPos_OUT LightCPos(float4 position : POSITION, 
    245245              uniform float4x4 WorldViewProj, 
    246246              uniform float4x4 World, 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPBasic/GTPShadowMap_PS.hlsl

    r2179 r2181  
    1414#define DEPTH_BIAS      0.001 
    1515#define DEPTH_BIAS_VSM  0.001 
    16 #define DEPTH_EPSILON   0.001 
     16#define DEPTH_EPSILON   0.00005 
    1717#define DIST_BIAS       0.1 
    1818#define DIST_BIAS_VSM   0.001 
     
    2424                      uniform sampler2D shadowMap) : COLOR 
    2525{ 
    26   float4 light = shadowColor;    
    27   if( IN.LightVPos.z > 0.0) 
     26  float4 light = shadowColor;      
     27         
     28  if(IN.LightVPos.z > 0.0) 
    2829  { 
    29     float4 pos = (IN.LightVPos / IN.LightVPos.w); 
    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  }              
    3637  return light;  
    3738} 
     
    4546   
    4647  if( pos.z > 0.0) 
    47   {      
    48     { 
     48  {          
    4949        float depth = pos.z; 
    5050        pos.xy = (pos.xy + 1.0) / 2.0; 
     
    5858        float v2 = min(max(M2 - M1 * M1, 0.0) +  DEPTH_EPSILON, 1.0); 
    5959        float m_d = M1 - depth; 
    60         float pmax = v2 / (v2 + m_d * m_d); 
     60    float pmax = v2 / (v2 + m_d * m_d); 
    6161                                                 
    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);     
    6664  } 
    6765  else 
     
    7371 
    7472float4 shadowMapDist(LightCPos_OUT IN, 
    75                                         //uniform float lightFarPlane, 
     73                                        uniform float lightFarPlane, 
    7674                                         uniform sampler2D shadowMap) : COLOR 
    7775{ 
    78   float4 light = shadowColor; 
    79    
     76  float4 light = shadowColor;   
    8077  if( IN.LightVPos.z > 0.0) 
    8178  {      
     
    8582    //if(d <= 1.0) 
    8683    //{ 
    87                 float dist = length(IN.LightCPos.xyz) ; 
     84                float dist = length(IN.LightCPos.xyz) / lightFarPlane; 
    8885                pos.xy = (pos.xy + 1.0) / 2.0; 
    8986                pos.y = 1.0 - pos.y; 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl

    r2138 r2181  
    5353{ 
    5454        float4 hPosition        : POSITION; 
    55         float4 Position         : TEXCOORD0; 
    56         float4 lPosition        : TEXCOORD1; 
    57         float4 lVPosition       : TEXCOORD2; 
     55        float4 lPosition        : TEXCOORD0; 
     56        float4 lVPosition       : TEXCOORD1; 
    5857}; 
    5958 
     
    6766  float4 wPos = mul(world, position); 
    6867  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/* 
    7573float4 depthShadowPS(VS_OUT_SHADOW IN, 
    7674                                        uniform float4x4 lightViewProj, 
     
    110108        return light;    
    111109} 
    112  
     110*/ 
    113111 
    114112 
     
    125123  OUT.lPosition = mul(lightViewProj, wPos); 
    126124  OUT.lVPosition = mul(lightView, wPos);   
    127   OUT.Position = position;   
    128125  return OUT; 
    129126} 
     
    213210} 
    214211*/ 
    215 /* 
     212 
    216213float4 depthShadowPS(VS_OUT_SHADOW IN, 
    217214                                        uniform float4x4 lightViewProj, 
     
    249246        return light;    
    250247} 
    251 */ 
  • GTP/trunk/App/Demos/Illum/Ogre/bin/Debug/ogre.cfg

    r2167 r2181  
    66Floating-point mode=Fastest 
    77Full Screen=No 
    8 Rendering Device=NVIDIA GeForce 7950 GX2 
     8Rendering Device=NVIDIA GeForce 6800 GT 
    99VSync=No 
    1010Video Mode=800 x 600 @ 32-bit colour 
  • GTP/trunk/App/Demos/Illum/Ogre/bin/Release/ogre.cfg

    r2167 r2181  
    66Floating-point mode=Fastest 
    77Full Screen=No 
    8 Rendering Device=NVIDIA GeForce 7950 GX2 
     8Rendering Device=NVIDIA GeForce 6800 GT 
    99VSync=No 
    1010Video Mode=800 x 600 @ 32-bit colour 
  • GTP/trunk/App/Demos/Illum/Ogre/src/PRMDemo/include/PRMDemo.h

    r2179 r2181  
    104104                OgreIlluminationManager::getSingleton().setMainViewport(mWindow->getViewport(0)); 
    105105                OgreIlluminationManager::getSingleton().setShadowMapSize(512); 
    106                 OgreIlluminationManager::getSingleton().setShadowMapMaterialName("GameTools/ShadowMapDistance"); 
     106                OgreIlluminationManager::getSingleton().setShadowMapMaterialName("GTP/Basic/DepthCCW"); 
    107107                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); 
    111111                                 
    112112                Root::getSingleton()._setCurrentSceneManager(mSceneMgr); 
     
    126126                SceneSerializer s(mSceneMgr); 
    127127                DataStreamPtr inputStream;                               
    128                 inputStream = ResourceGroupManager::getSingleton().openResource("level.txt");   //towers2.level  
     128                inputStream = ResourceGroupManager::getSingleton().openResource("towers2.level");       //towers2.level  
    129129                s.parseScript(inputStream, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 
    130130                         
    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)); 
    132132 
    133133                Light* mainLight = mSceneMgr->createLight("MainLight"); 
Note: See TracChangeset for help on using the changeset viewer.