Changeset 2451


Ignore:
Timestamp:
06/13/07 16:07:30 (17 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/App/Games/CarDriving_BME/Media/materials
Files:
9 added
3 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Games/CarDriving_BME/Media/materials/programs/CarReflections.hlsl

    r1049 r2451  
     1//#define EFFECTS 
     2//#define LOCALIZATION 
     3 
    14float3 F0; 
    25 
     
    5255                uniform float4x4 worldViewProj, 
    5356                uniform float4x4 world, 
    54                 uniform float4x4 worldIT) 
     57                uniform float4x4 worldI) 
    5558{ 
    5659  
    5760  hPos = mul(worldViewProj, position); 
    5861  wPos = mul(world, position).xyz;   
    59   mNormal = mul(normal, worldIT); 
     62  mNormal = mul(normal, worldI); 
    6063  //mNormal *=-1; 
    6164 //mNormal = normal;   
     
    8487        float3 mPos = wPos - lastCenter; 
    8588        float3 V = normalize(wPos - cameraPos); 
     89 
     90#ifdef EFFECTS 
    8691        float3 R = normalize(reflect( V, mNormal)); 
    8792                 
    8893        newTexCoord = R;         
    89          
     94#ifdef LOCALIZATION      
    9095        newTexCoord = Hit(mPos, R, DistanceMap); 
     96#endif 
    9197        Color = readCubeMap(CubeMap, newTexCoord );      
    9298         
     
    107113        Color = Color * float4(F,1); 
    108114         
    109          
     115#endif   
    110116//phong 
    111117         
     
    135141        Color = float4(1,1,1,1); 
    136142 
     143#ifdef EFFECTS 
    137144        //metallic reflection    
    138145        mNormal = normalize(mNormal); 
     
    144151                 
    145152        newTexCoord = R;         
    146          
     153#ifdef LOCALIZATION      
    147154        newTexCoord = Hit(mPos, R, DistanceMap); 
     155#endif 
    148156        Color = readCubeMap(CubeMap, newTexCoord );              
     157#endif 
    149158         
    150159} 
     
    163172        Color = float4(1,1,1,1); 
    164173 
     174#ifdef EFFECTS 
    165175        //metallic reflection    
    166176        mNormal = normalize(mNormal); 
     
    172182                 
    173183        newTexCoord = R;         
    174          
     184#ifdef LOCALIZATION 
    175185        newTexCoord = Hit(mPos, R, DistanceMap); 
     186#endif 
    176187        Color = readCubeMap(CubeMap, newTexCoord ); 
    177188        Color.a = 1; 
     189#endif 
    178190        Color *= glasColor;              
    179191         
  • GTP/trunk/App/Games/CarDriving_BME/Media/materials/programs/DiffuseBump.hlsl

    r1049 r2451  
    1 float4x4 world_IT; 
     1//#define EFFECTS 
     2 
     3float4x4 world_I; 
    24int REDUCED_CUBEMAP_SIZE = 8; 
    35 
     
    105107  hPos = mul(worldViewProj, position); 
    106108  wPos = mul(world, position).xyz;   
    107   //mNormal = mul(normal, world_IT); 
    108   mNormal = normal; 
     109  mNormal = normalize(mul(normal, world_I)); 
    109110  otexCoord = texCoord; 
    110   Tangent = tangent 
     111  Tangent = normalize(mul(tangent, world_I)) 
    111112  Binormal = cross(tangent, normal);  
    112113} 
     
    119120           uniform float3 cameraPos, 
    120121           uniform float3 lastCenter, 
    121            uniform half3 lightPosition,                          
     122           uniform half4 lightPosition,                          
    122123           uniform samplerCUBE SmallEnvMapSampler : register(s0), 
    123124           uniform samplerCUBE DistanceEnvMapSampler : register(s1), 
     
    128129    REDUCED_CUBEMAP_SIZE = 4; 
    129130         
     131    Tangent = normalize(Tangent); 
     132    N = normalize(N); 
     133    Binormal = normalize(Binormal); 
    130134    //V = /*-*/normalize( V ); 
    131135    float3 V = normalize(pos - cameraPos);      //  
     
    134138        half3 tNormal = tex2D(NormalMap, Tex).rgb;       
    135139       
    136     N =mul(tNormal, ModelToTangent ); 
    137     N = mul( N, world_IT ); 
    138     N = normalize(N); 
     140    N = normalize(mul(tNormal, ModelToTangent )); 
    139141     
    140142    float3 R = reflect(V, N); 
     
    143145    float4 intens = 0; 
    144146     
    145          
     147#ifdef EFFECTS   
    146148        for (int x = 0; x < REDUCED_CUBEMAP_SIZE; x++)                  // az envmap minden texelére 
    147149         for (int y = 0; y < REDUCED_CUBEMAP_SIZE; y++) 
     
    178180                intens += GetContibution( L, pos, N, V, SmallEnvMapSampler, DistanceEnvMapSampler); 
    179181        } 
    180          
    181         half3 light = lightPosition; 
     182 
     183#endif   
     184        half3 light = lightPosition.xyz; 
    182185        half3 L = normalize(light); 
    183         half3 H = normalize(L + V); 
     186        half3 H = normalize(L - V); 
    184187        half4 lighting = lit(dot(N, L),dot(N, H), 20); 
    185188 
    186189        float4 retColor = intens; 
    187190        float4 texColor = tex2D(ColorTexture, Tex); 
    188         retColor = intens * texColor * 1.5 
     191#ifdef EFFECTS   
     192         
     193                retColor = intens * texColor * 1.5 
    189194                          + lighting.y * texColor * 0.15  
    190195                          + lighting.z * 0.15                    
    191196                         ; 
     197#else 
     198retColor =lighting.y * texColor 
     199                          + lighting.z; 
     200#endif 
    192201        return retColor; 
    193202} 
  • GTP/trunk/App/Games/CarDriving_BME/Media/materials/programs/GameTools_Localized_EnvMap.hlsl

    r1049 r2451  
     1//#define EFFECTS 
     2//#define LOCALIZATION 
     3 
    14//metal: 
    25float3 n, k;    // R 700 nm, G 550 nm, B 435 nm  
     
    160163        float3 mPos = wPos - lastCenter; 
    161164        float3 V = normalize(wPos - cameraPos); 
     165 
    162166        float3 R = normalize(reflect( V, mNormal)); 
    163167                 
     168#ifdef EFFECTS 
    164169        newTexCoord = R;         
    165          
     170#ifdef LOCALIZATION 
    166171        newTexCoord = Hit(mPos, R, DistanceMap); 
     172#endif 
    167173        Color = readCubeMap(CubeMap, newTexCoord ); 
    168          
     174#else 
     175        Color = 1;       
     176#endif 
     177 
    169178        //Color = float4(mNormal + lastCenter.x*0.0000001, 1);   
    170179         
     
    185194        }        
    186195         
    187         Color = Color * float4(F,1); 
    188          
     196        Color = Color * float4(F,1);     
    189197        //Color = length(lastCenter.xyz) * 0.1; 
    190198} 
  • GTP/trunk/App/Games/CarDriving_BME/Media/materials/programs/bottle.hlsl

    r1049 r2451  
     1//#define EFFECT 
     2//#define LOCALIZATION 
     3 
    14float4 readCubeMap(samplerCUBE cm, float3 coord)                 
    25{ 
     
    5053                uniform float4x4 worldViewProj, 
    5154                uniform float4x4 world, 
    52                 uniform float4x4 worldIT) 
     55                uniform float4x4 worldI) 
    5356{ 
    5457  
    5558  hPos = mul(worldViewProj, position); 
    5659  wPos = mul(world, position).xyz;   
    57   mNormal = mul(normal, worldIT); 
     60  mNormal = mul(normal, worldI); 
    5861 // mNormal = normal; 
    5962  otexCoord = texCoord; 
     
    8184        float3 mPos = wPos - lastCenter; 
    8285        float3 V = normalize(wPos - cameraPos); 
    83         float3 R = normalize(reflect( V, mNormal)); 
     86 
     87#ifdef EFFECT 
     88                float3 R = normalize(reflect( V, mNormal)); 
    8489         
    8590        float3 T =  normalize(refract(V, mNormal, 0.9)); 
     
    8792        RR = R; TT = T;  
    8893         
     94        #ifdef LOCALIZATION 
    8995        RR = Hit(mPos, R, DistanceMap); 
    9096        TT = Hit(mPos, T, DistanceMap); 
     97        #endif 
    9198         
    9299        float4 reflectcolor = readCubeMap(CubeMap, RR );                 
     
    98105 
    99106        Color = (F * reflectcolor + (1-F) * refractcolor * float4(color,1)) ; 
    100          
     107#else 
     108        Color = float4(color, 1); 
     109#endif 
    101110        half3 light = lightPosition;  
    102111        V = -V; 
  • GTP/trunk/App/Games/CarDriving_BME/Media/materials/scripts/scene1.material

    r1049 r2451  
    1616                                         
    1717                                } 
    18                                 RenderTechnique CausticReciever 
    19                                 { 
    20                                 max_caster_count       10       
    21                                 } 
     18                                //RenderTechnique CausticReciever 
     19                                //{ 
     20                                // max_caster_count     10       
     21                                //} 
    2222                        } 
    2323                         
Note: See TracChangeset for help on using the changeset viewer.