Changeset 1131


Ignore:
Timestamp:
07/13/06 08:17:27 (18 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/App/Demos/Illum/Ogre/Media
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl

    r1126 r1131  
    77 
    88VS_OUT DepthVS(float4 position : POSITION,       
    9                                 uniform float4x4 worldViewProj,                          
    10                                 uniform float4x4 viewProj, 
    11                                 uniform float4x4 cameraMatrix) 
     9                                uniform float4x4 worldViewProj) 
    1210{ 
    1311   
     
    1513  
    1614  OUT.hPosition = mul(worldViewProj, position); 
    17   OUT.Position = mul(viewProj, position); 
     15  OUT.Position = mul(worldViewProj, position); 
    1816   
    1917  return OUT; 
     
    2523        float4 pos = (IN.Position / IN.Position.w); 
    2624        pos = (pos +1.0 ) / 2.0; 
    27         return pos.z;    
     25        return float4(pos.z, pos.z * pos.z, 1, 1);       
    2826} 
    2927 
     
    3937VS_OUT_SHADOW depthShadowVS(float4 position : POSITION,  
    4038                                                        uniform float4x4 worldViewProj, 
     39                                                        uniform float4x4 world, 
    4140                                                        uniform float4x4 lightViewProj) 
    4241{ 
    4342  VS_OUT_SHADOW OUT; 
    4443  OUT.hPosition = mul(worldViewProj, position); 
    45   OUT.lPosition = mul(lightViewProj, position);   
     44  float4 wPos = mul(world, position); 
     45  OUT.lPosition = mul(lightViewProj, wPos);   
    4646  OUT.Position = position;   
    4747  return OUT; 
     
    5454                                        ):COLOR 
    5555{        
    56         float bias = 0.01; 
     56        float bias = 0.1; 
    5757        float4 light = float4(1,1,1,1); 
    5858        float4 shadow = float4(0.3,0.3,0.3,1); 
    5959         
    6060        float4 pos = (IN.lPosition / IN.lPosition.w); 
    61         pos = (pos +1.0 ) / 2.0; 
     61        pos.xy = (pos.xy +1.0 ) / 2.0; 
    6262        pos.y = 1.0 - pos.y; 
    6363        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        } 
    6675        //return abs( pos.z - storedDepth.z );   
    6776        return light;    
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Focusing.hlsl

    r1126 r1131  
    66 
    77VS_OUT FocusingVS(float4 position : POSITION,    
    8                 uniform float4x4 worldView, 
     8                uniform float4x4 world, 
    99                uniform float4x4 worldViewProj, 
    1010                uniform float4x4 lightTransform) 
    1111{ 
    1212  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); 
    1516  return OUT; 
    1617} 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.material

    r1118 r1131  
    148148         vertex_program_ref GameTools/FocusingVS 
    149149         {        
    150             param_named_auto worldView worldview_matrix 
    151             param_named_auto worldViewProj worldviewproj_matrix 
    152             param_named lightTransform matrix4x4          
     150                        param_named_auto world          world_matrix 
     151            param_named_auto worldViewProj worldviewproj_matrix 
     152                        param_named lightTransform matrix4x4      
    153153         }  
    154154         fragment_program_ref  GameTools/FocusingPS 
     
    171171      {  
    172172                //cull_hardware anticlockwise 
     173                //cull_hardware none 
    173174                 
    174175                vertex_program_ref GameTools/ShadowMap/DepthVS 
    175176        {        
    176            param_named_auto viewProj viewproj_matrix 
    177            param_named_auto worldViewProj worldviewproj_matrix             
     177          param_named_auto worldViewProj worldviewproj_matrix             
    178178            }  
    179179                fragment_program_ref  GameTools/ShadowMap/DepthPS 
     
    185185    } 
    186186} 
     187 
     188 
     189material 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  
     1vertex_program GameTools/BlurVS hlsl 
     2{ 
     3        source GameTools_Blur.hlsl 
     4        entry_point BlurVS 
     5        target vs_2_0 
     6}  
     7 
     8fragment_program GameTools/BlurPS hlsl 
     9{ 
     10        source GameTools_Blur.hlsl 
     11        entry_point BlurPS 
     12        target ps_3_0 
     13}  
     14 
    115vertex_program GameTools/FocusingVS hlsl 
    216{ 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/models/level.txt

    r1082 r1131  
    44} 
    55 
    6 entity hangar 
    7 { 
    8         mesh hangarmesh 
    9         transformation 0.5 0 0 0 0 1 0 0 0 0 0.5 0 0 0 0 1 
    10         pathmapfile hangarprm.hdr 
    11 } 
     6//entity hangar 
     7//{ 
     8//      mesh hangarmesh 
     9//      transformation 0.5 0 0 0 0 1 0 0 0 0 0.5 0 0 0 0 1 
     10//      pathmapfile hangarprm.hdr 
     11//} 
    1212 
    1313mesh stairsmesh 
Note: See TracChangeset for help on using the changeset viewer.