Ignore:
Timestamp:
11/08/06 14:03:40 (18 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/App/Demos/Illum/Ogre/Media/materials
Files:
3 edited

Legend:

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

    r1720 r1724  
    4646float3 Hit(float3 x, float3 R, samplerCUBE mp, float cameraDistance = 0) 
    4747{ 
     48        return R + 0.000000001 *x; 
    4849        R = normalize(R); 
    4950         
     
    197198                out float4 hPos : POSITION,              
    198199                uniform float4x4 worldViewProj, 
    199                 uniform float4x4 world) 
     200                uniform float4x4 world, 
     201                uniform float4x4 worldI 
     202                ) 
    200203{ 
    201204  
    202205  hPos = mul(worldViewProj, position); 
    203206  wPos = mul(world, position).xyz;   
    204   mNormal = normal; 
     207  mNormal = mul(normal, worldI);   
    205208  otexCoord = texCoord; 
    206209} 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/MetalTeapot.hlsl

    r1720 r1724  
    99float readDistanceCubeMap(samplerCUBE dcm, float3 coord)                 
    1010{ 
    11         float dist = texCUBE(dcm, float3(coord.xy, - coord.z)).r; 
     11        float dist = texCUBE(dcm, float3(coord.xy, - coord.z)).a; 
    1212        return dist; 
    1313} 
     
    1515 
    1616 
    17 #define LIN_ITERATIONCOUNT 2 
     17#define LIN_ITERATIONCOUNT 5 
    1818#define SECANT_ITERATIONCOUNT 2 
    19 /* 
    20 float3 Hit(float3 x, float3 R, samplerCUBE mp, float cameraDistance = 0) 
     19 
     20float Hit(float3 x, float3 R, samplerCUBE mp, out float3 newDir) 
    2121{ 
    2222        R = normalize(R); 
     
    3030        float dp, dl = 0, ppp, llp; 
    3131        float lR = readDistanceCubeMap(mp, R); 
    32         float3 p = R; 
    33          
     32        //float3 p = R; 
     33        float3 p = 0; 
     34                 
    3435        float dt = 1.0 / LIN_ITERATIONCOUNT; 
    3536         
     
    3839        while(t < 1.0 && !overshoot) 
    3940        { 
    40                 //if(!overshoot) 
    41                 //{ 
    42                         dp = a * t / (1 - t); 
    43                         p = x + R * dp; 
    44                         float dist = readDistanceCubeMap(mp, p); 
    45                         if(dist > 0) 
    46                         { 
    47                                 ppp = length(p) / dist; 
    48                                 if(ppp < 1) 
    49                                 { 
    50                                         dl = dp; 
    51                                         llp = ppp;               
    52                                         undershoot = true;               
    53                                 } 
    54                                 else 
    55                                 { 
    56                                         if (undershoot)  
    57                                            overshoot = true; 
    58                                 } 
    59                         } 
    60                         else  
    61                                 undershoot = false; 
    62                 //} 
     41                dp = a * t / (1 - t); 
     42                p = x + R * dp; 
     43                float dist = readDistanceCubeMap(mp, p); 
     44                if(dist > 0) 
     45                { 
     46                        ppp = length(p) / dist; 
     47                        if(ppp < 1) 
     48                        { 
     49                                dl = dp; 
     50                                llp = ppp;               
     51                                undershoot = true;               
     52                        } 
     53                        else 
     54                        { 
     55                                if (undershoot)  
     56                                   overshoot = true; 
     57                        } 
     58                } 
     59                else  
     60                        undershoot = false; 
     61         
    6362                t += dt;                 
    6463        } 
     
    8786        else 
    8887                p = float3(0,0,0); 
    89           
    90         return p; 
    91 } 
    92 */                               
    93  
     88         
     89        newDir = p;  
     90        return dp; 
     91} 
     92                         
     93/* 
    9494float3 Hit( float3 x, float3 R, samplerCUBE mp ) 
    9595{ 
    96         return R  + 0.00000000001 * x; 
     96        //return R  + 0.00000000001 * x; 
    9797        float rl = readDistanceCubeMap( mp, R);                         // |r| 
    9898         
     
    103103 
    104104        // iteration 
    105         for( int i = 0; i < 2; i++ )    // 2 !!!!!!!!!!!!!!!!!!!!!!! 
     105        for( int i = 0; i < SECANT_ITERATIONCOUNT; i++ )         
    106106        { 
    107107                float llp = length( l ) / readDistanceCubeMap( mp, l);          // |l|/|l’| 
     
    120120        return l;                                                                                               // computed hit point 
    121121} 
    122  
    123 void LocalizedVS(float4 position : POSITION, 
    124                 out float3 wPos : TEXCOORD1,                             
    125                 float2 texCoord : TEXCOORD0, 
    126                 out float2 otexCoord : TEXCOORD0, 
    127                 float3 normal   : NORMAL, 
    128                 out float3 mNormal  : TEXCOORD2, 
    129                 out float4 hPos : POSITION,              
    130                 uniform float4x4 worldViewProj, 
    131                 uniform float4x4 world) 
    132 { 
    133   
    134   hPos = mul(worldViewProj, position); 
    135   wPos = mul(world, position).xyz;   
    136   mNormal = normal; 
    137   otexCoord = texCoord; 
    138 } 
    139  
    140 ////////////// 
    141 //Localized reflection 
    142 ////////////// 
    143 void LocalizedPS(  float2 texCoord : TEXCOORD0,  
    144                 float3 wPos     : TEXCOORD1,     
    145                 float3 mNormal  : TEXCOORD2, 
    146                 uniform float3 cameraPos, 
    147                 uniform samplerCUBE CubeMap : register(s0), 
    148                 uniform samplerCUBE DistanceMap : register(s1), 
    149                 uniform float3 lastCenter, 
    150                 uniform float3 lightPosition,            
    151                 out float4 Color :COLOR0) 
    152 { 
    153          
    154         Color = float4(1,1,1,1); 
    155          
    156         mNormal = normalize(mNormal); 
    157         float3 RR, TT;   
    158         float3 mPos = wPos - lastCenter; 
    159         float3 V = normalize(wPos - cameraPos); 
    160         float3 R = /*normalize*/(reflect( V, mNormal)); 
    161          
    162         float3 T = refract(V, mNormal, 0.9); 
    163                  
    164         RR = R; TT = T; 
    165         //RR += 0.000001 * lastCenter.x; 
    166         RR = Hit(mPos, R, DistanceMap); 
    167         TT = Hit(mPos, T, DistanceMap); 
    168          
    169         float4 reflectcolor = readCubeMap(CubeMap, RR );                 
    170         float4 refractcolor = readCubeMap(CubeMap, TT );                 
    171          
    172         float cos_theta = -dot(V, mNormal); 
    173         float sFresnel = 0.1; 
    174         float F = (sFresnel + pow(1-cos_theta, 5.0f) * (1-sFresnel)); 
    175      
    176     float3 L = normalize(lightPosition - wPos); 
    177         float3 H = normalize(L+V); 
    178         float4 lighting = lit(dot(mNormal, L),dot(mNormal, H), 30); 
    179         Color = (F * reflectcolor + (1-F) * refractcolor) + lighting.z;  
    180 } 
    181  
    182  
     122*/ 
     123 
     124struct VertOut 
     125{ 
     126        float3 wPos     : TEXCOORD1; 
     127        float3 cPos     : TEXCOORD3; 
     128        float2 texCoord : TEXCOORD0; 
     129        float3 mNormal  : TEXCOORD2; 
     130        float4 hPos : POSITION;                  
     131}; 
     132 
     133VertOut DefaultVS(float4 position : POSITION,                                            
     134                                float2 texCoord : TEXCOORD0, 
     135                                float3 normal   : NORMAL, 
     136                                uniform float4x4 worldViewProj, 
     137                                uniform float4x4 world, 
     138                                uniform float4x4 worldview, 
     139                                uniform float4x4 worldI ) 
     140{ 
     141  VertOut OUT; 
     142  OUT.hPos = mul(worldViewProj, position); 
     143  OUT.wPos = mul(world, position).xyz;   
     144  OUT.cPos = mul(worldview, position).xyz;   
     145  OUT.mNormal = mul(normal, worldI);   
     146  //OUT.mNormal = normal; 
     147  OUT.texCoord = texCoord; 
     148  return OUT; 
     149} 
    183150 
    184151////////////// 
    185152//Metal 
    186153////////////// 
    187 void LocalizedMetalPS(  float2 texCoord : TEXCOORD0,  
    188                 float3 wPos     : TEXCOORD1,     
    189                 float3 mNormal  : TEXCOORD2, 
     154void Metal1BouncePS(  VertOut IN, 
    190155                uniform float3 cameraPos, 
    191156                uniform samplerCUBE CubeMap : register(s0), 
     
    198163        Color = float4(1,1,1,1); 
    199164         
    200         mNormal = normalize(mNormal); 
     165        IN.mNormal = normalize(IN.mNormal); 
    201166        float3 newTexCoord;      
    202         float3 mPos = wPos - lastCenter; 
    203         float3 V  = (wPos - cameraPos); 
     167        float3 mPos = IN.wPos - lastCenter; 
     168        float3 V  = (IN.wPos - cameraPos); 
    204169        float cameraDistace = length(V); 
    205170        V = normalize(V); 
    206         float3 R = normalize(reflect( V, mNormal)); 
    207                  
    208         newTexCoord = R;         
    209          
    210         newTexCoord = Hit(mPos, R, DistanceMap); 
    211         /*if(dot(newTexCoord,newTexCoord) == 0)  
    212                 Color = float4(0.5,0.5,0.5,1); 
    213         else*/ 
    214                 Color = readCubeMap(CubeMap, newTexCoord );      
    215          
    216         float ctheta_in = dot(mNormal,R); 
    217         float ctheta_out = dot(mNormal,-V); 
     171        float3 R = normalize(reflect( V, IN.mNormal)); 
     172                 
     173        newTexCoord = R + 0.00000001 * lastCenter.x;     
     174        //newTexCoord = R;       
     175        //Hit(mPos, R, DistanceMap, newTexCoord); 
     176        Color = readCubeMap(CubeMap, newTexCoord );      
     177         
     178        float ctheta_in = dot(IN.mNormal,R); 
     179        float ctheta_out = dot(IN.mNormal,-V); 
    218180 
    219181        float3 F = 0; 
     
    229191        Color = Color * float4(F,1);     
    230192} 
    231 ////////////// 
    232 //PhotonMap 
    233 ////////////// 
    234 /*void PhotonMapPS(  float2 texCoord : TEXCOORD0,  
    235                 float3 wPos     : TEXCOORD1,     
    236                 float3 mNormal  : TEXCOORD2, 
     193 
     194 
     195void MetalMultipleBouncePS(  VertOut IN, 
    237196                uniform float3 cameraPos, 
    238                 uniform samplerCUBE UVMap : register(s0), 
     197                uniform samplerCUBE CubeMap : register(s0), 
    239198                uniform samplerCUBE DistanceMap : register(s1), 
     199                uniform samplerCUBE NormDistMap1 : register(s2), 
     200                uniform samplerCUBE NormDistMap2 : register(s3), 
    240201                uniform float3 lastCenter, 
    241202                out float4 Color :COLOR0) 
     
    244205        Color = float4(1,1,1,1); 
    245206         
    246         mNormal = normalize(mNormal); 
     207        IN.mNormal = normalize(IN.mNormal); 
    247208        float3 newTexCoord;      
    248         float3 mPos = wPos - lastCenter; 
    249         float3 V = normalize(wPos - cameraPos); 
    250         float3 R = normalize(reflect( V, mNormal)); 
    251                  
    252         newTexCoord = R;         
    253          
    254         newTexCoord = Hit(mPos, R, DistanceMap); 
    255          
    256         Color = readCubeMap(UVMap, newTexCoord ); 
    257         //Color = float4(1,0,0,1);               
    258 }*/ 
    259  
    260 float4 PhotonMapCausticPS(  float2 texCoord : TEXCOORD0,  
    261                 float3 wPos     : TEXCOORD1,     
    262                 float3 mNormal  : TEXCOORD2, 
    263                 uniform float3 cameraPos, 
    264                 uniform samplerCUBE DistanceMap : register(s0), 
    265                 uniform float3 lastCenter):COLOR0 
    266 { 
    267          
    268         float4 Color = float4(1,1,1,1); 
    269          
    270         mNormal = normalize(mNormal); 
    271         float3 newTexCoord;      
    272         float3 mPos = wPos - lastCenter; 
    273         float3 V = normalize(wPos - cameraPos); 
    274                  
    275         float3 R = refract(V, mNormal, 0.85);            
    276         //float3 R = V;  
    277         newTexCoord = R;         
    278                  
    279         newTexCoord = Hit(mPos, R, DistanceMap); 
    280                  
    281         Color = float4(newTexCoord, 1); 
    282          
    283         //Color = 0.0001 * Color +  float4(0,0,1,1); 
    284         //Color += 0.0001 * lastCenter.x; 
    285         if(dot(V,mNormal)>0) 
    286         { 
    287                 Color = float4(1,0,0,0);                 
    288         }                
    289         return Color; 
    290 } 
    291  
    292  
    293  
    294 ///////////////////// 
    295 ///// Diffuse 
    296 /////////////////// 
    297  
    298 float4 GetContibution(float3 L, float3 pos, float3 N, float3 V, samplerCUBE SmallEnvMapSampler, samplerCUBE DistanceEnvMapSampler)      // Phong-Blinn 
    299 // L: a hossza lényeges (az egységkocka faláig ér) 
    300 { 
    301     REDUCED_CUBEMAP_SIZE = 4; 
    302      
    303         float kd = 0.3; // 0.3 
    304         float ks = 0;   // 0.5 
    305         float shininess = 10; 
    306          
    307         float l = length(L); 
    308         L = normalize(L); 
    309  
    310         //dw 
    311         float dw = 4 / (REDUCED_CUBEMAP_SIZE*REDUCED_CUBEMAP_SIZE*l*l*l + 4/3.1416f); 
    312         //Lin 
    313         float4 Lin = readCubeMap(SmallEnvMapSampler, L); 
    314         //r 
    315         float doy = readDistanceCubeMap(DistanceEnvMapSampler, L); 
    316         float dxy = length(L * doy - pos);       
    317  
    318         //dws 
    319         float dws = (doy*doy * dw) / (dxy*dxy*(1 - dw/3.1416f) + doy*doy*dw/3.1416f);   // localization: 
    320         //float dws = dw; 
    321          
    322         //L = L * doy - pos;    // L: x->y, az objektumtól induljon, ne a középpontból 
    323         L = normalize(L); 
    324         float3 H = normalize(L + V);    // felezõvektor 
    325  
    326         float a = kd * max(dot(N,L),0) +  
    327                           ks * pow(max(dot(N,H),0), shininess); // diffuse + specular 
    328  
    329         // 1.: eddigi 
    330         //return Lin * a * dws; 
    331          
    332         float ctheta_in = dot(N,L); 
    333         float ctheta_out = dot(N,V);     
    334          
    335         return Lin * a * dws;            
    336 } 
    337  
    338 void DiffuseVS( float4 position : POSITION, 
    339                 float3 normal : NORMAL, 
    340                 float2 Tex : TEXCOORD0, 
    341                 uniform float4x4 worldViewProj, 
    342                                 uniform float4x4 world, 
    343                                 //uniform float3 lastCenter,    //LI// 
    344                                 out float4 hposition : POSITION, 
    345                 out float2 oTex : TEXCOORD0, 
    346                 out float3 Normal : TEXCOORD1, 
    347                 out float3 pos : TEXCOORD2 ) 
    348 { 
    349         pos = /*lastCenter + 0.01 * */mul( world, position ).xyz; 
    350         Normal = normal; 
    351     oTex = Tex;     
    352     hposition = mul( worldViewProj, position ); 
    353 } 
    354  
    355  
    356 float4 DiffusePS( float2 Tex : TEXCOORD0, 
    357            float3 N : TEXCOORD1, 
    358            float3 pos : TEXCOORD2, 
    359            uniform float3 cameraPos, 
    360            uniform float3 lastCenter,   //LI// 
    361            uniform samplerCUBE SmallEnvMapSampler : register(s0), 
    362            uniform samplerCUBE DistanceEnvMapSampler : register(s1) 
    363             ) : COLOR0 
    364 { 
    365     REDUCED_CUBEMAP_SIZE = 4; 
    366          
    367     //V = /*-*/normalize( V ); 
    368     float3 V = normalize(pos - cameraPos);      //  
    369     N = normalize( N );  
    370         float3 R = reflect(V, N); 
    371     pos -= lastCenter; 
    372  
    373          
    374     //return float4(N,1); 
    375     //return float4(V,1); 
    376     //return float4(R,1); 
    377                  
    378         //return readCubeMap(SmallEnvMapSampler,R); 
    379          
    380     //pos.xy += float2(1.0/LIGHT_TEXTURE_SIZE, -1.0/LIGHT_TEXTURE_SIZE);        // eltolás a pixel/texel középpontba 
    381     // x, y = -1..1 
    382     // z = 1 
    383      
    384     float4 intens = 0; 
    385     /* 
    386         intens += GetContibution( R, pos, N, V, SmallEnvMapSampler); 
    387         intens = readCubeMap(SmallEnvMapSampler, R); 
    388         return intens;*/ 
    389          
    390         for (int x = 0; x < REDUCED_CUBEMAP_SIZE; x++)                  // az envmap minden texelére 
    391          for (int y = 0; y < REDUCED_CUBEMAP_SIZE; y++) 
    392         //int x = 0;            // az envmap 1 texelére 
    393         //int y = 0;  
    394         //if (x==LIGHT_TEXTURE_SIZE/2 && y==LIGHT_TEXTURE_SIZE/2) 
    395          { 
    396                 // intenzitás kiolvasása az adott texelbõl  
    397                  
    398                 float2 p, tpos;  
    399             tpos.x = x/(float)REDUCED_CUBEMAP_SIZE;     // 0..1 
    400             tpos.y = y/(float)REDUCED_CUBEMAP_SIZE;     // 0..1 
    401             tpos.xy += float2(0.5/REDUCED_CUBEMAP_SIZE, 0.5/REDUCED_CUBEMAP_SIZE);      // az adott texel középpont uv koordinátái 
    402              
    403             p.x = tpos.x;  
    404             p.y = 1-tpos.y; 
    405             p.xy = 2*p.xy - 1;  // -1..1        // az adott texel középpont pozíciója 
    406              
    407             float3 L; 
    408             
    409                 L = float3(p.x, p.y, 1); 
    410                 intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler); 
    411                  
    412                 L = float3(p.x, p.y, -1); 
    413                 intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler); 
    414                  
    415                 L = float3(p.x, 1, p.y); 
    416                 intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler); 
    417                  
    418                 L = float3(p.x, -1, p.y); 
    419                 intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler); 
    420                  
    421                 L = float3(1, p.x, p.y); 
    422                 intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler); 
    423                  
    424                 L = float3(-1, p.x, p.y); 
    425                 intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler); 
    426         } 
    427  
    428         return intens; 
    429 } 
     209        float3 mPos = IN.wPos - lastCenter; 
     210        float3 V  = (IN.wPos - cameraPos); 
     211        float cameraDistace = length(V); 
     212        V = normalize(V); 
     213        float3 R = normalize(reflect( V, IN.mNormal)); 
     214                 
     215        newTexCoord = R; 
     216         
     217        //Color = readCubeMap(NormDistMap1, mPos ); 
     218        //return; 
     219         
     220        float3 newDir1; 
     221        float d1 = Hit(mPos, R, NormDistMap1, newDir1); 
     222        float3 normal1 = readCubeMap(NormDistMap1, newDir1); 
     223        float3 newDir2; 
     224        float d2 = Hit(mPos, R, NormDistMap2, newDir2); 
     225        float3 normal2 = readCubeMap(NormDistMap2, newDir2); 
     226                 
     227        if( dot(newDir2,newDir2) == 0.0 && dot(newDir1,newDir1) == 0.0 ) 
     228        { 
     229                Hit(mPos, R, DistanceMap, newTexCoord);  
     230                Color = readCubeMap(CubeMap, newTexCoord );                      
     231        } 
     232        else 
     233        { 
     234                float3 newV; 
     235                float3 newR; 
     236                float3 newN = normal1; 
     237                float3 dir = newDir1; 
     238                float d = d1; 
     239                float3 newX; 
     240                //closer hit 
     241                if(d1 > d2) 
     242                { 
     243                        dir = newDir2; 
     244                        d = d2; 
     245                        newN = normal2; 
     246                } 
     247                newV = R; 
     248                newX = mPos + R * d; 
     249                newR = normalize(reflect( newV, newN)); 
     250                 
     251                Hit(newX, newR, DistanceMap, newTexCoord);       
     252                Color = readCubeMap(CubeMap, newTexCoord );              
     253        } 
     254          
     255        //Color = float4(newDir2,1); 
     256         
     257        float ctheta_in = dot(IN.mNormal,R); 
     258        float ctheta_out = dot(IN.mNormal,-V); 
     259 
     260        float3 F = 0; 
     261         
     262        // F,P,G számítása 
     263        if ( ctheta_in > 0 && ctheta_out > 0 ) 
     264        { 
     265                float3 H = normalize(R - V);    // felezõvektor 
     266                float cbeta  = dot(H,R);                 
     267                F = F0 + (1-F0)*pow(1-cbeta,5); 
     268        }        
     269         
     270        Color = Color * float4(F,1);     
     271} 
     272 
     273float4 NormalDistancePS( VertOut IN):COLOR 
     274{ 
     275  
     276 float4 Color = float4(0, 0, 0, 0); 
     277 //return Color; 
     278 Color = float4(normalize(IN.mNormal), length(IN.cPos)); 
     279 return Color; 
     280} 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/scripts/MetalTeapot.material

    r1720 r1724  
     1vertex_program DefaultVS hlsl 
     2{ 
     3        source MetalTeapot.hlsl 
     4        entry_point DefaultVS 
     5        target vs_2_0  
     6}  
     7 
     8fragment_program Metal1BouncePS hlsl 
     9{ 
     10        source MetalTeapot.hlsl 
     11        entry_point Metal1BouncePS 
     12        target ps_3_0 
     13}  
    114 
    215material MetalTeapot 
    316{  
    4  
    517   technique  
    618   {  
     
    1325                                update_interval         0 
    1426                                distance_calc false 
    15                                 face_angle_calc false 
    16                                 render           
     27                                face_angle_calc false                                    
    1728                        } 
    1829                        RenderTechnique DistanceCubeMap 
     
    2435                 
    2536                 } 
    26                  vertex_program_ref GameTools/CubeMap/VertexPrograms/LocalizedVS 
     37                 vertex_program_ref DefaultVS 
    2738         {        
    2839            param_named_auto worldViewProj worldviewproj_matrix  
    2940            param_named_auto world world_matrix 
    30              
     41            param_named_auto worldview worldview_matrix 
     42            param_named_auto worldI inverse_world_matrix             
    3143         }  
    32                  fragment_program_ref   GameTools/CubeMap/FragmentPrograms/LocalizedMetalPS 
     44                 fragment_program_ref   Metal1BouncePS 
    3345         {  
    3446                        param_named_auto cameraPos camera_position 
    3547                        //param_named n float3 0.21 0.96 1.17 
    3648                        //param_named k float3 4.16 2.57 2.32 
    37                         param_named F0 float3 0.95 0.63 0.54 
    38                         param_named_auto lightPosition light_position 0  
    39                          
     49                        param_named F0 float3 0.95 0.63 0.54                     
    4050                }  
    4151                 
     
    4353                texture_unit 
    4454                { 
    45                         cubic_texture cubemap.jpg combinedUVW 
    46                         tex_address_mode clamp 
    47                         colour_op replace 
     55                         
    4856                } 
    4957 
     
    5159                texture_unit 
    5260                { 
    53                         cubic_texture cubemap.jpg combinedUVW 
    54                         tex_address_mode clamp 
    55                         colour_op replace 
     61                         
    5662                } 
    5763          } 
    5864    } 
    5965} 
     66 
     67fragment_program NormalDistancePS hlsl 
     68{ 
     69        source MetalTeapot.hlsl 
     70        entry_point NormalDistancePS 
     71        target ps_3_0 
     72}  
     73 
     74material NormalDistanceCW 
     75{ 
     76 technique  
     77 {  
     78  pass  
     79  {  
     80    cull_hardware clockwise 
     81     
     82        vertex_program_ref DefaultVS 
     83    {        
     84        param_named_auto worldViewProj worldviewproj_matrix  
     85            param_named_auto world world_matrix 
     86            param_named_auto worldview worldview_matrix 
     87        param_named_auto worldI inverse_world_matrix     
     88    } 
     89    fragment_program_ref NormalDistancePS 
     90    {  
     91                                 
     92        }  
     93  } 
     94 } 
     95} 
     96 
     97material NormalDistanceCCW 
     98{ 
     99 technique  
     100 {  
     101  pass  
     102  {  
     103    cull_hardware anticlockwise 
     104        vertex_program_ref DefaultVS 
     105    {        
     106        param_named_auto worldViewProj worldviewproj_matrix  
     107            param_named_auto world world_matrix 
     108            param_named_auto worldview worldview_matrix 
     109        param_named_auto worldI inverse_world_matrix     
     110    } 
     111    fragment_program_ref NormalDistancePS 
     112    {  
     113                                 
     114        }  
     115  } 
     116 } 
     117} 
     118 
     119fragment_program MetalMultipleBouncePS hlsl 
     120{ 
     121        source MetalTeapot.hlsl 
     122        entry_point MetalMultipleBouncePS 
     123        target ps_3_0 
     124}  
     125 
     126material MetalTeapotMultipleBounce 
     127{  
     128   technique  
     129   {  
     130      pass  
     131      {  
     132                IllumTechniques 
     133                { 
     134                        RenderTechnique ColorCubeMap 
     135                        { 
     136                                update_interval         0 
     137                                distance_calc false 
     138                                face_angle_calc false                                    
     139                        } 
     140                        RenderTechnique DistanceCubeMap 
     141                        { 
     142                                update_interval         0 
     143                                distance_calc true false 
     144                                face_angle_calc true false               
     145                        } 
     146                        RenderTechnique ColorCubeMap 
     147                        { 
     148                                layer 1 
     149                                texture_unit_id 2 
     150                                update_interval         0 
     151                                distance_calc true false 
     152                                face_angle_calc true false 
     153                                render_env false 
     154                                render_self true 
     155                                self_material NormalDistanceCCW 
     156                        } 
     157                        RenderTechnique ColorCubeMap 
     158                        { 
     159                                layer 2 
     160                                texture_unit_id 3 
     161                                update_interval         0 
     162                                distance_calc true false 
     163                                face_angle_calc true false 
     164                                render_env false 
     165                                render_self true 
     166                                self_material NormalDistanceCW 
     167                        } 
     168                 
     169                 } 
     170                 vertex_program_ref DefaultVS 
     171         {        
     172            param_named_auto worldViewProj worldviewproj_matrix  
     173            param_named_auto world world_matrix 
     174            param_named_auto worldview worldview_matrix 
     175            param_named_auto worldI inverse_world_matrix 
     176             
     177         }  
     178                 fragment_program_ref   MetalMultipleBouncePS 
     179         {  
     180                        param_named_auto cameraPos camera_position 
     181                        //param_named n float3 0.21 0.96 1.17 
     182                        //param_named k float3 4.16 2.57 2.32 
     183                        param_named F0 float3 0.95 0.95 0.95                     
     184                }  
     185                 
     186                //Cube map of environment 
     187                texture_unit 
     188                { 
     189                         
     190                } 
     191                //Cube map of environment distances 
     192                texture_unit 
     193                { 
     194                         
     195                } 
     196                 
     197                //Cube map of reflective object's normals and distances CCW 
     198                texture_unit 
     199                { 
     200                         
     201                } 
     202                 
     203                //Cube map of reflective object's normals and distances CW 
     204                texture_unit 
     205                { 
     206                         
     207                } 
     208          } 
     209    } 
     210} 
Note: See TracChangeset for help on using the changeset viewer.