Ignore:
Timestamp:
01/24/07 21:44:30 (18 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs
Files:
3 edited

Legend:

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

    r1691 r2054  
    113113 
    114114 
     115 
    115116VS_OUT_SHADOW distShadowVS(float4 position : POSITION,   
    116117                                                        uniform float4x4 worldViewProj, 
     
    128129} 
    129130 
    130  
     131/* 
    131132float4 distShadowPS(VS_OUT_SHADOW IN, 
    132133                                        uniform float4x4 lightViewProj, 
     
    173174         
    174175        return shadow + (1 - shadow) * light; 
    175 } 
    176  
     176}*/ 
     177 
     178float4 distShadowPS(VS_OUT_SHADOW IN, 
     179                                        uniform float4x4 lightViewProj, 
     180                                        uniform float lightFarPlane, 
     181                                        uniform sampler2D depthShadowMap : register(s0) 
     182                                        ):COLOR 
     183{        
     184        float bias = 0.001; 
     185        float epsilon = 0.001; 
     186        float4 light = float4(1,1,1,1); 
     187        float4 shadow = float4(0.85,0.85,0.85,1); 
     188         
     189        if(IN.lPosition.z > 0.0) 
     190        { 
     191                float4 pos = (IN.lPosition / IN.lPosition.w); 
     192                 
     193                float d = length(pos.xy); 
     194                         
     195                light = saturate((1.0 - d)/0.05); 
     196                 
     197                if(d <= 1.0) 
     198                { 
     199                        float dist = length(IN.lVPosition.xyz) / lightFarPlane; 
     200                        pos.xy = (pos.xy + 1.0) / 2.0; 
     201                        pos.y = 1.0 - pos.y; 
     202                        float4 storedDist = tex2D(depthShadowMap, pos.xy); 
     203                         
     204                light = storedDist.r + dist*0.000000000001; 
     205         
     206                } 
     207                 
     208        } 
     209        else 
     210                light = 0;       
     211         
     212        return shadow + (1 - shadow) * light; 
     213} 
    177214 
    178215/* 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Diffuse.hlsl

    r1929 r2054  
    11float REDUCED_CUBEMAP_SIZE; 
     2int CUBEMAP_SIZE = 128; 
     3int RATE = 32; 
    24 
    35float4 readCubeMap(samplerCUBE cm, float3 coord)                 
     
    1315        if(dist == 0) dist = 1000000; ///sky 
    1416        return dist; 
     17} 
     18 
     19 
     20///// 
     21/// Reduce cube map shader 
     22///// 
     23struct MPos_OUT 
     24{ 
     25 float4 VPos : POSITION; 
     26 float4 MPos : TEXCOORD0; 
     27}; 
     28 
     29float4 ReduceCubeMap_PS(MPos_OUT IN, 
     30                                                uniform int nFace, 
     31                                                uniform samplerCUBE EnvironmentMapSampler : register(s0) ) : COLOR 
     32 
     33   RATE = 32; 
     34   CUBEMAP_SIZE = 128; 
     35   float4 color = 0; 
     36   float3 dir; 
     37   
     38   for (int i = 0; i < RATE; i++) 
     39     for (int j = 0; j < RATE; j++) 
     40    { 
     41                float2 pos; 
     42                pos.x = IN.mPos.x + (2*i + 1)/(float)CUBEMAP_SIZE; 
     43                pos.y = IN.mPos.y - (2*j + 1)/(float)CUBEMAP_SIZE;      // y=-u 
     44 
     45                // "scrambling" 
     46                if (nFace == 0) dir = float3(1, pos.y, -pos.x); 
     47                if (nFace == 1) dir = float3(-1, pos.y, pos.x); 
     48                if (nFace == 2) dir = float3(pos.x, 1, -pos.y); 
     49                if (nFace == 3) dir = float3(pos.x, -1, pos.y); 
     50                if (nFace == 4) dir = float3(pos.x, pos.y, 1); 
     51                if (nFace == 5) dir = float3(-pos.x, pos.y,-1); 
     52 
     53                color += texCUBE( EnvironmentMapSampler, dir); 
     54    } 
     55  
     56        return color / (RATE*RATE);              
    1557} 
    1658 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapotNew.hlsl

    r2024 r2054  
    413413        return I; 
    414414} 
    415  
     415/* 
    416416float4 mainPS(VertOut IN, 
    417417                                                        uniform float3 cameraPos, 
     
    448448   return Color; 
    449449} 
    450  
    451 /* 
     450*/ 
     451 
    452452float4 mainPS(VertOut IN, 
    453453                                                        uniform float3 cameraPos, 
     
    486486          
    487487        return Color; 
    488 }*/ 
    489  
    490 /* 
    491 float4 mainPS(VertOut IN, 
    492                                                         uniform float3 cameraPos, 
    493                                                         uniform samplerCUBE CubeMap : register(s0), 
    494                                                         uniform samplerCUBE DistanceMap : register(s1), 
    495                                                         uniform samplerCUBE NormDistMap1 : register(s2), 
    496                                                         uniform samplerCUBE NormDistMap2 : register(s3), 
    497                                                         uniform float3 lastCenter, 
    498                                                         uniform float SingleBounce, 
    499                                                         uniform float refIndex, 
    500                                                         uniform float4 min, 
    501                                                         uniform float4 min1, 
    502                                                         uniform float4 min2, 
    503                                                         uniform float4 max, 
    504                                                         uniform float4 max1, 
    505                                                         uniform float4 max2 
    506                                                         ):COLOR 
    507 { 
    508   float2 miniMaxi1; 
    509   miniMaxi1.x = min1.a; 
    510   miniMaxi1.y = max1.a; 
    511     
    512   float4 I = float4(0,0,0,0); 
    513                  
    514   float3 N = normalize(IN.mNormal); 
    515   float3 x = IN.wPos - lastCenter; 
    516   float3 V  = normalize(IN.wPos - cameraPos); 
    517   float3 R = normalize(reflect(V, N));  
    518           
    519   float3 p; 
    520   float dl, dp, llp, ppp;    
    521   linearSearch( x, R, N, NormDistMap1, miniMaxi1, p, dl, dp, llp, ppp); 
    522   if( dot(p, p) != 0 ) 
    523   { 
    524     //secantSearch(x, R, NormDistMap1, dl, dp, llp, ppp, p); 
    525     I = readCubeMap(NormDistMap1, p); 
    526   } 
    527 <<<<<<< .mine 
    528 I = max1 + 0.0000000000001 *x.x; 
    529 ======= 
    530  I = max1 + 0.000000001 * x.x; 
    531 >>>>>>> .r1994 
    532   //I = readCubeMap(NormDistMap1, R)+0.00000000001*x.x;  
    533   return I;      
    534 }*/ 
     488} 
Note: See TracChangeset for help on using the changeset viewer.