Ignore:
Timestamp:
10/18/06 15:21:29 (18 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/App/Demos/Illum/Ogre/Media
Files:
1 added
5 edited

Legend:

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

    r1629 r1638  
    5555                                        ):COLOR 
    5656{        
    57         float bias = 0.0001; 
     57        float bias = 0.001; 
    5858        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); 
    6061         
    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); 
    6573         
    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                } 
    7383                 
    74                 //light = shadow; 
    7584        } 
    76         //return abs( pos.z - storedDepth.z );   
     85        else 
     86                light = shadow;  
     87         
    7788        return light;    
    7889} 
     
    8798        float bias = 0.0001; 
    8899        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); 
    90101        //float4 shadow = float4(0,0,0,1); 
    91102         
     
    93104        { 
    94105                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); 
    96114         
    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                        } 
    104119                } 
    105                 //if(length(pos.xy)>1) 
    106                 //              light = shadow; 
     120                 
    107121        } 
     122        else 
     123                light = shadow; 
    108124         
    109125         
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Diffuse.hlsl

    r1590 r1638  
    111111                float2 texCoord : TEXCOORD0,                     
    112112                uniform float4x4 worldViewProj, 
     113                uniform float4x4 worldI, 
    113114                uniform float4x4 world) 
    114115{ 
     
    116117  OUT.hPos = mul(worldViewProj, position); 
    117118  OUT.wPos = mul(world, position).xyz;   
    118   OUT.mNormal = mul(world, normal); 
     119  OUT.mNormal = mul(normal, worldI); 
    119120  //OUT.mNormal = normal; 
    120121  OUT.texCoord = texCoord; 
     
    136137    float3 pos = IN.wPos - lastCenter; 
    137138     
     139    //return  float4(N,1)+ lastCenter.x*0.000001;  
    138140   // return float4(N,1)+ lastCenter.x*0.000001;  
    139141  //  return  readCubeMap(SmallEnvMapSampler, pos) + lastCenter.x*0.000001; 
     
    146148        float d;  
    147149         
    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++)                                                                           
    150152         {                                                                                                                               
    151153                float2 p, tpos;  
     
    167169        }                                                                                                                                                        
    168170         
    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++)                                                                                   
    171173         {                                                                                                                               
    172174                float2 p, tpos;  
     
    187189         }       
    188190          
    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++)                                                                                   
    191193         {                                                                                                                               
    192194                float2 p, tpos;  
     
    207209         }               
    208210          
    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++)                                                                                   
    211213         {                                                                                                                               
    212214                float2 p, tpos;  
     
    227229         } 
    228230          
    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++)                                                                           
    231233                {                                                                                                                                
    232234                float2 p, tpos;  
     
    247249        } 
    248250          
    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++)                                                                                   
    251253         {                                                                                                                               
    252254                float2 p, tpos;  
     
    266268                I += 0.5 * Le * GetContibution( L, L1, L2, L3, L4, pos, N, DistanceEnvMapSampler);                               
    267269         }       
    268          float kd = 0.3;                                                                                                                                                 
     270         float kd = 0.5;                                                                                                                                                 
    269271        return kd * I; 
    270272} 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/Diffuse.material

    r1590 r1638  
    125125                        { 
    126126                                update_interval         1 
    127                                 distance_calc false                                              
     127                                update_all_face         true 
     128                                distance_calc           false 
     129                                face_angle_calc         false 
     130                                resolution                      128                                              
    128131                        } 
    129132                        RenderTechnique ReducedColorCubeMap 
     
    141144                vertex_program_ref Diffuse2VS 
    142145                {        
    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 
    145149         
    146150                }  
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GlassHead.material

    r1519 r1638  
    131131                        RenderTechnique ColorCubeMap 
    132132                        { 
    133                                 update_interval         5 
     133                                update_interval         1 
     134                                update_all_face true 
    134135                                distance_calc true 3.5                                   
    135136                        } 
    136137                        RenderTechnique DistanceCubeMap 
    137138                        { 
    138                                 update_interval         5 
     139                                update_interval         1 
     140                                update_all_face true 
    139141                                distance_calc true 3.5                                           
    140142                        } 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/difflab.material

    r1629 r1638  
    155155                pass 
    156156                { 
    157                         IllumTechniques 
    158                         { 
    159                                 RenderTechnique DepthShadowReciever 
    160                                 { 
    161                                         max_light_count 3 
    162                                 } 
    163                         } 
     157                         
    164158                lighting off 
    165159                        ambient 0 0 0 1 
Note: See TracChangeset for help on using the changeset viewer.