Ignore:
Timestamp:
05/03/07 11:31:38 (17 years ago)
Author:
szirmay
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/Ogre/Media/MORIA/bump.hlsl

    r2336 r2345  
    3535        Light = normalize(Light); 
    3636        float3 Half = normalize(Light + View); 
    37         float4 Lighting = lit(dot(Normal, Light), dot(Normal, Half), 16); 
     37        float4 Lighting = lit(dot(Normal, Light), dot(Normal, Half), 120); 
    3838        float4 Color= tex2D(ColorMapSampler, tileTexCoord) * tex2D(DetailMapSampler, detailTexCoord2); 
    3939 
    40         return Lighting.y * Color * (d < lightRange.x) / (lightRange.y + d * lightRange.z + d * d * lightRange.w) * lightPower; 
     40        return (Lighting.y * Color + Lighting.z * 0.5) * (d < lightRange.x) / (lightRange.y + d * lightRange.z + d * d * lightRange.w) * lightPower; 
    4141} 
    4242 
     
    116116        float3x3 ModelToTangent = TransfModelToTangent(IN.wTangent, IN.wBinormal, IN.wNormal ); 
    117117    // get model space normal vector 
    118     //float3 tNormal = tex2D(BumpMapSampler, IN.TexNormalCoord).rgb; 
    119     float3 tNormal = float3(0,1,0); 
     118    float3 tNormal = tex2D(BumpMapSampler, IN.TexNormalCoord).rgb; 
     119    if(length(tNormal == 0)) 
     120     tNormal = float3(0,0,1); 
     121    tNormal.xy = (tNormal.xy *2.0) - 1.0; 
    120122        // Normal vector should be transformed with the inverse transpose of TangentToModel 
    121123        // which is the transpose of ModelToTangent 
     
    130132     } 
    131133        // illumination calculation 
    132     return Illumination(mLight, IN.wNormal, mView, IN.TexCoord2, IN.TexCoord) * spotFalloff;     
     134        float4 illum = Illumination(mLight, mNormal/*IN.wNormal*/, mView, IN.TexCoord2, IN.TexCoord) * spotFalloff; 
     135        return float4(illum.rgb, 0.7);   
    133136     
    134137} 
Note: See TracChangeset for help on using the changeset viewer.