Changeset 2403


Ignore:
Timestamp:
06/05/07 01:55:55 (17 years ago)
Author:
szirmay
Message:
 
Location:
GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap
Files:
1 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMap.hlsl

    r2345 r2403  
    2828        output.pos = mul(WorldViewProj, input.pos); 
    2929        output.tex = input.tex; 
    30         output.texAtlas = input.texAtlas;        
     30        output.texAtlas = input.tex;     
    3131        return output; 
    3232} 
     
    3434float4  psWalk(vsOutputWalk input) : COLOR 
    3535{ 
     36        float2 texAtlas = input.texAtlas; 
     37         
    3638        int2 prmAtlasTiles = prmAtlasTilesHalfPixel.xy; 
    3739        float2 atlasHalfPixel = prmAtlasTilesHalfPixel.zw; 
     
    4143        { 
    4244                float2 prmTexPos = float2( 
    43                         (input.texAtlas.x + (iCluster % prmAtlasTiles.x)) / prmAtlasTiles.x, 
    44                         1.0 - (input.texAtlas.y + (iCluster / prmAtlasTiles.x)) / prmAtlasTiles.y);// + atlasHalfPixel; 
     45                        (texAtlas.x + (iCluster % prmAtlasTiles.x)) / prmAtlasTiles.x, 
     46                        1.0 - (texAtlas.y + (iCluster / prmAtlasTiles.x)) / prmAtlasTiles.y);// + atlasHalfPixel; 
    4547 
    4648                float weightIndex = tex2D(clusterWeightIndexSampler, float2(((float)iCluster + 0.5) / clusterCount, 0.5)).r; 
    4749                float3 weight = tex2D(clusterWeightSampler, float2((weightIndex + 0.5)/allClusterCount, 0.5)).rgb; 
    48                 //weight = 0.0002 + 0.000000000001 * weight; 
    4950                float3 val = tex2D(filteredAtlasSampler, prmTexPos).xyz; 
    50                 if(length(val - float3(1,1,1))== 0) 
    51                 val = 0; 
    52                 col += val.xyz * weight;                 
     51                //if(length(val - float3(1,1,1))== 0) 
     52                //val = 0; 
     53                col += val.xyz * weight;         
     54                //col = 0.00000000001 * col + float3(prmTexPos,1); 
    5355        } 
    5456         
     
    5658 
    5759//return float4(col,1); 
    58         return float4(col * color, 1); 
     60//return float4(color + 0.0000000001 * col, 1)  ; 
     61return float4(col * color, 1); 
    5962 
    6063 
    61         //return float4(col,1) * 0.0000000000001 + tex2D(filteredAtlasSampler, float2(input.texAtlas.x / 32.0, input.texAtlas.y)); 
     64//return float4(col,1) * 0.0000000000001 + tex2D(filteredAtlasSampler, float2(input.texAtlas.x / 32.0, input.texAtlas.y)); 
    6265} 
    6366 
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMapWeightCompute.hlsl

    r2337 r2403  
    5757        float cosb = max(dot(dir, diff), 0);     
    5858         
    59         float visibility = 1; 
     59        float visibility = 0; 
    6060        float4 lightVPos = mul(lightViewProj, float4(pos,1)); 
    61          
    62         if( lightVPos.z > 0.0) 
    63         { 
    64                 lightVPos /= lightVPos.w; 
    65                 float d = length(lightVPos.xy); 
    66          
    67                 if(d <= 1.0) 
    68                 { 
    69  
    70                 float dist = sqrt(dist2);  
    71                 float distNorm = dist / lightFarPlane; 
    72                 lightVPos.xy = (lightVPos.xy + 1.0) / 2.0; 
    73                 lightVPos.y = 1.0 - lightVPos.y; 
    74                 float storedDist = tex2D(shadowMap, lightVPos.xy).r; 
    75                 dist -= DIST_BIAS; 
    76                 visibility = (distNorm <= storedDist);   
    7761                 
     62        //if( lightVPos.z  > 0.0) 
     63        //{      
     64        lightVPos /= lightVPos.w; 
     65                //float d = length(lightVPos.xy); 
     66                 
     67                //if(d <= 1.0) 
     68        { 
     69                        float dist = dist / lightFarPlane; 
     70                        lightVPos.xy = (lightVPos.xy + 1.0) / 2.0; 
     71                        lightVPos.y = 1.0 - lightVPos.y; 
     72                        float storedDist = tex2D(shadowMap, lightVPos.xy).r; 
     73                        visibility = dist < storedDist + DIST_BIAS; 
    7874                } 
    79         } 
    80          
    81         float spotFalloff = (dot(normalize(-diff), normalize(lightDir)) - lightAngleCos) / (1.0 - lightAngleCos); 
     75   // } 
     76    //visibility = 1.0 - visibility; 
     77    visibility = 1.0 + 0.00001 * visibility; 
     78        float spotFalloff = (dot(-diff, normalize(lightDir)) - lightAngleCos) / (1.0 - lightAngleCos); 
     79        //spotFalloff = saturate(dot(normalize(pos - lightPos), normalize(lightDir))) + 0.0000000001 * lightAngleCos; 
     80        spotFalloff = 1.0 + spotFalloff * 0.000000001; 
    8281        spotFalloff = pow(saturate(spotFalloff), spotLightFalloff); 
    83  
    84          
    85         visibility *= spotFalloff / (lightAttenuation.y + dist * lightAttenuation.z + dist * dist * lightAttenuation.w); 
    86  
     82                 
     83        visibility *= spotFalloff / (lightAttenuation.y + dist * lightAttenuation.z + dist2 * lightAttenuation.w); 
    8784         
    8885        float4 ret = visibility * cosb * lightPower * lightColor; 
     
    114111        float storedDist = texCUBE(shadowMap, float3(-diff.xy, diff.z)).r; 
    115112        dist -= DIST_BIAS; 
    116         visibility = (distNorm <= storedDist);   
    117                          
     113        visibility = (distNorm <= storedDist); 
     114           
     115        //visibility = 1.0 + 0.00001 * visibility;               
    118116        visibility *=  1.0 / (lightAttenuation.y + dist * lightAttenuation.z + dist * dist * lightAttenuation.w); 
    119117         
     
    143141                float2 coord2 = coord1 + float2(0.25 * dataColumnWidth, 0); 
    144142                float3 w = tex2Dlod(allWeightsSampler, float4(coord1, 0, 0)).rgb; 
    145                 float radrad = tex2Dlod(radionSampler, float4(coord1, 0, 0)).a;          
     143                float radrad = tex2Dlod(radionSampler, float4(coord2, 0, 0)).a;          
    146144                weight += w * radrad;            
    147145                clusterRad += radrad; 
Note: See TracChangeset for help on using the changeset viewer.