Ignore:
Timestamp:
09/30/06 19:00:42 (18 years ago)
Author:
igarcia
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/IBRBillboardCloudTrees/OGRE/IBRTreesOGRE/media/general/f_lighting_indirect_texture_mapping.cg

    r1493 r1546  
    55  sampler2D sourceTexture : TEXUNIT1; 
    66  sampler2D visibilityTexture : TEXUNIT2; 
     7  sampler2D noisyTexture : TEXUNIT3; 
    78 
    89 
     
    7475                float e = lerp(visibility.x, visibility.y, unifcoord.x); 
    7576                float f = lerp(visibility.w, visibility.z, unifcoord.x); 
    76                 float g = clamp(lerp(e, f, unifcoord.y), 0.3, 1.0); 
     77                float g = 1.0 - clamp(lerp(e, f, unifcoord.y), 0.0, 1.0); 
    7778                ambientColor +=  float3(g, g, g); 
    7879            }        
     
    8485 
    8586            // Angle between normal and light vector 
    86             float l_CosNL = saturate(dot(l_Normal, l_LightVector)) + saturate(-dot(l_Normal, l_LightVector)); 
     87            float l_CosNL = clamp(dot(l_Normal, l_LightVector), 0.0, 1.0); 
    8788 
    8889            // No light can reach back surfaces... 
    89             //if (l_CosNL == 0) 
    90             //    discard; 
     90            if (l_CosNL == 0) 
     91            { 
     92                l_CosNL = clamp(-dot(l_Normal, l_LightVector), 0.0, 1.0); 
     93            } 
    9194             
    92             l_Out.color.rgb += (p_Diffuse.rgb * diffuseColor.rgb) * p_LightDiffuse.rgb * l_CosNL; 
     95            l_Out.color.rgb += (p_Diffuse.rgb * diffuseColor.rgb) * p_LightDiffuse.rgb * l_CosNL + float3(tex2D(noisyTexture,float2(p_In.wposition.x,p_In.wposition.z)/ 10000.0).x * 0.15, tex2D(noisyTexture,float2(p_In.wposition.z,p_In.wposition.x)/10000.0).x * 0.25,0.0); 
    9396             
    9497            // Specular component 
     
    9699 
    97100            // Apply cosine power distribution around mirror direction 
    98             float l_CosNH = saturate(dot(l_Normal, l_HalfVector)) + saturate(-dot(l_Normal, l_HalfVector)); 
     101            float l_CosNH = clamp(dot(l_Normal, l_HalfVector), 0.0, 1.0) + clamp(-dot(l_Normal, l_HalfVector), 0.0, 1.0); 
    99102                 
    100103            float l_SpecularPower = pow(l_CosNH, p_Specular.a); 
     
    103106 
    104107            // Add specular component 
    105             l_Out.color.rgb += l_Specular.rgb; 
     108            //l_Out.color.rgb += l_Specular.rgb; 
    106109 
    107110            // Modulate by light incoming power 
Note: See TracChangeset for help on using the changeset viewer.