Ignore:
Timestamp:
10/27/06 17:40:02 (18 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/App/Demos/Illum/Ogre/Media/materials
Files:
8 edited

Legend:

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

    r1257 r1691  
    1 #define samplesU 5 
    2 #define samplesV 5 
     1#define samplesU 3 
     2#define samplesV 3 
    33 
    44struct VS_INPUT {            
     
    3939  return tex2D(Texture, uv); 
    4040} 
     41 
     42VS_OUTPUT BlurCubeFaceVS(VS_INPUT IN) { 
     43        VS_OUTPUT OUT; 
     44    OUT.hPosition = IN.Position;    
     45    OUT.Position = OUT.hPosition; 
     46    return OUT; 
     47} 
     48 
     49float4 BlurCubeFacePS(VS_OUTPUT IN, 
     50                        uniform samplerCUBE Texture : register(s0), 
     51                        uniform float width, 
     52                        uniform float height, 
     53                        uniform float face ) : COLOR 
     54 
     55 
     56  float2 pixel = float2(2.0 / width, 2.0 / height); 
     57  float2 uv = IN.Position + pixel * 0.5; 
     58 
     59  float4 sum = float4(0,0,0,0); 
     60 
     61        for(int i = 0; i < samplesU; i++) 
     62         for(int j = 0; j < samplesV; j++) 
     63         { 
     64                float3 dir; 
     65                float2 pos = uv + float2(i - samplesU * 0.5,j - samplesV * 0.5) * pixel; 
     66                if (face == 0) dir = float3(1, pos.y, -pos.x); 
     67                if (face == 1) dir = float3(-1, pos.y, pos.x); 
     68                if (face == 2) dir = float3(pos.x, 1, -pos.y); 
     69                if (face == 3) dir = float3(pos.x, -1, pos.y); 
     70                if (face == 4) dir = float3(pos.x, pos.y, 1); 
     71                if (face == 5) dir = float3(-pos.x, pos.y,-1); 
     72                 
     73                sum += texCUBE(Texture, dir); 
     74         } 
     75                 
     76 
     77  sum /= samplesU * samplesV; 
     78 
     79  return sum; 
     80  //return texCUBE(Texture, float3(uv, 1)) + face * 0.0000001; 
     81} 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_CauCube.hlsl

    r1487 r1691  
    2323   { 
    2424                OUT.color = float4(0,0,0,0);             
    25                 OUT.hPosition = float4(0, 0, 1000000, 1); 
     25                OUT.hPosition = float4(0, 0, -1000000, 1); 
    2626   } 
    2727   else 
     
    4343                        sumdist += dist; 
    4444                        valids++; 
    45                 } 
     45                }                        
    4646                 
    4747                float4 pos2 = tex2Dlod(PhotonHitMap, float4(uv + float2(-pixel, pixel),0,0)); 
     
    6868                        valids++; 
    6969                } 
    70                                  
    71                 float avrdist = sumdist / 4;//valids; 
    72                 float maxdist = 1; 
    73                 intensity = max(maxdist - avrdist, 0.0) / maxdist; 
    74                  
     70                //if(valids == 0) sumdist = 100000;              
     71                float avrdist = sumdist / valids; 
     72                //float maxdist = 10; 
     73                //intensity = max(maxdist - avrdist, 0.0) / maxdist; 
     74                intensity = 60.0 / (avrdist * avrdist * 3.14); 
    7575                //intensity = valids / 4.0;//avrdist; 
    7676                 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_DepthShadow.hlsl

    r1671 r1691  
    8080        float bias = 0.001; 
    8181        float4 light = float4(1,1,1,1); 
    82         float4 shadow = float4(0.85,0.85,0.85,1); 
     82        float4 shadow = float4(0.25,0.25,0.25,1); 
    8383        //float4 shadow = float4(0,0,0,1); 
    8484         
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Localized_EnvMap.hlsl

    r1525 r1691  
    4747}*/ 
    4848 
    49  
    50  
    51  
     49#define LIN_ITERATIONCOUNT 8 
     50#define SECANT_ITERATIONCOUNT 3 
     51 
     52float3 Hit(float3 x, float3 R, samplerCUBE mp) 
     53{ 
     54        R = normalize(R); 
     55        float3 xNorm = normalize(x); 
     56        float3 dt = (R - xNorm) / (float) LIN_ITERATIONCOUNT; 
     57        //float3 pN = normalize(cross(R, xNorm)); 
     58        //float3 N = normalize(cross(pN,R)); 
     59        //float d = dot(x, N); 
     60         
     61        float3 under = x; 
     62        float3 over = R; 
     63        float dUnder = readDistanceCubeMap( mp, x); 
     64        float dOver = readDistanceCubeMap( mp, R); 
     65         
     66        for(int i = 0; i < LIN_ITERATIONCOUNT; i++) 
     67        { 
     68                float3 dir = normalize(x + dt * i); 
     69                float dist = readDistanceCubeMap( mp, dir); 
     70                float3 point = dir * dist; 
     71                 
     72                float t = length(x) / dot(dir,xNorm); 
     73                 
     74                if(dist > t) //undershooting 
     75                { 
     76                        under = normalize(point); 
     77                        dUnder = dist; 
     78                } 
     79                else                            //overshooting 
     80                { 
     81                        over = normalize(point); 
     82                        dOver = dist; 
     83                        i = LIN_ITERATIONCOUNT; 
     84                } 
     85                 
     86        /* 
     87                 
     88                if( dot(N, point) > d)//undershooting 
     89                        under = normalize(point); 
     90                else                            //overshooting 
     91                { 
     92                        over = normalize(point); 
     93                        i = LIN_ITERATIONCOUNT; 
     94                } 
     95        */ 
     96        } 
     97         
     98        float r1 = length(x) * ctan(acos(dot(under, xNorm))); 
     99        float r2 = length(x) * ctan(acos(dot(over, xNorm))); 
     100        float rl = dUnder; 
     101         
     102        float ppp = dOver /  readDistanceCubeMap( mp, x);                       // |p|/|p’| 
     103        float dun = 0, pun = ppp, dov = 0, pov = 0; 
     104        float dl = rl * ( 1 - ppp );                                                    // eq. 2 
     105        float3 l = x + R * dl;                                                                  // ray equation 
     106         
     107        for( int i = 0; i < SECANT_ITERATIONCOUNT; i++ ) 
     108        { 
     109                float llp = length( l ) / readDistanceCubeMap( mp, l);          // |l|/|l’| 
     110                if ( llp < 0.999f )                                                                     // undershooting 
     111                { 
     112                        dun = dl; pun = llp;                                                    // last undershooting 
     113                        dl += ( dov == 0 ) ? rl * ( 1 - llp ) :                 // eq. 2 
     114                                ( dl - dov ) * ( 1 - llp ) / ( llp - pov );     // eq. 3 
     115                } else if ( llp > 1.001f )                                                      // overshooting 
     116                { 
     117                        dov = dl; pov = llp;                                                    // last overshooting 
     118                        dl += ( dl -dun ) * ( 1 - llp ) / ( llp - pun );// eq. 3 
     119                } 
     120                l = x + R * dl;                                                                         // ray equation 
     121        } 
     122         
     123        return (under + over)/2.0; 
     124} 
     125 
     126/* 
    52127// This function is called several times. 
    53128float3 Hit( float3 x, float3 R, samplerCUBE mp ) 
     
    78153        return l;                                                                                               // computed hit point 
    79154} 
     155*/ 
    80156 
    81157void LocalizedVS(float4 position : POSITION, 
     
    163239        newTexCoord = R;         
    164240         
    165         //newTexCoord = Hit(mPos, R, DistanceMap); 
    166          
    167         Color = readCubeMap(CubeMap, newTexCoord ) + lastCenter.x*0.000001;      
     241        newTexCoord = Hit(mPos, R, DistanceMap); 
     242         
     243        Color = readCubeMap(CubeMap, newTexCoord ) /*+ lastCenter.x*0.000001*/;  
    168244         
    169245        float ctheta_in = dot(mNormal,R); 
     
    235311        newTexCoord = Hit(mPos, R, DistanceMap); 
    236312                 
    237         Color = float4(normalize(newTexCoord),1); 
     313        Color = float4(newTexCoord, 1); 
    238314         
    239315        //Color = 0.0001 * Color +  float4(0,0,1,1); 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.material

    r1683 r1691  
    116116                pass 
    117117                { 
    118                         ambient 0.3 0.3 0.4 
    119                         diffuse 0.9 0.9 1.0 
     118                        ambient 0.8 0.8 0.8 
     119                        diffuse 0.0 0.0 0.0 
     120                        specular 0.0 0.0 0.0 
    120121                        //lighting off 
    121122                        IllumTechniques 
    122123                        {                        
    123                                 //RenderTechnique CausticReciever 
     124                                RenderTechnique CausticReciever 
     125                                { 
     126                                        max_caster_count        10 
     127                                } 
     128                                //RenderTechnique DepthShadowReciever 
    124129                                //{ 
    125                                 //      max_caster_count        10 
    126                                 //} 
    127                                 RenderTechnique DepthShadowReciever 
    128                                 { 
    129                                 }                                
    130                         }                
     130                                 
     131                                //}                      
     132                        } 
     133                        texture_unit 
     134                        { 
     135                                texture rockWall.tga 
     136                        } 
     137                                 
    131138                } 
    132139        } 
     
    302309} 
    303310 
     311material GameTools/BlurCubeFace 
     312{  
     313 
     314   technique  
     315   {  
     316       
     317      pass  
     318      {                  
     319                vertex_program_ref GameTools/BlurCubeFaceVS 
     320        {        
     321                      
     322            }  
     323                fragment_program_ref  GameTools/BlurCubeFacePS 
     324        {  
     325                        param_named_auto width viewport_width 
     326                        param_named_auto height viewport_height 
     327                        param_named face float 0 
     328        } 
     329        texture_unit 
     330        { 
     331                        filtering bilinear 
     332        } 
     333         
     334       } 
     335    } 
     336} 
     337 
    304338vertex_program PhaseVS hlsl 
    305339{ 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GameTools.program

    r1671 r1691  
    1010        source GameTools_Blur.hlsl 
    1111        entry_point BlurPS 
     12        target ps_3_0 
     13}  
     14 
     15vertex_program GameTools/BlurCubeFaceVS hlsl 
     16{ 
     17        source GameTools_Blur.hlsl 
     18        entry_point BlurCubeFaceVS 
     19        target vs_2_0 
     20}  
     21 
     22fragment_program GameTools/BlurCubeFacePS hlsl 
     23{ 
     24        source GameTools_Blur.hlsl 
     25        entry_point BlurCubeFacePS 
    1226        target ps_3_0 
    1327}  
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/GlassHead.material

    r1638 r1691  
    5050                    param_named_auto resolution viewport_width 
    5151                    //param_named CauSpriteSize float 10.0           
    52                     param_named CauSpriteSize float 70.0             
     52                    param_named CauSpriteSize float 20.0             
    5353                }  
    5454                fragment_program_ref  GameTools/CauPS 
     
    131131                        RenderTechnique ColorCubeMap 
    132132                        { 
    133                                 update_interval         1 
     133                                update_interval         0 
    134134                                update_all_face true 
    135135                                distance_calc true 3.5                                   
     
    137137                        RenderTechnique DistanceCubeMap 
    138138                        { 
    139                                 update_interval         1 
     139                                update_interval         0 
    140140                                update_all_face true 
    141141                                distance_calc true 3.5                                           
     
    144144                        { 
    145145                                attenuation     0 
    146                                 photonmap_resolution 32 
    147                                 caustic_cubemap_resolution 512   
    148                                 //caustic_map_material          GameTools/CauTri 
    149                                 //use_triangles true                             
     146                                photonmap_resolution 128 
     147                                caustic_cubemap_resolution 256   
     148                                caustic_map_material    GameTools/CauTri 
     149                                use_triangles   true 
     150                                blur_caustic_cubemap true                                
    150151                        } 
    151152                         
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/kupola.material

    r1683 r1691  
    1515                        //      max_caster_count        10 
    1616                        //} 
    17                         RenderTechnique DepthShadowReciever 
    18                         { 
    19                                  
    20                         } 
     17                        //RenderTechnique DepthShadowReciever 
     18                        //{ 
     19                        //       
     20                        //} 
    2121                } 
    2222                 
     
    6969                                //      max_caster_count        10 
    7070                                //} 
    71                                 RenderTechnique DepthShadowReciever 
    72                                 { 
    73                                          
    74                                 } 
     71                                //RenderTechnique DepthShadowReciever 
     72                                //{ 
     73                                //       
     74                                //} 
    7575                        } 
    7676                         
Note: See TracChangeset for help on using the changeset viewer.